php

[php개발환경] ubuntu+phpstorm+git

bemaru 2014. 10. 28. 16:38
반응형

원격서버 : nginx, php, mysql (Ubuntu 12.04.4 LTS - GNU/Linux 3.2.0-54-virtual x86_64)


VSC : git(github저장소)


내 컴 : phpstorm


참고 : http://www.slideshare.net/sungbumhong/phpstorm-tool-for-php

--


1) github repository생성 : https://github.com/[user id]/test.git


2) phpstorm실행 후 VCS 연동 ( github 저장소 주소랑 id/pw 입력하면 끝 )


3)  


#은 (원격서버 ubuntu)


http://rogerdudler.github.io/git-guide/index.ko.html : git설명서


github 레파지터리에 가보면 아래처럼 써있음


…or create a new repository on the command line

touch README.md git init git add README.md git commit -m "first commit" git remote add origin https://github.com/~/test.git git push -u origin master


# touch README.md 

->readme.md 생성


# git init

->현재 디렉토리를 git으로 관리하겠음. 즉, # ls -a 해서 보면 .git 확인 할 수 있음


# git add README.md

->readme.md 파일을 추가 하겠음

add안하고 commit하면 untracked files가 뜸.

즉, add를 해야 tracking에 추가 하는 것. 간단히 commit 할 수 있게 하겠다 정도


# git commit -m "first commit"

->commit 하며 커밋메세지는 "first commit"

svn의 commit은 저장소에 보내는 개념이지만

git의 commit은 저장소의 연결없이 로컬에서 진행됨, 로컬에서 commit진행하다가 나중에 원격에 붙어도됨. (HEAD는 생기지만 git저장소에는 반영안됨)


# git remote add origin https://github.com/~/test.git

->git저장소 주소를 등록시킴(ubuntu의 git에게 github 저장소주소를 알려줌)


# git push -u origin master

->저장소에 변경 내용 발행



저장소 내용을 받아 update하고 싶다면 # git pull


참고 : http://www.youtube.com/watch?v=UnrOmqL5v00 (webstrom에서 git사용하기)



4) 내컴 phpstrom 과 원격 ubuntu가 git으로 잘 주고 받는지 확인 한뒤,


디플로이(deploy)를 해보자


(개발환경의 작업물을 실서버에 적용하는 행위를 디플로이(deploy)라고 부른다.)


참고 : http://opentutorials.org/course/488/2616


디플로이를 할 때, 즉 www 폴더(예를 들어 http://host/test.php url이 맵핑되는 폴더)

에 소스를 떨구는 방법으로


(1) 앞서 우분투에서 git init을 했던 폴더를 www폴더와 rsync로 동기화해도 되고



(2) www 폴더에서 바로 git clone을 해서 저장소 소스를 받아와도된다.

(이 경우는 사실 앞서 우분투의 git init을 한 폴더가 필요가 없겠지만 (1)과 같이 디렉토리

를 분리하고 동기화 해야하는 경우도 있을 수 있음)


-------------


mysql


설치

sudo apt-get install mysql-server mysql-client

sudo /etc/init.d/mysql start


삭제

sudo /etc/init.d/mysql stop

sudo apt-get remove --purge mysql-server mysql-client

sudo netstat -tap | grep mysql


 sudo apt-get remove --purge mysql-server*

sudo apt-get remove --purge mysql-client*


완전삭제

# apt-get autoremove mysql-server mysql-common

dpkg -P --force depends mysql-server mysql-server-5.5 mysql-common mysql-server-core-5.5 mysql-client-5.5 mysql-client-core-5.5

# apt-get autoremove

# apt-get clean

# dpkg -l | grep -i mysql 

# rm -rvf /var/lib/mysql


mysql 패스워드 분실시 접속하기





-----

php 


url 매핑

http://opentutorials.org/module/384/4332

http://www.myservlab.com/215


php의 올바른 개발방법

http://wafe.github.io/php-the-right-way/

-------


nginx


Ubuntu Server NGINX 재시작시 bind() 관련 문제 발생시 해결 방법

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()

해당 문제는 시스템 데몬의 불완전 동작으로 인하여 발생하는 로깅문 입니다.
위와 같은 로그를 뿜을경우 아래의 명령어를 실행해 줍니다.

sudo fuser -k 80/tcp
sudo fuser -k 443/tcp



-----









반응형