简体   繁体   English

尝试重启时Apache2“configtest failed”

[英]Apache2 “configtest failed” when trying to restart

i tried to protect a directory in my www-folder by using a .htaccess file which had no effect so i changed line 我试图通过使用.htaccess文件来保护我的www文件夹中的目录,该文件没有任何影响所以我改变了行

    AllowOverride None

in my apache2.conf to 在我的apache2.conf中

    AllowOverride All

as root. 作为根。

now i see that this wasn't the right way to do it. 现在我看到这不是正确的方法。 when trying to restart apache using 当尝试使用重启apache时

    /etc/init.d/apache2 restart (or stop and start)

I'm getting the following error message: 我收到以下错误消息:

    [FAIL] Starting web server: apache2 failed!
    [warn] The apache2 configtest failed. ... (warning).
    Output of config test was:
    apache2: Syntax error on line 140 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: cannot open shared         object file: No such file or directory
    Action 'configtest' failed.
    The Apache error log may have more information.

I changed the line to AllowOverride None again but the problem remains. 我再次将行更改为AllowOverride None,但问题仍然存在。 The apache2 error.log does not contain any information. apache2 error.log不包含任何信息。 And Line 140 in the config file is 并且配置文件中的第140行是

    IncludeOptional mods-enabled/*.load

as the error message indicates there is no libphp5.so in /usr/lib/apache2/modules just libphp5filter.so 因为错误消息表明/ usr / lib / apache2 / modules中没有libphp5.so只是libphp5filter.so

apt-get install libapache2-mod-php5

just did the job. 刚做完这份工作。 Now I'm not sure if the changes apache2.conf actually caused the problem... 现在我不确定apache2.conf的更改是否真的导致了问题...

I know:) that before you wanted add copy of /etc/apache2/sites-available/default. 我知道:)在您想要添加/ etc / apache2 / sites-available / default的副本之前。 So u have to delete it (ex. site1): sudo a2dissite site1 && sudo a2ensite default 所以你必须删除它(例如site1): sudo a2dissite site1 && sudo a2ensite default

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

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