简体   繁体   English

使用PHP Farm激活php扩展的问题

[英]Issue activating a php extension using PHP Farm

I am implementing a software ( Getsy ) that requires PHP 5.4 and ZendGuard 6 ( ZendGuard ). 我在执行软件( Getsy需要PHP 5.4和ZendGuard 6() ZendGuard )。

For the occasion I am using an AWS Instance of Ubuntu 14.04. 在这种情况下,我使用的是Ubuntu 14.04的AWS实例。 As Ubuntu 14.04 comes with PHP 5.5+ by default, I needed to install PHP 5.4. 由于Ubuntu 14.04默认配备PHP 5.5+,我需要安装PHP 5.4。 To do that I installed PHP Farm. 为此,我安装了PHP Farm。

To change PHP versions among sites I have this cgi-bin script: 要在站点之间更改PHP版本,我有这个cgi-bin脚本:

#!/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 : 对于我的特定站点(站点已更改为****),我在/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. 所以,当我运行我的网站的phpinfo()一切都很好,网站运行PHP 5.4.30。

Now, I need to enable the ZendGuard Loader extension. 现在,我需要启用ZendGuard Loader扩展。 I download the 64-bit linux version from here using the following commands: 我使用以下命令从此处下载64位Linux版本:

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 : 所以,之后,为了安装PHP 5.4.30,我创建了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 : 我还使用自定义php ini文件作为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: 之后,为了编译PHP版本,我使用以下命令:

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正确安装,但当我检查/opt/phpfarm/inst/bin/php-5.4.30 -v的PHP版本时,我得到这个输出:

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. 由于某种原因,它没有加载ZendGuard扩展。 When I check the phpinfo() the ZendGuard doesn't appear at all. 当我检查phpinfo() ,ZendGuard根本没有出现。 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. 当我检查/opt/phpfarm/inst/php-5.4.30/lib/php.inizend_extension="/usr/lib/php5/ZendGuardLoader.so"行了。

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. 显然一切都工作正常但由于某种原因PHP没有读取php.ini文件,并没有反映出任何变化。 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: 我做的是删除了inst/php-5.4.30文件夹以及src/php-5.4.30文件夹,我修改了我的custom-options-5.4.sh文件并添加了以下行:

--with-config-file-path=/opt/phpfarm/inst/php-5.4.30/lib/ \

Afterwards I compiled again, restarted apache2 and everything worked correctly. 然后我再次编译,重新启动apache2,一切正常。 I hope this can be useful to someone else :). 我希望这对其他人有用:)。

Ah, and also, now the output of php -v looks like this: 啊,而且,现在php -v的输出看起来像这样:

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

I had to configure with --enable-xdebug: 我必须配置--enable-xdebug:

./configure --with-php-config=/opt/phpfarm/inst/bin/php-config-5.4.16 --enable-xdebug ./configure --with-php-config = / opt / phpfarm / inst / bin / php-config-5.4.16 --enable-xdebug

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM