注:在homebrew安装的软件安装包存在/Users/liuende/Library/Caches/Homebrew/
ruby -e "$(curl -fsSLhttps://raw.github.com/mxcl/homebrew/go)"
注:如果web服务器是apache则加上–with–apache会在编译的时候输出libphp7.so,然后在httpd.conf中加载,路径为/usr/local/opt/php70/libexec/apache2/libphp7.so
brew install php70 --with--apache
brew list
brew uninstall httpd*
brew info php70
注:mac自带apache,配置文件目录为/etc/apache2/httpd.conf,服务器目录/Library/Webserver/Documents
sudo apachectl start/stop/restart
curl -I 127.0.0.1:80//查看服务是否打开
vim /etc/apache2/httpd.conf
加入下述代码:
LoadModule php7_module /usr/local/opt/php70/libexec/apache2/libphp7.so
SetHandler application/x-httpd-php
vim /Library/WebServer/Documents/index.php
粘贴如下代码
<html><body><h1>
phpinfo();
?>
h1>body>html>
浏览器访问127.0.0.1/index.php显示phpinfo信息则配置正确
httpd: Could not reliably determine the server’s fully qualified domain name, using liuendedeMacBook-Pro.local. Set the ‘ServerName’ directive globally to suppress this message
解决方法:
将httpd.conf中ServerName的注释去掉,改为127.0.0.1:80
下载地址
You don’t have permission to access /phpMyadmin/ on this server.
解决方法:在httpd.conf中增加DirectoryIndex index.php
brew install mysql
mysql_secure_installation
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /private/var/db/receipts/*mysql*
#edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
brew uninstall mysql
brew cleanup
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist //如果存在文件的话
rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist //如果存在的话
sudo rm -rf /usr/local/var/mysql//删除数据库文件
注:利用brew安装yaf未成功,后来手动安装
注:yafPATH为解压包路径,PHP_BIN为php的bin路径,mac的brew安装其路径为/usr/local/Cellar/php70/7.0.12_5/bin/
cd $yafPATH
$PHP_BIN/phpize
./configure --with-php-config=$PHP_BIN/php-config
make
make install
extension=/usr/local/Cellar/php70/7.0.12_5/lib/php/extensions/debug-non-zts-20151012/yaf.so
出现错误如下:
Module ‘yaf’ already loaded in Unknown on line 0
查看其它的扩展:
php -m
发现在php.ini中都没有声明,所以考虑其加载方式不限于php.ini.
后来发现路径/usr/local/etc/php/7.0/conf.d下存在文件ext-yaf.ini,修改文件路径/usr/local/Cellar/php70/7.0.12_5/lib/php/extensions/debug-non-zts-20151012/yaf.so,同时在php.ini中注释到原来的添加的,就不报错了
- 测试
在浏览器中打开index.php,搜索yaf模块,如果存在,则成功;
选择php对应的版本
- 下载地址
注:debugPATH为解压包路径,PHP_BIN为php的bin路径,mac的brew安装其路径为/usr/local/Cellar/php70/7.0.12_5/bin/
cd $debugPATH
$PHP_BIN/phpize
./configure --enable-xdebug
make
make install
其中xdebug.remote_enable = on必须的剩下的根据实际情况
zend_extension=/usr/local/Cellar/php70/7.0.12_5/lib/php/extensions/debug-non-zts-20151012/xdebug.so
;是否开启自动跟踪
;xdebug.auto_trace= On
;是否开启异常跟踪
xdebug.show_exception_trace= On
;是否开启远程调试
xdebug.remote_enable = on
;调试插件dbgp
xdebug.remote_handler=dbgp
;是否收集变量
xdebug.collect_vars= On
;是否收集返回值
xdebug.collect_return= On
;是否收集参数
xdebug.collect_params= On
;是否开启调试内容
;xdebug.profiler_enable=On
;调试输出路径
xdebug.profiler_output_dir ="~/Document/myphp/xdebug/profiler"
;跟踪输出路径
xdebug.trace_output_dir="~/Document/myphp/xdebug/trace"
;显示局部变量
;xdebug.show_local_vars=On
信息网址
利用类生成器生成IDE自动完成提示的用Yaf的所有类的签名的PHP文件的脚本,然后在phpStorm中导入