在apache2上启用php(使用Ubuntu 16.04)

run*_*sas 0 php apache ubuntu

我在我的Ubuntu 16.04.1系统上安装了Apache2.

我也想在我的Web服务器上安装和激活PHP7.0.

我安装了php并试图激活Apache2中的模块.

重新启动服务器时,我得到:

Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.
Run Code Online (Sandbox Code Playgroud)

当我执行"systemctl status apache2.service时,我得到:

-- Unit apache2.service has begun starting up.
Jan 30 12:19:58 tom-450-a141ng apache2[29920]:  * Starting Apache httpd web server apache2
Jan 30 12:19:58 tom-450-a141ng apache2[29920]:  *
Jan 30 12:19:58 tom-450-a141ng apache2[29920]:  * The apache2 configtest failed.
Jan 30 12:19:58 tom-450-a141ng apache2[29920]: Output of config test was:
Jan 30 12:19:58 tom-450-a141ng apache2[29920]: [Mon Jan 30 12:19:58.942761 2017] [:crit] [pid 29935:tid 140264661432192] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. 
Jan 30 12:19:58 tom-450-a141ng apache2[29920]: AH00013: Pre-configuration failed
Jan 30 12:19:58 tom-450-a141ng apache2[29920]: Action 'configtest' failed.
Jan 30 12:19:58 tom-450-a141ng apache2[29920]: The Apache error log may have more information.
Jan 30 12:19:58 tom-450-a141ng systemd[1]: apache2.service: Control process exited, code=exited status=1
Jan 30 12:19:58 tom-450-a141ng systemd[1]: Failed to start LSB: Apache2 web server.
-- Subject: Unit apache2.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit apache2.service has failed.
-- 
-- The result is failed.
Jan 30 12:19:58 tom-450-a141ng systemd[1]: apache2.service: Unit entered failed state.
Jan 30 12:19:58 tom-450-a141ng systemd[1]: apache2.service: Failed with result 'exit-code'.
Jan 30 12:19:58 tom-450-a141ng sudo[29892]: pam_unix(sudo:session): session closed for user root
Run Code Online (Sandbox Code Playgroud)

所以我不能再启动Apache了.

我到处寻找解决方案.

Plz的帮助

Ari*_*rif 6

当你需要安装php7时,只需删除当前安装的一个 -

sudo apt-get purge php*

然后跑

sudo apt-get -y install php7.0 libapache2-mod-php7.0

然后您可以根据需要安装其他模块 -

apt-get -y install php7.0-mysql php7.0-curl php7.0-gd php7.0-intl php-pear php-imagick php7.0-imap php7.0-mcrypt php-memcache

systemctl重启apache2