skip to Main Content

I have upgraded to Centos 8, and find myself having to cope with the changes in Apache 2.4. I’ve started to get it working, but I have a perplexing error with a simple setting in .htaccess:

#   .htaccess
#   PHP Time Zone
    php_value date.timezone Australia/Melbourne

I get the dreaded error:

The server encountered an internal error or misconfiguration and was unable to complete your request.

There’s no point contacting the server administrator because that’s me.

The error_log file has this:

Invalid command ‘php_value’, perhaps misspelled or defined by a module not included in the server configuration

This has always worked in the past on Apache 2.4, and also works when I use Apache 2.4 on XAMPP. So obviously there is something in some other configuration, possibly in httpd.conf which causes it to crash.

What setting am I missing, or should I change?

Update

As answered by @Chi.C.J.RajeevaLochana below, the solution lies in using the correct MPM. In my case, in the file 00-mpm-conf:

  • Comment out

    LoadModule mpm_event_module modules/mod_mpm_event.so

  • Uncomment

    LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

For further information, see:

2

Answers


  1. When you are using either mod_mpm_event or mod_mpm_worker instead of mod_mpm_prefork, you will not be able to use the PHP Module. This is because mod_mpm_event and mod_mpm_worker are threaded modules. And the PHP module is not thread safe.

    If you are unsure how to do this, check out Soufiane ELH’s tutorial which should be above/below this answer.

    Login or Signup to reply.
  2. the event module is enabled by default on centos 8 .. to check wich module you have :

    #sudo httpd -V | grep -i mpm
    

    if you have enent module enabled, disable it, and enable the prefork module:

    • Edit the /etc/httpd/conf.modules.d/00-mpm.conf file
    • Comment out the line for the event module
    • uncomment the line for the prefork module
    • restart apache

    check again the module enabled by apache and you will find prefork :

    # sudo httpd -V | grep -i mpm
    Server MPM:     prefork
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search