Apache/httpd not loading after PHP upgrade to 8

gb flag

After an upgrade to PHP 8, I can only use non-threaded PHP instead of threaded (ZTS) PHP.

The server is CentOS 7, running Apache. The Server API is Apache 2.0 Handler. I used Remi's RMP Repository Configuration Wizard to upgrade PHP from 7.4 to 8.2.4. After the upgrade to PHP 8, Apache was running with threading enabled, but would only load the non-threaded PHP module and failed.

I see both two PHP executables: php and zts-php. I cannot find the threaded module on the server. It appears that thread-safe php is installed, but Apache cannot find or load it.

Prior to the upgrade, PHP ran threaded. Info.php reported Thread Safety Enabled and included the /etc/php-zts.d directory. After the upgrade, PHP would not load. The info.php page just displayed white. php -i shows that it's including /etc/php.d for additional .ini files. And apachectl -M results did not include php.

I checked /etc/httpd/conf.modules.d/20-php.conf. It contained

Load Module php_module modules/

Prior to the upgrade the Apache php.conf file had two directives:

  <IfModule prefork.c>
    LoadModule php7_module modules/

  <IfModule !prefork.c>
    LoadModule php7_module modules/

I updated the conf file to skip the IfModule parts and just use LoadModule php_module modules/ After that, I got an Apache error: Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.

I then updated the /etc/httpd/conf.modules.d/00-mpm.conf file to enable the prefork MPM module.

  • comment out: LoadModule mpm_event_module modules/
  • uncomment: LoadModule mpm_prefork_module modules/

After this, info.php loaded. The php application runs.

Did I fail to include something in my yum installation? I installed php-cli and others (php-pdo, php-mysql, php-gd, etc.) to support the application.

Can I expect a performance penalty because of the threaded/non-threaded change?

I have 4 servers to update, production and development for two different applications. I've had the same issue on both development servers. I'd like to be able to run them threaded as they have been--just because change is scary and this is out of my normal work. If not, I'd like to learn what's happening here. I have read articles about compiling PHP to make it thread safe; I don't want to try that. If there is another way or if the non-threaded setup will work.

Remi Collet avatar
jp flag
You should read
SMich avatar
gb flag
Thank you very much. So my options are to run mpm prefork or switch to php-fpm. I appreciate your help.
I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.