AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 805480
Accepted
ifthenelse
ifthenelse
Asked: 2016-09-27 14:24:59 +0800 CST2016-09-27 14:24:59 +0800 CST 2016-09-27 14:24:59 +0800 CST

无法使用 libapache2-mod-php5 运行 Apache 2.4

  • 772

我有一个运行 Apache 2.4.10 和 Php 5.6.26 的 Vagrant Debian Wheezy 我需要安装并运行 libapache2-mod-php5 以使 Apache 能够读取 .htaccess 文件中的 php_value。TL;DR 一旦 Apache 重新启动,错误就会被触发:

$ apachectl -M
apache2: Syntax error on line 37 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/php5.load: Cannot load /usr/lib/apache2/modules/libphp5.so into server: /usr/lib/apache2/modules/libphp5.so: undefined symbol: unixd_config
Action '-M' failed.
The Apache error log may have more information.

那是PHP版本:

$ php -v
PHP 5.6.26-1~dotdeb+7.1 (cli) (built: Sep 18 2016 19:52:57) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    with Xdebug v2.5.0-dev, Copyright (c) 2002-2016, by Derick Rethans

这就是 Apache 配置:

$ apache2 -V
[Mon Sep 26 23:27:20.618601 2016] [core:warn] [pid 25105] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Mon Sep 26 23:27:20.623081 2016] [core:warn] [pid 25105:tid 139878783203136] AH00111: Config variable ${APACHE_RUN_DIR} is not defined
[Mon Sep 26 23:27:20.623438 2016] [core:warn] [pid 25105:tid 139878783203136] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
Server version: Apache/2.4.10 (Debian)
Server built:   Nov  7 2014 12:05:20
Server's Module Magic Number: 20120211:37
Server loaded:  APR 1.5.1-dev, APR-UTIL 1.5.3
Compiled using: APR 1.5.1-dev, APR-UTIL 1.5.3
Architecture:   64-bit
Server MPM:     worker
  threaded:     yes (fixed thread count)
    forked:     yes (variable process count)
Server compiled with....
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=256
 -D HTTPD_ROOT="/etc/apache2"
 -D SUEXEC_BIN="/usr/lib/apache2/suexec"
 -D DEFAULT_PIDLOG="/var/run/apache2.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="mime.types"
 -D SERVER_CONFIG_FILE="apache2.conf"

后来我读到libapache2-mod-php5 需要用 prefork MPM编译,所以再次重新编译时启用了 mpm-prefork :

$ sudo a2dismod worker                 
Module worker disabled.
To activate the new configuration, you need to run:
  service apache2 restart

$ sudo a2enmod mpm_prefork
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Module mpm_prefork already enabled

$ sudo service apache2 start  
[ ok ] Starting web server: apache2.

$ apache2 -V
[Mon Sep 26 23:05:35.463940 2016] [core:warn] [pid 22298] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Mon Sep 26 23:05:35.466868 2016] [core:warn] [pid 22298] AH00111: Config variable ${APACHE_RUN_DIR} is not defined
[Mon Sep 26 23:05:35.467139 2016] [core:warn] [pid 22298] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
Server version: Apache/2.4.10 (Debian)
Server built:   Nov  7 2014 12:05:20
Server's Module Magic Number: 20120211:37
Server loaded:  APR 1.5.1-dev, APR-UTIL 1.5.3
Compiled using: APR 1.5.1-dev, APR-UTIL 1.5.3
Architecture:   64-bit
Server MPM:     prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=256
 -D HTTPD_ROOT="/etc/apache2"
 -D SUEXEC_BIN="/usr/lib/apache2/suexec"
 -D DEFAULT_PIDLOG="/var/run/apache2.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="mime.types"
 -D SERVER_CONFIG_FILE="apache2.conf"

$ sudo apt-get remove libapache2-mod-php5
...
$ sudo apt-get autoclean
...
$ sudo apt-get install libapache2-mod-php5
...
$ sudo a2enmod php5
Enabling module php5.
To activate the new configuration, you need to run:
  service apache2 restart
$ sudo service apache2 restart
[FAIL] Restarting web server: apache2 failed!
[warn] The apache2 configtest failed. ... (warning).
Output of config test was:
apache2: Syntax error on line 37 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/php5.load: Cannot load /usr/lib/apache2/modules/libphp5.so into server: /usr/lib/apache2/modules/libphp5.so: undefined symbol: unixd_config
Action 'configtest' failed.
The Apache error log may have more information.

但仍然给出同样的错误。我不知道我在这里缺少什么。在读取 .htaccess 文件中的 php_value 时,我真的需要摆脱这些错误。

编辑 - 找到解决方案

感谢@Unbeliever 的回答,我发现我使用的是提供 php-FPM 的 puPHPet Vagrant 机器,而不是旧的 mod_php(这发生在 2015 年 3 月)。后来我发现 php-FPM(与其他 CGI/FCGI 版本的 php 一样)可以读取user.ini 文件中的php_value ,如https://secure.php.net/manual/en/configuration.file.per-用户.php。因此,最好将 php.ini 文件放在 .htaccess 中,以提供全面支持。

php5 php-fpm apache-2.4
  • 1 1 个回答
  • 1334 Views

1 个回答

  • Voted
  1. Best Answer
    Unbeliever
    2016-09-27T14:38:25+08:002016-09-27T14:38:25+08:00

    未定义符号表示您安装了一个针对早期版本的 Apache 编译的 mod_php 包。

    您应该能够通过将 libapache2-mod-php5 更新为针对 Apache v2.4 编译的版本来纠正此问题。

    抱歉,我不是 Linux 存储库专家,但您可能需要从与 Apache httpd 相同的存储库中获取 libapache2-mod-php5。

    • 2

相关问题

  • Apache 在配置 eAccelerator 和 FastCGI 后从不运行

  • Debian 上 php5 和 php5-cli 软件包的区别

  • apache在php中与exec崩溃

  • 为什么PHP脚本的工作许可在服务器之间有所不同?

  • 从 PHP 5.1.6 升级到 5.2.9 的问题

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve