Mac入門--Apache/Php/Mysql的開啓關閉

注意:mac自帶apache環境和PHP環境php

 

一 php服務的啓動和關閉mysql

php-fpm 啓動sql

sudo php-fpm

php-fpm 關閉 apache

1 查看php-fpm端口是否在被php-fpm進程dom

netstat -an | grep 9000

查看進程pidphp-fpm

sudo lsof -i:9000

殺死進程this

sudo kill -9 [pid] 或者 sudo killall php-fpm

2 查看進程 拿到主進程號spa

ps aux | grep php-fpm

殺死進程rest

sudo kill -USR2  主進程號

注意:S+表明有子進程,Ss表示的即爲主進程,即master或者root對應的就是主進程號server

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

 

以上就是此次的所有內容!

相關文章
相關標籤/搜索