Ubuntu下安装php7后无法启动Apache

1 报错提示:Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe.  You need to recompile PHP

由于Apache的运行模式和非线程安全版的php不兼容,所以是需要更改Apache的工作模式。Apache是通过Ubuntu下

1 apt-get install apache2

安装的,所以在/etc/apache2/目录下有两个文件夹,一个mods-avaiable一个mods-enabled.

将mods-enabled目录下的mpm-event的conf和load链接删除。重建prefork链接

1 cd mods-enabled/
2 ln -s  ../mods-available/mpm_prefork.* .

重启apache2,ok了。

参考:

http://php.net/manual/zh/faq.installation.php#faq.installation.apache2

http://www.cnblogs.com/fnng/archive/2012/11/20/2779977.html

http://www.open-open.com/lib/view/open1464766095184.html

原文地址:https://www.cnblogs.com/yangxunwu1992/p/5576292.html