I am implementing a software (Getsy) that requires PHP 5.4 and ZendGuard 6 (ZendGuard).
For the occasion I am using an AWS Instance of Ubuntu 14.04. As Ubuntu 14.04 comes with PHP 5.5+ by default, I needed to install PHP 5.4. To do that I installed PHP Farm.
To change PHP versions among sites I have this cgi-bin script:
#!/bin/sh
PHP_FCGI_CHILDREN=3
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_MAX_REQUESTS
exec /opt/phpfarm/inst/bin/php-cgi-5.4.30
For my specific site (site changed for ****), I have this configuration in /etc/apache2/sites-enabled/****.conf
:
<VirtualHost *:80>
ServerAdmin ...@...
ServerName ****
ServerAlias ****
DocumentRoot /var/www/****/public_html/
ErrorLog /var/www/****/logs/error.log
LogLevel warn
CustomLog /var/www/****/logs/access.log combined
<Directory />
Options FollowSymLinks
AllowOverride All
AddHandler php-cgi .php
Action php-cgi /cgi-bin-php/php-cgi-5.4.30
</Directory>
</VirtualHost>
So, when I run my site's phpinfo()
everything is fine and the site is running with PHP 5.4.30.
Now, I need to enable the ZendGuard Loader extension. I download the 64-bit linux version from here using the following commands:
cd ~
wget http://downloads.zend.com/guard/6.0.0/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz
tar -xvf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz
cd ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64
cd php-5.4.x
mv ZendGuardLoader.so /usr/lib/php5/ZendGuardLoader.so
So, afterwards, in order to install PHP 5.4.30 I create the file custom-options-5.4.sh
:
#!/bin/bash
#gcov='--enable-gcov'
configoptions="--disable-debug \
--enable-short-tags \
--with-pear \
--enable-bcmath \
--enable-calendar \
--enable-exif \
--enable-ftp \
--enable-mbstring \
--enable-pcntl \
--enable-soap \
--enable-sockets \
--enable-wddx \
--enable-zip \
--with-zlib \
--with-gettext \
--enable-pdo \
--with-pdo-mysql \
--enable-cgi \
--enable-json \
--with-curl \
--with-gd \
--enable-gd \
--with-openssl \
--enable-openssl \
--with-mysql \
--enable-mysql \
$gcov"
I also use a custom php ini file as custom-php.ini
:
include_path=".:/opt/phpfarm/inst/php-$version/pear/php/"
[Zend]
zend_extension="/usr/lib/php5/ZendGuardLoader.so"
Afterwards, in order to compile the PHP version I use this command:
cd /opt/phpfarm/src/
./compile 5.4.30
So, immediately afterwards I get all the output and php gets installed correctly, but when I check the PHP version in the /opt/phpfarm/inst/bin/php-5.4.30 -v
I get this output:
PHP 5.4.30 (cli) (built: Sep 3 2014 23:41:33)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
For some reason it's not loading the ZendGuard extension. When I check the phpinfo()
the ZendGuard doesn't appear at all. When I check the /opt/phpfarm/inst/php-5.4.30/lib/php.ini
the zend_extension="/usr/lib/php5/ZendGuardLoader.so"
line is there.
Any ideas why it's not loading the extension or how I could enable it?
apparently everything was working fine but for some reason PHP wasn't reading the php.ini file and none of the changes were reflected. What I did was I deleted the inst/php-5.4.30
folder and also the src/php-5.4.30
folder, I revised my custom-options-5.4.sh
file and I added the following line:
--with-config-file-path=/opt/phpfarm/inst/php-5.4.30/lib/ \
Afterwards I compiled again, restarted apache2 and everything worked correctly. I hope this can be useful to someone else :).
Ah, and also, now the output of php -v
looks like this:
PHP 5.4.30 (cli) (built: Sep 26 2014 16:13:45)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
with Zend Guard Loader v3.3, Copyright (c) 1998-2013, by Zend Technologies