PHP7 offers performance improvements that anyone hosting WordPress site will want to enjoy. Moving a B.A.M.P. install from php5 to php7 is simple enough.
First install the packages for php7:
- pkg install mod_php70
- pkg install php70-mysqli
- pkg install php70-session
- pkg install php70-ctype
- pkg install php70-xml
- pkg install php70-curl
- pkg install php70-ftp
mod_php70 is the php7 module for apache. We also need the mysqli package (don’t forget the “i”) otherwise we will get database connection errors. Session handles sessions funnily enough.
Your not done yet even though your site may seem to work at this point. ctype is used by jetpack, without this your jetpack dashboard won’t work. I forgot why I need XML as I didn’t have a guide like this one to follow… Finally if you use auto updates from within WordPress you need curl and ftp so you can download and install updates.
Now you have everything you need. Time to enable php7 in the apache configuration in “/usr/local/etc/apache24/httpd.conf”
Remove php5 add php7:
- LoadModule php5_module libexec/apache24/libphp5.so << remove this
- LoadModule php7_module libexec/apache24/libphp7.so << add this
Allow php to use the mysqli extension
- Edit /usr/local/etc/php.ini
- extension=php_mysqli.dll << remove the semi-colon (;) from the start of this line
Restart apache and you should now be running on WordPress on Apache 2.4 and php7 under FreeBSD.