Install php5.6/7.2/php5.3 different php version via macports

# Install php 5.3
sudo port install php53 php53-curl php53-fpm php53-gd php53-iconv php53-imagick php53-mbstring php53-mcrypt php53-mysql php53-openssl php53-iconv php53-mbstring
sudo cp /opt/local/etc/php53/php.ini-development /opt/local/etc/php53/php.ini
sudo cp /opt/local/etc/php53/php-fpm.conf.default /opt/local/etc/php53/php-fpm.conf
cd /opt/local/etc/php53/
sudo vi php-fpm.conf
change listen = 127.0.0.1:9053
start: sudo port load php53-fpm
stop : sudo port unload php53-fpm

=> note, maybe need to change short_open_tag = On for old php website in php.ini

# Install php 7.0
sudo port install php70 php70-curl php70-fpm php70-gd php70-iconv php70-imagick php70-mbstring php70-mcrypt php70-mysql php70-openssl php70-iconv php70-mbstring
sudo cp /opt/local/etc/php70/php.ini-development /opt/local/etc/php70/php.ini
sudo cp /opt/local/etc/php70/php-fpm.conf.default /opt/local/etc/php70/php-fpm.conf
cd /opt/local/etc/php70/php-fpm.d
sudo cp www.conf.default www.conf
sudo vi www.conf
change listen = 127.0.0.1:9070
start: sudo port load php70-fpm
stop : sudo port unload php70-fpm

sudo port install php72

sudo port install php72-iconv

sudo port install php72-openssl
sudo port install php72-mbstring

sudo port install php56

brew install composer

 

 

nginx config for php5.3:

server {
listen *:9153;
#listen *:80;
server_name ~^(www\.)?(?P<domain>.+)$;
root /Users/xxx/www/$domain/public;
index index.html index.php;
# for silverstrip
location / {
# for laravel
#try_files $uri /index.php?$query_string;
# for cms made simple
try_files $uri /index.php?page=$uri&$query_string;
# for silverstripe
#try_files $uri /framework/main.php?url=$uri&$query_string /index.php?$query_string;
}
#include /etc/nginx/conf.d/my_domain;
location ~ ^/(403|404|405|50x).html {
#root /www/ip.com/custom_error_page;
}
location ~ .php$ {
fastcgi_pass 127.0.0.1:9053;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *