Backend/php(xe)

[PHP] macOS - php 환경설정 하기

rachel_13 2022. 7. 22. 16:55

1) PHP 내장 서버 실행

web 서버를 별도로 설치하지 않아도, php 내장 서버를 실행할 수 있다.

별도로 세팅할 경우, 아파치나 nginx 사용할 수 있겠다.

php -S localhost:8080

error 발생 ! -> 에러일지 보러가기

 

2) xdebug 설치 in Mac

   (1) php 설치 경로 확인

brew list php

* 혹시, 제대로 설치가 안되었을 경우, uninstall 후 brew install php@버전 을 통해 재설치하자.

 

  (2) xdebug 설치

pecl install xdebug

홈브루로 설치하면 pecl이 자동으로 설치되어 있다고 한다.

  (3) php.ini 에서 설정 바꾸기

- 경로 확인

php --ini

- xdebug 옵션 설정 추가

[xdebug]
zend_extension="xdebug.so"
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.output_dir=“/Users/(사용자명)/Documents/phpstorm_temp”
xdebug.idekey=PHPSTORM

- php 버전확인을 통해 xdebug가 정상적으로 설치되었는지 확인함

 

3) phpstorm에서 설정하기

[settings] - [PHP]에서

설치한 버전을 선택하고, CLI 옆에 ... 으로 생긴 버튼을 클릭해서 CLI를 새로 등록한다.

좌측 상단의  + 버튼 을 누르고 [Local Path to Interpreter..]

정상적으로 설치되었을 시에 아래, Debugger에 xdebug가 나온다.

 

 

https://fghnm12.tistory.com/10

'Backend > php(xe)' 카테고리의 다른 글

[PHP/XE]exec_xml( )이용해서 ajax 데이터 호출  (0) 2022.08.12
[PHP/XE] debug print 찍기  (0) 2022.08.12
[PHP] macOS php.ini 설정하기  (0) 2022.07.22
[PHP] macOS php, apache 설치 버전 확인하기  (0) 2022.07.22
.htaccess  (0) 2022.07.20