I am running php 5.5 and apache 2 on debian 7 (wheezy) i have installed php module for apache but it's not enable whithout enabling php module for apache i will see php files as plain text and when i enabled php module whith a2enmod i can not start apache and it gives this error
[crit] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP. Pre-configuration failed Action 'configtest' failed.
how can i fix this problem
If you choose to run PHP as a CGI binary, then you won't need thread safety, because the binary is invoked at each request. For multithreaded webservers, such as IIS5 and IIS6, you should use the threaded version of PHP.
The difference of NTS and TS is in the name itself. TS = Thread Safe. NTS = Non Thread Safe. Though the non checking of thread safty the NTS version is a very little faster.
Thread safety is a computer programming concept applicable to multi-threaded code. Thread-safe code only manipulates shared data structures in a manner that ensures that all threads behave properly and fulfill their design specifications without unintended interaction.
Disabling mpm_event
and enabling mpm_prefork
worked for me.
sudo a2dismod mpm_event
sudo a2enmod mpm_prefork
Test the Apache configuration:
apache2ctl configtest
Install PHP and PHP-FPM:
sudo apt-get install php7.0
sudo apt-get install php7.0-fpm
Enable Apache PHP7 module:
sudo a2enmod php7.0
Disable mpm_event module:
sudo a2dismod mpm_event
Enable mpm_prefork module:
sudo a2enmod mpm_prefork
Finally restart Apache:
sudo service apache2 restart
This will resolve your error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With