注意:mac自带apache环境和PHP环境
一 php服务的启动和关闭
php-fpm 启动
sudo php-fpm
php-fpm 关闭
1 查看php-fpm端口是否在被php-fpm进程
netstat -an | grep 9000
查看进程pid
sudo lsof -i:9000
杀死进程
sudo kill -9 [pid] 或者 sudo killall php-fpm
2 查看进程 拿到主进程号
ps aux | grep php-fpm
杀死进程
sudo kill -USR2 主进程号
注意:S+代表有子进程,Ss表示的即为主进程,即master或者root对应的就是主进程号
php-fpm 重启
先关闭php-fpm,然后在启动
二 apache服务的启动和关闭
apache 启动
sudo apachectl -k start
apache 关闭
sudo apachectl -k stop
apache 重新启动
sudo apachectl -k restart
三 mysql服务的启动和关闭(通过homebrew安装)
mysql 启动
brew services start mysql
mysql 关闭
brew services stop mysql
mysql 重启
brew services restart mysql
四 启动时报错:
1 apache启动时报错,不影响使用
错误提示:
httpd: apr_sockaddr_info_get() failed for duaijingdeMacBook-Air.local
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
没有在 /etc/httpd/conf/httpd.conf 中设定 ServerName 所以它会用主机上的名称来取代,首先会去找 /etc/hosts 中有没有主机的定义
问题解决:
设定 ServerName 或者在 /etc/hosts 中填入自己的主机名称 MYHOST,并把httpd.conf中的注释放开
修改 hosts 文件
vi /etc/hosts
127.0.0.1 localhost.localdomain localhost (主机名)
修改 httpd.conf 文件,注释放开
vi /etc/apache2/httpd.conf
ServerName localhost:80
以上就是这次的全部内容!