php - 错误加载 opcache.so : opcache. 所以 : undefined symbol: compiler_globals - Apache 2. 4/PHP 5.5/Ubuntu 12.10 VPS 失败

标签 php apache ubuntu github opcache

我对此有点不熟悉,但我的目标是让 Apache 2.4 和 PHP 5.5 在运行 Ubuntu 12.10 的非托管 VPS 上启动并运行。我成功地让他们同时操作和提供 html 和 PHP 内容,但是我的设置在几个方面遇到了问题。首先是 opcache.so,这是我想使用 PHP 5.5 的主要原因。我在 conf 文件中有模块 opcache.so,但我从 Apache 收到此错误:

Apache 错误日志:
Tue Mar 04 15:19:00.624085 2014] [mpm_event:notice] [pid 1853:tid 140683657721600] AH00489: Apache/2.4.8-dev (Unix) PHP/5.5.11-dev 已配置——恢复正常操作
加载/usr/lib/php5/20100525/opcache.so 失败:/usr/lib/php5/20100525/opcache.so: undefined symbol :compiler_globals

研究我还没有找到任何人解决了这个问题。我发现以前的一些帖子建议 PHP 可能需要以不同的方式编译。不知道是不是和我的具体配置有关,但这是我第一次从github源码编译。我的 php 信息显示“PHP 版本 5.5.11-dev”...这是我可以编译的最新版本吗?

我在下面使用的配置是否正确?

任何解决此错误的建议将不胜感激。

cd /usr/local/src/
git clone --branch PHP-5.5 https://github.com/php/php-src.git php55
cd /usr/local/src/php55
rm -rf configure
./buildconf --force

./configure \
--enable-opcache \
--enable-bcmath \
--enable-calendar \
--enable-dba \
--enable-exif \
--enable-ftp \
--enable-mbstring \
--enable-shmop \
--enable-sigchild \
--enable-soap \
--enable-sockets \
--enable-sysvmsg \
--enable-wddx \
--enable-zip \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-bz2 \
--with-config-file-path=/usr/local/apache2/conf \
--with-curl \
--with-gd \
-–with-jpeg-dir=/usr/lib \
--with-gettext \
--with-mcrypt \
--with-mysql-sock=/run/mysqld/mysqld.sock \
--with-mysqli \
--with-openssl \
--with-pdo-mysql \
--with-pdo-pgsql \
--with-xmlrpc \
--with-zlib

make && \
make test && \
make install

最佳答案

您正在使用 Apache2 MPM .所以 PHP 构建了一个 ZTS(Zend Threaded System)构建。见 Apache Prefork vs Worker MPM对此进行讨论。使用 MPM,PHP 将其编译器全局变量存储在线程数组中。但是,OPcache 正在寻找此结构的非线程版本 compiler_globals .

IMO,如果您使用的是 PHP,那么使用 MPM 是一个错误,因为 (i) PHP 运行速度慢约 25-50%,(ii) 许多扩展不起作用; (iii) OPcache 未使用 ZTS 构建进行正确测试。坚持使用 Prefork worker 配置,然后重建。

使用反向代理(例如 Squid 或 nginx 等)有更高性能的选项,但配置这些需要更多的系统管理员技能。

关于php - 错误加载 opcache.so : opcache. 所以 : undefined symbol: compiler_globals - Apache 2. 4/PHP 5.5/Ubuntu 12.10 VPS 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22201013/

相关文章:

PHP require_once 不适用于 Linux

javascript - JQuery 自动完成以一个字符串返回所有结果

apache - htaccess : add path parameter (country code) to URL & serve index. html

php - 将 url service.php?p_id=1&s_id=4 重写为 service/seo

linux - wget 中的 HTTP 请求占用了大部分时间

php - 为什么我的 php 电子邮件脚本向我的垃圾邮件发送的电子邮件不在我的收件箱中?

php - 关系数据库表的 ER 图

apache - htaccess 重写传递两个变量或一个变量是否可用?

php - 从终端运行,更改字符编码!我认为。 (乌本图)

c - 给出 5 个参数,但在终端中只得到 3 个参数