1

I just upgraded my fedora from 26 to 27. The first thing I noticed was that my local Apache server that I use for test purposes returns a 500 error.

this is the part from my httpd.conf that marks my virtualhost

<VirtualHost *:80>

  # Admin email, Server Name (domain name) and any aliases
  ServerAdmin [email protected]
  ServerName  social.loc
  ServerAlias social.loc


  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.php
  DocumentRoot /var/www/html/social/public_html
  <Directory "/var/www/html/social/public_html">
        Options FollowSymLinks
        AllowOverride All

        Order allow,deny
        Allow from all
    </Directory>


  # Custom log file locations
  LogLevel warn
  ErrorLog  /var/www/html/social/logs/error.log
  CustomLog /var/www/html/social/logs/access.log combined

</VirtualHost>

this is my sudo systemctl status httpd

● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
  Drop-In: /usr/lib/systemd/system/httpd.service.d
           └─php-fpm.conf
   Active: active (running) since Wed 2017-11-15 15:46:52 EET; 16min ago
     Docs: man:httpd.service(8)
 Main PID: 25238 (httpd)
   Status: "Total requests: 189; Idle/Busy workers 100/0;Requests/sec: 0.195; Bytes served/sec: 176 B/sec"
    Tasks: 214 (limit: 4915)
   CGroup: /system.slice/httpd.service
           ├─25238 /usr/sbin/httpd -DFOREGROUND
           ├─25240 /usr/sbin/httpd -DFOREGROUND
           ├─25241 /usr/sbin/httpd -DFOREGROUND
           ├─25245 /usr/sbin/httpd -DFOREGROUND
           ├─25246 /usr/sbin/httpd -DFOREGROUND
           └─25247 /usr/sbin/httpd -DFOREGROUND

Nov 15 15:46:52 localhost-localdomain systemd[1]: Starting The Apache HTTP Server...
Nov 15 15:46:52 localhost-localdomain httpd[25238]: AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/httpd/conf/httpd.conf:318
Nov 15 15:46:52 localhost-localdomain httpd[25238]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::dc3a:73be:897d:78c
Nov 15 15:46:52 localhost-localdomain systemd[1]: Started The Apache HTTP Server.

and this is the last lines from error log:

[Wed Nov 15 15:46:01.665637 2017] [core:alert] [pid 22868:tid 140354590287616] [client 127.0.0.1:59752] /var/www/html/social/public_html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Wed Nov 15 15:46:01.679234 2017] [core:alert] [pid 22870:tid 140354615301888] [client 127.0.0.1:59754] /var/www/html/social/public_html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Wed Nov 15 15:46:01.684910 2017] [core:alert] [pid 22872:tid 140354691000064] [client 127.0.0.1:59756] /var/www/html/social/public_html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Wed Nov 15 15:46:01.693358 2017] [core:alert] [pid 22872:tid 140354657429248] [client 127.0.0.1:59758] /var/www/html/social/public_html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Wed Nov 15 15:46:01.699123 2017] [core:alert] [pid 22870:tid 140354606909184] [client 127.0.0.1:59760] /var/www/html/social/public_html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Wed Nov 15 15:46:01.704081 2017] [core:alert] [pid 22868:tid 140354581894912] [client 127.0.0.1:59762] /var/www/html/social/public_html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Wed Nov 15 15:46:01.708729 2017] [core:alert] [pid 22870:tid 140354581731072] [client 127.0.0.1:59764] /var/www/html/social/public_html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Wed Nov 15 15:46:01.714027 2017] [core:alert] [pid 22870:tid 140354481280768] [client 127.0.0.1:59766] /var/www/html/social/public_html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Wed Nov 15 15:46:01.720273 2017] [core:alert] [pid 22872:tid 140354649036544] [client 127.0.0.1:59768] /var/www/html/social/public_html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Wed Nov 15 15:46:01.725542 2017] [core:alert] [pid 22870:tid 140354598516480] [client 127.0.0.1:59770] /var/www/html/social/public_html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration

Apparently the problem is somewhere with the .htaccess file, the contents of which are these:

php_value auto_prepend_file /var/www/html/social/public_html/php/autoload.cfg.php

Other virtualhosts that have different .htaccess files have no such problems. I don't understand what is going wrong.

1 Answer 1

1

Here's the problem.

Let's say you're running PHP-7.1 as an example.

When PHP is handled by libapache2-mod-php7.1 the php_value settings in .htaccess are handled by this module.

When PHP is handled by FPM, then all PHP is proxied/forwarded from Apache to FPM + Apache has no handler for php_value anymore.

The simple fix is to move all php_value settings out of .htaccess into a file called .user.ini in the same directory as your .htaccess files.

There is one primary difference between .htaccess + .user.ini file process.

.htaccess files are read every request.

.user.ini files are only read once.

This means any change to any .user.ini file requires bouncing FPM.

Bouncing - stop + restart... so...

service php7.1-fpm restart

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .