Der Titel bringt es auf den Punkt. Ich führe Fedora 18 64-Bit mit Apache über 'httpd' aus. Mein Apache läuft gut, aber mein PHP scheint nicht zu funktionieren. Ich bin mir ziemlich sicher, dass ich es auf meinem Rechner installiert habe (neu bei Linux).
Ich habe eine "test.php" -Datei in meinem /var/www/html/
-Verzeichnis erstellt, die den Code enthält: <?php phpinfo(); ?>
Aber es wird nicht so angezeigt, wie es sollte, es wird nur der Text in meinem Browser ausgegeben.
Ich bin also der Meinung, dass PHP nicht in meiner Apache-Konfiguration oder so eingerichtet ist. Kann jemand etwas Licht ins Dunkel bringen und ein paar Vorschläge dazu haben, wie man dies erreichen kann?
Danke im Voraus!
Bearbeiten, das ist meine httpd.config-Datei:
ServerRoot "/etc/httpd"
Listen 80
Include conf.modules.d/*.conf
User Apache
Group Apache
ServerAdmin [email protected]
<Directory />
AllowOverride none
Require all denied
</Directory>
DocumentRoot "/var/www/html"
<Directory "/var/www">
AllowOverride None
Require all granted
</Directory>
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
<Files ".ht*">
Require all denied
</Files>
ErrorLog "logs/error_log"
LogLevel warn
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
</IfModule>
<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
<IfModule mime_module>
TypesConfig /etc/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>
AddDefaultCharset UTF-8
MIMEMagicFile conf/magic
EnableSendfile on
IncludeOptional conf.d/*.conf
yum install php
PHP muss selbst installiert werden. Es ist kein Apache-Modul, das einfach aktiviert werden muss, ohne vorher PHP installieren zu müssen.
Möglicherweise haben Sie ein Problem. Eines davon ist, dass Sie den Index ".php" für Apache nicht definiert haben
so was
<IfModule mime_module>
AddType text/html .php .phps
</IfModule>
siehe dieses Tutorial installiere Apache und PHP
Ich habe dieses Problem gelöst, indem ich sowohl httpd als auch php neu installierte. Dann wurde die PHP-Datei ausgeführt.
Anscheinend wird PHP als Paket installiert, aber durch ein Modul für Apache interpretiert: viz; mod_php. Das ist eine kleine Vermutung, ich habe sie gerade entdeckt, um HTML einzubetten.