标题几乎概括了这一点。我在跑Fedora 18 64 位通过“httpd”安装 Apache。我的 Apache 运行得很好,但我的 PHP 似乎无法工作。我相当确定我的机器上确实安装了它(Linux 新手)。
我在我的目录中创建了一个“test.php”文件/var/www/html/
包含代码的目录:<?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
您可能会遇到一些问题,其中之一是您没有为 Apache 定义“.php”索引
像这样
<IfModule mime_module>
AddType text/html .php .phps
</IfModule>
看这个教程安装 Apache 和 php http://www.if-not-true-then-false.com/2010/install-apache-php-on-fedora-centos-red-hat-rhel/
and 安装 Apache 和 php http://www.howtoforge.com/installing-apache2-with-php5-and-mysql-support-on-fedora-18-lamp
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)