Apache & PHP config on Mac
Three ways to check the php config
- php -i | grep php.ini
- php –ini
- create php file with following line: <?php phpinfo(); and open the file in the browser
PHP opcache config
/etc/php.ini
|
|
Troubleshoot
PHP连接MySQL的时候报错SQLSTATE[HY000] [2002] No such file or directory
错误环境:Mac OS 10.10
找到mysql.sock文件的位置$sudo find / -name mysql.sock
——结果如下———-find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
/private/tmp/mysql.sock
检查/var/mysql是否存在$ll /var/mysql
如果/var/mysql不存在则创建$sudo mkdir /var/mysql
将mysql.sock文件映射到/var/mysql路径中$sudo ln -s /private/tmp/mysql.sock /var/mysql/mysql.sock