Mac安装多版本PHP和扩展
22-12-21 22:01
字数 2969
阅读 3300
已编辑
Nginx 和 Mysql 安装比较简单 直接brew install 即可。
Nginx
brew install nginx
MySQL
brew install mysql
PHP
安装低版本PHP,比如5.6 需要 tap一下
brew tap shivammathur/php
然后安装想要的版本即可
PHP5.6
brew install shivammathur/php/php@5.6
PHP7.4
brew install shivammathur/php/php@7.4
PHP8.1
brew install shivammathur/php/php@8.1
PHP扩展
主要记录一下低版本的PHP(7.2以前)的安装过程,新的可以直接使用pecl安装,方便快捷。
xdebug
curl -O https://pecl.php.net/get/xdebug-2.5.0.tgz
tar -xzf xdebug-2.5.0.tgz
cd xdebug-2.5.0
/opt/homebrew/opt/php@5.6/bin/phpize
./configure --with-php-config=/opt/homebrew/opt/php@5.6/bin/php-config --enable-xdebug
make && make install
vim /opt/homebrew/etc/php/8.1/php.ini
zend_extension=/opt/homebrew/Cellar/php@8.1/8.1.13/pecl/20210902/xdebug.so
reids
同上
...
memcache
curl -O https://pecl.php.net/get/memcache-2.2.7.tgz
tar -xvf memcache-2.2.7.tgz
cd memcache-2.2.7
arch -arm64 /opt/homebrew/opt/php@5.6/bin/phpize
arch -arm64 ./configure --with-php-config=/opt/homebrew/opt/php@5.6/bin/php-config --with-zlib-dir=/opt/homebrew/Cellar/zlib/1.2.13
make && make install
mcrypt
brew install libmcrypt
/opt/homebrew/opt/php@5.6/bin/phpize
./configure --with-php-config=/opt/homebrew/opt/php@5.6/bin/php-config --with-mcrypt=/opt/homebrew/opt/libmcrypt
make && make install
imap
/opt/homebrew/opt/php@5.6/bin/phpize
./configure --with-php-config=/opt/homebrew/opt/php@5.6/bin/php-config --with-imap=/opt/homebrew/opt/imap-uw --with-kerberos --with-imap-ssl=/opt/homebrew/opt/openssl
make && make install
配置版本PHP
PHP修改fpm的监听端口
vim /opt/homebrew/etc/php/5.6/php-fpm.conf
# 找到
listen = 127.0.0.1:9000
# 修改成
listen = 127.0.0.1:9056
vim /opt/homebrew/etc/php/7.4/php-fpm.d/www.conf
# 找到
listen = 127.0.0.1:9000
# 修改成
listen = 127.0.0.1:9074
vim /opt/homebrew/etc/php/8.1/php-fpm.d/www.conf
# 找到
listen = 127.0.0.1:9000
# 修改成
listen = 127.0.0.1:9081
重启PHP-FPM
brew services restart php@5.6
brew services restart php@7.4
brew services restart php@8.1
配置NGINX vhost
server{
listen 80;
server_name test-lc.com;
index index.html index.htm index.php;
root /opt/homebrew/var/www/test;
location / {
try_files $uri $uri/ /index.php?r=$query_string;
}
location ~ \.php$
{
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.1:9074;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SERVER_NAME $host;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css|ttf|otf|woff)$ {
expires 24h;
access_log off;
}
location ~* \.(eot|ttf|woff|svg|otf)$ {
add_header Access-Control-Allow-Origin *;
}
location ~ /\. {
deny all;
}
access_log off;
}
主要是修改 fastcgi_pass 127.0.1:9074;
,通过监听不同的端口,实现多版本共存。
5.6的项目
fastcgi_pass 127.0.1:9056;
7.4的项目
fastcgi_pass 127.0.1:9074;
8.1的项目
fastcgi_pass 127.0.1:9081;
然后重启NGINX即可
brew services restart nginx
0人点赞>
0 条评论
排序方式
时间
投票
快来抢占一楼吧
请登录后发表评论
相关推荐
文章归档
2024-11
1 篇
2024-06
1 篇
2024-05
2 篇
2024-04
2 篇
2024-03
2 篇
展开剩余 68 条
2024-01
1 篇
2023-10
1 篇
2023-09
1 篇
2023-08
1 篇
2023-06
1 篇
2023-04
1 篇
2022-12
2 篇
2022-06
1 篇
2022-04
4 篇
2022-03
3 篇
2022-01
6 篇
2021-12
2 篇
2021-11
2 篇
2021-10
2 篇
2021-09
1 篇
2021-08
2 篇
2021-07
4 篇
2021-06
1 篇
2021-05
3 篇
2021-04
3 篇
2021-01
2 篇
2020-11
1 篇
2020-10
3 篇
2020-09
2 篇
2020-08
1 篇
2020-07
5 篇
2020-06
5 篇
2020-05
1 篇
2020-04
1 篇
2020-03
2 篇
2020-02
3 篇
2020-01
1 篇
2019-11
5 篇
2019-10
10 篇
2019-09
12 篇
2019-08
17 篇
2019-07
8 篇
2019-05
3 篇
2019-04
8 篇
2019-03
7 篇
2019-02
8 篇
2019-01
5 篇
2018-12
7 篇
2018-11
8 篇
2018-10
4 篇
2018-09
7 篇
2018-08
12 篇
2018-07
9 篇
2018-06
6 篇
2018-05
11 篇
2018-04
18 篇
2018-03
1 篇
2018-02
2 篇
2018-01
10 篇
2017-12
14 篇
2017-11
44 篇
2017-10
13 篇
2017-09
4 篇
2017-08
12 篇
2017-07
5 篇
2017-06
4 篇
2017-05
2 篇
2017-04
3 篇
2017-03
9 篇
2017-02
3 篇
2017-01
2 篇
2016-12
10 篇
2016-11
4 篇
最新文章
最受欢迎
11-07 19:00
06-26 11:51
05-17 17:08
05-17 10:59
04-11 17:05
13 评论
11 评论
10 评论