-
-
Save roberto-butti/9fd8943851921f1e6f9c to your computer and use it in GitHub Desktop.
#!/bin/bash | |
#update ports index | |
sudo port selfupdate | |
# install php version 7.0 :) | |
sudo port install php70 | |
# install php 7 as apache module | |
sudo port install php70-apache2handler | |
cd /opt/local/apache2/modules | |
sudo /opt/local/apache2/bin/apxs -a -e -n php7 mod_php70.so | |
cd | |
#switch to php 7 as default php | |
sudo port select php php70 | |
# check if everything is ok :) | |
php -v |
ports now puts its LAMP files in different folders.
sudo port uninstall php71*
sudo port install php72
sudo port install php72-apache2handler
cd /opt/local/lib/apache2/modules/
sudo /opt/local/bin/apxs -a -e -n php7 mod_php72.so
sudo port select php php72
cd /opt/local/etc/php72/
sudo cp php.ini-development php.ini
#update as required filemerge util is handy to see what has changed. needed to set up mysqli default sockets etc.
cd /opt/local/etc/apache2/
sudo nano httpd.conf
#make sure that all but the last php.so is enabled.
LoadModule php7_module lib/apache2/modules/mod_php72.so
sudo port select php php72
restart_apache.sh script
#!/bin/sh
#!/bin/bash
SYNTAX=apachectl -t 2>&1
if [ "$SYNTAX" = 'Syntax OK' ]; then
#sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
sudo port unload apache2
sudo port load apache2
echo 'Restarted Apache'
else
sudo apachectl -t
fi
Thx