osx系统升级macOS 10.12后

2016-12-5 Frank PHP

Apache修改

通过brew install php55安装的PHP不能用了。用更新系统后自带的php5.6

vim /private/etc/apache2/httpd.conf
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
LoadModule php5_module libexec/apache2/libphp5.so

#LoadModule php5_module    /usr/local/opt/php55/libexec/apache2/libphp5.so

Include /private/etc/apache2/extra/vhosts/*.conf

其他问题

Forbidden
You don’t have permission to access /admin/index.php on this server.

解决
注释下面Require all denied一行

<Directory />
    AllowOverride none
    #Require all denied
</Directory>

Error: /usr/local must be writable! 解决方法

sudo chown -R $(whoami) /usr/local
brew update 
brew upgrade
#更新完包之后就可以修改文件夹所属用户组了,如下
sudo chown root:wheel /usr/local

用brew 升级PHP

# 升级xcode8.2 之后
sudo xcodebuild -license accept
brew unlink php55
brew install php56
brew reinstall php56 --with-apache

With the release of macOS Sierra the Apache module is now not built by default. If you want to build it on your system
you have to install php with the —with-httpd24 option. See brew options php56 for more details.

brew reinstall php56 --with-httpd24
#apachectl -t 报错,删掉再重装如下
brew reinstall php56 --with-mysql --with-apache --with-httpd24
#重启
sudo /usr/sbin/apachectl stop
sudo /usr/sbin/apachectl start

可惜总是下载失败。。
后来用了公司的vpn下载成功
安装提示
configure: error: Cannot find libz
解决

xcode-select --install

重新安装后修改http.conf

LoadModule php5_module /usr/local/Cellar/php56/5.6.29_5/libexec/apache2/libphp5.so
## Mysql 表没权限查看了

上面经过两次修改用户组之后

mysql> use exam;
Database changed
mysql> show tables ;
ERROR 1018 (HY000): Can’t read dir of ‘./exam/‘ (errno: 13 - Permission denied)

ls -ltrFa /usr/local/mysql/data/

用户:feng 组:_mysql,修改为_mysql:_mysql

sudo chown -R _mysql:_mysql /usr/local/mysql/data

ok,show tables 查看表恢复了。

### 为phpstorm安装java6
[下载](https://support.apple.com/kb/DL1572?locale=zh_CN)


### python之mysqldb模块报错

import _mysql
Traceback (most recent call last):
File ““, line 1, in
ImportError: dlopen(/Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.12-intel.egg/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.12-intel.egg/_mysql.so
Reason: image not found
```

解决:

sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
#[参考](http://stackoverflow.com/questions/10557507/rails-mysql-on-osx-library-not-loaded-libmysqlclient-18-dylib)

参考
Error: /usr/local must be writable! 解决方法
mac通过homebrew升级php到5.6
MacOS 升级自带PHP5.6 升级到 PHP7.1

配置xdebug

通过phpinfo查看配置文件路径
vim /usr/local/etc/php/5.6/conf.d/ext-xdebug.ini
添加如下:

xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1

« 上一篇:如何为你的网站加速 | 下一篇:OAuth2 之PHP实战»

发表评论 登录

Top