0

我正在尝试为 PHP 配置时区,在设置之后,我提供了一组要执行的命令,

cd /etc/apache2/mods-enabled/
ln -s ../mods-available/rewrite.load .
ln -s ../mods-available/headers.load .
ln -s ../mods-available/expires.load .
ln -s ../mods-available/ssl.load .
ln -s ../mods-available/ssl.conf .
ln -s ../mods-available/php5* .
ln -s ../mods-available/socache_shmcb.load .

/etc/init.d/apache2 restart

当我使用 运行最后一个命令时sudo,出现以下错误,

[....] Restarting apache2 (via systemctl): apache2.serviceJob for apache2.service failed. See 'systemctl status apache2.service' and 'journalctl -xn' for details.
 failed!

当我在终端输入时,

systemctl status apache2.service

我得到的输出,

​● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─forking.conf
   Active: failed (Result: exit-code) since Fri 2017-12-08 12:57:08 CET; 5min ago
  Process: 23298 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
  Process: 23587 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

在这种情况下我该怎么办?

Upadte

提供了命令的输出sudo cat /var/log/apache2/error.log

​[Fri Dec 08 11:58:17.392972 2017] [mpm_event:notice] [pid 12892:tid 140108409681792] AH00489: Apache/2.4.10 (Debian) configured -- resuming normal operations
[Fri Dec 08 11:58:17.393055 2017] [core:notice] [pid 12892:tid 140108409681792] AH00094: Command line: '/usr/sbin/apache2'
[Fri Dec 08 11:58:36.585248 2017] [mpm_event:notice] [pid 12892:tid 140108409681792] AH00493: SIGUSR1 received.  Doing graceful restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Fri Dec 08 11:58:36.588582 2017] [mpm_event:notice] [pid 12892:tid 140108409681792] AH00489: Apache/2.4.10 (Debian) configured -- resuming normal operations
[Fri Dec 08 11:58:36.588590 2017] [core:notice] [pid 12892:tid 140108409681792] AH00094: Command line: '/usr/sbin/apache2'
[Fri Dec 08 11:58:39.747035 2017] [mpm_event:notice] [pid 12892:tid 140108409681792] AH00491: caught SIGTERM, shutting down
[Fri Dec 08 11:58:40.816350 2017] [mpm_prefork:notice] [pid 15087] AH00163: Apache/2.4.10 (Debian) configured -- resuming normal operations
[Fri Dec 08 11:58:40.816435 2017] [core:notice] [pid 15087] AH00094: Command line: '/usr/sbin/apache2'
[Fri Dec 08 11:58:42.228275 2017] [mpm_prefork:notice] [pid 15087] AH00169: caught SIGTERM, shutting down
[Fri Dec 08 11:58:43.344556 2017] [mpm_prefork:notice] [pid 15186] AH00163: Apache/2.4.10 (Debian) configured -- resuming normal operations
[Fri Dec 08 11:58:43.344605 2017] [core:notice] [pid 15186] AH00094: Command line: '/usr/sbin/apache2'
[Fri Dec 08 12:40:45.121960 2017] [mpm_prefork:notice] [pid 15186] AH00169: caught SIGTERM, shutting down​

提供命令的输出/usr/sbin/apache2

[Fri Dec 08 13:30:36.877713 2017] [core:warn] [pid 23750] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Fri Dec 08 13:30:36.879775 2017] [core:warn] [pid 23750] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Fri Dec 08 13:30:36.879827 2017] [core:warn] [pid 23750] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Fri Dec 08 13:30:36.879865 2017] [core:warn] [pid 23750] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Fri Dec 08 13:30:36.879905 2017] [core:warn] [pid 23750] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
apache2: Syntax error on line 140 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/mods-enabled/php5.load: No such file or directory​
4

1 回答 1

2

从外观上看,您还没有正确启用 PHP 5 模块。尝试运行a2enmod php5,如果失败,您可能没有安装模块,在这种情况下尝试:apt-get install libapache2-mod-php5然后a2enmod php5再试一次。

于 2017-12-08T13:33:40.413 回答