简体   繁体   English

PHP版本升级“ apache2 configtest失败。”后如何解决此错误?

[英]How to resolve this error I got after PHP version upgrade “The apache2 configtest failed.”?

I'm using ubuntu Linux 12.04 LTS on my machine. 我在机器上使用ubuntu Linux 12.04 LTS。 I was using PHP 5.3.10 Now I upgraded to PHP 5.5.18 by using few commands on terminal. 我使用的是PHP 5.3.10现在通过在终端上使用一些命令来升级到PHP 5.5.18。 After I upgraded to latest PHP version I checked the version by using command php -v. 升级到最新的PHP版本后,我使用命令php -v检查了版本。 It shown me the PHP version is 5.5.18. 它向我显示PHP版本是5.5.18。 But when I tried to access one directory from the folder "www" ie document root I'm getting error "Unable to connect" in browser. 但是,当我尝试从文件夹“ www”即文档根目录访问一个目录时,在浏览器中出现错误“无法连接”。 When I enter only localhost in address bar "It Works" is the message appearing. 当我在地址栏中仅输入本地主机时,将显示消息。

So I tried to restart the apache server ny using following command : 所以我尝试使用以下命令重新启动apache服务器ny:

sudo service apache2 restart

then I got following error : 然后我得到以下错误:

 * Restarting web server apache2                                         [fail] 
 * The apache2 configtest failed.
Output of config test was:
apache2: Syntax error on line 214 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/httpd.conf: No such file or directory
Action 'configtest' failed.
The Apache error log may have more information.

After reading this message I go to the file /etc/apache2/httpd.conf and checked line no. 阅读此消息后,我转到文件/etc/apache2/httpd.conf并检查行号。 214 there I got found following statement written : 214我发现以下书面声明:

Include httpd.conf

So can someone please help me in working the thing as it is like previous for me? 那么有人可以帮我像以前一样对我进行工作吗? Please suggest me the ways I can fix this issue. 请建议我解决此问题的方法。

Thanks on advance. 提前谢谢。

just do this: 只是这样做:

a2dismod php5

OR 要么

a2dismod php7.0

it also woked for me 这也让我惊呆了

sudo a2dismod php7.0

Module php7.0 disabled.
To activate the new configuration, you need to run:
  service apache2 restart


mr@mr ~/Desktop $ sudo service apache2 restart
 * Restarting web server apache2
  1. Check if two symbolic link there for php same version [cd /etc/apache2/mods-enabled/] 检查那里是否有两个符号链接用于php相同版本[cd / etc / apache2 / mods-enabled /]

    • php7.load -> ../mods-available/php7.load php7.load-> ../mods-available/php7.load

    • php7.load -> ../mods-available/php7.0.load php7.load-> ../mods-available/php7.0.load

    • I have removed one of them according to my requirement 我已根据需要删除了其中一个

  2. Check available modes in [/etc/apache2/mods-available/] 检查[/ etc / apache2 / mods-available /]中的可用模式

    • Php7.0.load php7.0加载

    • Php7.load php7加载

    • I have removed one of them [php7.load] Enable on of the mode restart apache server 我已删除其中之一[php7.load]在模式重启apache服务器上启用

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

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