I’ve installed and added PHP7 to my local server, so here are a few notes on that. As before… This is not a tutorial or a HowTo …more of a conceptual overview. You might want/have to fill in the missing parts your self.
Notes
I finished the 4 blog posts on my server installation the other day (first part here). After that I have installed PHP7, and added it to my server setup. I’m still using PHP 5.6 as the main version, but as a complement, just like I have 5.4 for old(er) scripts, I’ve added PHP7 to test/try and eventually - move over to that one later. It’s still very new and not all extensions are working. I never got Suhosin to install. Though, there is a suhosin7in progress, but it looks just initiated and nothing more. So, I’ll have to wait.
When you download PHP7 and extract it. Read the --help and look through the options etc. You’ll see ther are a few differences compared to previous version(s).
cd php-7.0.1
./configure --help > ../php7_help.txt
One is --enable-opcache, which is enabled by default now.
Same thing with --enable-ipv6.
You can also skip --with-t1lib=/usr/local/lib. It’s not in there.
Two other ones gone are: --with-mysql and --with-mssql.
But, I’ll put down my code changes/additions here and you’ll have to refer to the previous posts.
Apache and Macros
I have changed and added Macros in Apache, and of course added a few lines in httpd.conf and httpd-vhosts.conf
In the Vhost file… I didn’t follow the previous setup/layout, so I made a separate vhost as the default PHP7 site, and in ~/Sites I can use it on port :81 or if I set it as the running version on any other vhost-site.
In extra/httpd-vhost.conf, after the first default site, I have this:
We keep 5.6 in PATH, and like before 5.4 and now 7.0 are accessed with aliases.
In ~/.bash_aliases it now looks like:
# PHP 5.4, 7.0 (5.6 is in PATH)
alias php54='/usr/local/php54/bin/php'
alias phpize54='/usr/local/php54/bin/phpize'
alias pear54='/usr/local/php54/bin/pear'
alias pecl54='/usr/local/php54/bin/pecl'
alias php70='/usr/local/php70/bin/php'
alias phpize70='/usr/local/php70/bin/phpize'
alias pear70='/usr/local/php70/bin/pear'
alias pecl70='/usr/local/php70/bin/pecl'
alias fpmctl70='/usr/local/php70/sbin/fpmctl'
There’s an xtra alias for fpmctl70 since it’s running as “FPM/FastCGI”.
I have added the same extensions as before, except Suhosin that isn’t ready, yet. And for some I hade to use a couple of other versions.
APCu: To get the tag and branch it, use: git checkout tags/v5.1.2 -b v5.1.2.
GeoIP: You must get the “svn” version: svn checkout http://svn.php.net/repository/pecl/geoip/trunk/ geoip.
Intl: I used phpize70 on the bundled. Forgot to test before if it would install. Previous versions have failed for me on OS X. Since this one worked, perhaps I should try to include it in the configure line next time.
Imagick: I used the 3.4.0RC4 PECL version.
LaunchDaemon
A new LaunchDaemon: /System/Library/LaunchDaemons/net.php.php7-fpm.plist, to run it (on start).
#!/bin/sh## fpmctl## Description: Custom script based on the OS X version of `apachectl`# to (un)load php-fpm when using launchtl#ARGV="$@"## |||||||||||||||||||| START CONFIGURATION SECTION ||||||||||||||||||||# -------------------- --------------------## the path to your httpd binary, including options if necessaryPHPFPM='/usr/local/php70/sbin/php-fpm'## Config file (if needed)PHPFPMCONF='/etc/php70/php-fpm.conf'## Using Links or Lynx?LYNX="links -dump"## Using `open` here (for now). It'll use the default browser# To specify - add "-a browser" (eg. open -a Firefox)BROWSER="open"## the URL to php-fpm's status page. If you do not# have one, then status and fullstatus will not work.# Add your settings to httpd-info.confSTATUSURL="http://localhost/p70/status"## -------------------- --------------------# |||||||||||||||||||| END CONFIGURATION SECTION ||||||||||||||||||||# Program and path to LaunchDaemonLAUNCHCTL="/bin/launchctl"LAUNCHD_JOB="/System/Library/LaunchDaemons/net.php.php7-fpm.plist"run_launchctl(){if[$UID !=0];thenecho This operation requires root.
exit 1
fi$LAUNCHCTL$@}ERROR=0
if["x$ARGV"="x"];thenARGV="-h"fi# Modified from apachectl in OS Xcase$ARGV in
start) run_launchctl load -w $LAUNCHD_JOBERROR=$?;;stop) run_launchctl unload -w $LAUNCHD_JOBERROR=$?;;restart|graceful) run_launchctl unload -w $LAUNCHD_JOB 2> /dev/null
run_launchctl load -w $LAUNCHD_JOBERROR=$?;;# Test FPM configuration and exitconfigtest)$PHPFPM -y $PHPFPMCONF -t
ERROR=$?;;# PHP informationinfo)$PHPFPM -i
ERROR=$?;;status-cli)$LYNX$STATUSURL;;status-web)$BROWSER$STATUSURL;;*)$PHPFPM"$@"ERROR=$?esacexit$ERROR