Php

無效的命令 ‘php_flag’,可能拼寫錯誤或由未包含在伺服器配置中的模組定義

  • April 14, 2020

我正在嘗試設置 PhpPgAdmin。但是服務不會啟動。

我得到以下輸出時sudo systemctl status httpd.service

● httpd.service - Apache Web Server
    Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
    Active: failed (Result: exit-code) since Tue 2020-04-14 12:05:14 CDT; 1s ago
   Process: 31293 ExecStart=/usr/bin/httpd -k start -DFOREGROUND (code=exited, status=1/FAILURE)
  Main PID: 31293 (code=exited, status=1/FAILURE)

Apr 14 12:05:14 ardc-pc systemd[1]: Started Apache Web Server.
Apr 14 12:05:14 ardc-pc httpd[31293]: AH00526: Syntax error on line 10 of /etc/httpd/conf/extra/phppgadmin.conf:
Apr 14 12:05:14 ardc-pc httpd[31293]: Invalid command 'php_flag', perhaps misspelled or defined by a module not included in the server configuration
Apr 14 12:05:14 ardc-pc systemd[1]: httpd.service: Main process exited, code=exited, status=1/FAILURE
Apr 14 12:05:14 ardc-pc systemd[1]: httpd.service: Failed with result 'exit-code'.

這是我的 phppgadming.conf 文件:

Alias /phppgadmin "/usr/share/webapps/phppgadmin"
<Directory "/usr/share/webapps/phppgadmin">
    DirectoryIndex index.php
    AllowOverride All
    Options FollowSymlinks
    Require all granted

    # phppgadmin raises deprecated warnings that lead
    # to parsing errors in JS
    php_flag display_startup_errors off
    php_flag display_errors off
    php_flag html_errors off
</Directory>

就像PhpPgAdmin的 wiki 頁面所說的那樣。

我正在執行 Arch Linux。我安裝了phpapache HTTP Server並且一切正常,我在localhost中看到了我的索引頁。但是當我將配置文件添加到PhpPgAdmin時,伺服器停止了。我究竟做錯了什麼?。

我發現出了什麼問題。

正如它在apache HTTP Server的 wiki 頁面中所說,我需要安裝 PHP 擴展。按照說明一切正常!

引用自:https://serverfault.com/questions/1012286