1.安裝nginx
brew install nginx //安裝
brew services start nginx //啟動(dòng)
2.安裝php
brew install php@7.4 //安裝
export PATH="/opt/homebrew/opt/php@7.4/bin:$PATH" //加入環(huán)境變量
export PATH="/opt/homebrew/opt/php@7.4/sbin:$PATH"
brew services start php@7.4 //啟動(dòng)
3.Nginx和PHP-FPM結(jié)合
????????備份配置文件 cp nginx.conf nginx.back.conf
? ? ? ?修改nginx.conf 配置
server {
listen 8080;
root /Users/username/web/cloudSite/web;
server_name localhost;
location / {
index index.php index.html index.htm;
try_files $uri @rewrite;
}
error_page 500 502 503 504 /50x.html;
location @rewrite {
rewrite ^ /index.php;
}
location ~ \.php$ {
# root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
4.mysql安裝
brew install mysql@5.7 安裝
mysql.server start 啟動(dòng)
mysql_secure_installation 修改密碼
5.xdebug安裝(上面的php一定要用brew安裝) 才會(huì)有pecl可以用
pecl install xdebug //自動(dòng)安裝php對(duì)應(yīng)的版本
//安裝完成以后運(yùn)行查看是不是安裝成功
php-m
? ?
出現(xiàn)這個(gè)表示成功
然后修改php.ini(通過brew list php 找到php的安裝路徑)的配置文件(加入這個(gè))
zend_extension="xdebug.so"
xdebug.remote_handler="dbgp"
xdebug.client_host=localhost
xdebug.client_port=9003
xdebug.idekey=phpstorm
xdebug.start_with_request=yes
xdebug.mode=debug
6.配置phpStrom
文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-648483.html
文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-648483.html
到了這里,關(guān)于mac arm 通過brew搭建 php+nginx+mysql+xdebug的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!