# PHP Development Settings on Mac

Tags: macdevenv

# 참고 URL

# 설정 파일 위치

  • /usr/local/etc/httpd/httpd.conf
  • /usr/local/etc/httpd/extra/httpd-vhosts.conf
  • /usr/local/etc/dnsmasq.conf
  • /usr/local/etc/php/7.2/php.ini
  • /usr/local/etc/php/7.2/conf.d/ext-apcu.ini
  • /usr/local/etc/php/7.2/conf.d/ext-yaml.ini
  • /usr/local/etc/php/7.2/conf.d/ext-xdebug.ini
  • /usr/local/etc/php/7.4/php.ini
  • /usr/local/etc/php/7.4/conf.d/ext-apcu.ini
  • /usr/local/etc/php/7.4/conf.d/ext-yaml.ini
  • /usr/local/etc/php/7.4/conf.d/ext-xdebug.ini
  • /usr/local/etc/php/8.0/php.ini
  • /usr/local/etc/php/8.0/conf.d/ext-apcu.ini
  • /usr/local/etc/php/8.0/conf.d/ext-yaml.ini
  • /usr/local/etc/php/8.0/conf.d/ext-xdebug.ini
  • ~/.config/letsencrypt/cli.ini

# httpd.conf

위의 tutorial 진행 시 오류 부분만 기록 connection refused 관련 오류 시 참고 : https://serverfault.com/questions/801325/authz-core-keeps-denying-access (opens new window)

...
Listen 0.0.0.0:80
User username
Group staff
ServerName localhost
DocumentRoot /Users/shockz/Sites
<Directory /Users/shockz/Sites>
    AllowOverride All
    Require all granted
</Directory>
<Location />
    require all granted
</Location>
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14

# 맥 기본 php 삭제를 위한 방법

  • /usr/bin/ 내의 php 삭제를 위해서는 별도의 작업이 필요함
  • SIP (System Integrity Protection) 를 비활성화 하고, mac.systemfile.delete
  • sudo mount -o nobrowse -t apfs /dev/disk1s1 ./ 로 별도 디렉토리에 마운트하여 삭제해야 함 mac.systemfile.delete

# XDebug 추가 설정

  • xdebug.start_with_request=yes
  • xdebug.client_port=9000
  • xdebug.client_host=localhost
  • edge 용 Xdebug helper 확장 설치 (옵션)
  • vscode php 위치 설정 필요 ("php.validate.executablePath": "/usr/local/bin/php") php.executable.path
  • vscode launch.json 설정
{
  // IntelliSense를 사용하여 가능한 특성에 대해 알아보세요.
  // 기존 특성에 대한 설명을 보려면 가리킵니다.
  // 자세한 내용을 보려면 https://go.microsoft.com/fwlink/?linkid=830387을(를) 방문하세요.
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Listen for XDebug",
      "type": "php",
      "request": "launch",
      "port": 9003
    },
    {
      "name": "Launch currently open script",
      "type": "php",
      "request": "launch",
      "program": "${file}",
      "cwd": "${fileDirname}",
      "port": 9003
    }
  ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

# composer 설치

$ brew install composer
$ brew uninsall composer
1
2

# wordpress 개발을 위한 coding standard 설치