使用PHP Farm激活php扩展时出现问题 [英] Issue activating a php extension using PHP Farm

查看:115
本文介绍了使用PHP Farm激活php扩展时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在实施需要PHP 5.4和ZendGuard 6(

I am implementing a software (Getsy) that requires PHP 5.4 and ZendGuard 6 (ZendGuard).

在这种情况下,我使用的是Ubuntu 14.04的AWS实例.由于Ubuntu 14.04默认附带PHP 5.5+,因此我需要安装PHP 5.4.为此,我安装了PHP Farm.

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.

要在站点之间更改PHP版本,请使用以下cgi-bin脚本:

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

对于我的特定站点(站点更改为****),我在/etc/apache2/sites-enabled/****.conf中具有此配置:

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>

因此,当我运行站点的phpinfo()时,一切都很好,并且该站点正在使用PHP 5.4.30运行.

So, when I run my site's phpinfo() everything is fine and the site is running with PHP 5.4.30.

现在,我需要启用ZendGuard Loader扩展.我从此处,使用以下命令:

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

因此,之后,为了安装PHP 5.4.30,我创建了文件custom-options-5.4.sh:

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"

我还使用自定义php ini文件作为custom-php.ini:

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"

然后,为了编译PHP版本,我使用以下命令:

Afterwards, in order to compile the PHP version I use this command:

cd /opt/phpfarm/src/
./compile 5.4.30

因此,此后我立即获得所有输出,并且php正确安装,但是当我在/opt/phpfarm/inst/bin/php-5.4.30 -v中检查PHP版本时,得到以下输出:

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

由于某种原因,它没有加载ZendGuard扩展.当我检查phpinfo()时,ZendGuard根本没有出现.当我检查/opt/phpfarm/inst/php-5.4.30/lib/php.ini时,在zend_extension="/usr/lib/php5/ZendGuardLoader.so"行.

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?

推荐答案

显然,一切正常,但由于某些原因,PHP无法读取php.ini文件,并且未反映任何更改.我要做的是删除inst/php-5.4.30文件夹和src/php-5.4.30文件夹,修改了custom-options-5.4.sh文件,并添加了以下行:

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/ \

此后,我再次编译,重新启动apache2,一切正常.我希望这对其他人有用:).

Afterwards I compiled again, restarted apache2 and everything worked correctly. I hope this can be useful to someone else :).

啊,而且,现在php -v的输出看起来像这样:

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

这篇关于使用PHP Farm激活php扩展时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆