标题几乎总结了它.我通过'httpd' 运行Apache 运行Fedora 18 64位.我的Apache运行得很好,但我的PHP似乎不起作用.我很确定我确实在我的机器上安装了它(Linux新手).
我在我的/var/www/html/目录中创建了一个包含代码的'test.php'文件:<?php phpinfo(); ?>但它没有显示应该的方式,它只是将文本打印到我的浏览器中.
所以我认为PHP没有在我的Apache配置中设置.有人可以对此有所了解并就如何使其发挥作用提出一些建议吗?
提前致谢!
编辑,这是我的httpd.config文件:
ServerRoot "/etc/httpd"
Listen 80
Include conf.modules.d/*.conf
User apache
Group apache
ServerAdmin root@localhost
<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
Run Code Online (Sandbox Code Playgroud)
你可能有一些问题他们之一是你没有为Apache定义".php"索引
像这样
<IfModule mime_module>
AddType text/html .php .phps
</IfModule>
Run Code Online (Sandbox Code Playgroud)
看本教程安装Apache和php