Fedora 27 httpd 500エラー

Fedora 27 httpd 500エラー

Fedoraを26から27にアップグレードしました。私が最初に気づいたのは、テスト目的で使用していたローカルApacheサーバーが500エラーを返していることでした。

これは私の仮想ホストを表示するhttpd.confの一部です。

<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>

これは私のものです。sudo systemctlステータス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.

エラーログの最後の数行は次のとおりです。

[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

明らかに問題は、次の.htaccessファイルのどこかにあります。

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

他の.htaccessファイルを使用する他のWebホストにはこの問題はありません。私は何が間違っているのか分かりません。

ベストアンサー1

それが問題だ。

たとえば、PHP-7.1を実行しているとします。

PHPがlibapache2-mod-php7.1によって処理されると、.htaccessのphp_value設定はこのモジュールによって処理されます。

PHPがFPMによって処理されると、すべてのPHPはApacheからFPMにプロキシ/転送されます。 + Apacheにはphp_valueのハンドラはもうありません。

簡単な修正は、すべてのphp_value設定を.htaccessから.htaccessファイルと同じディレクトリにある.user.iniという名前のファイルに移動することです。

.htaccess + .user.iniファイルプロセスには1つの主な違いがあります。

.htaccessファイルは要求があるたびに読み取られます。

.user.ini ファイルは一度だけ読み取られます。

つまり、.user.ini ファイルを変更するには、FPM でバウンスが必要です。

バウンスを停止+再開...だから...

service php7.1-fpm restart

おすすめ記事