Apache是下载PHP文件,而不是显示他们的 [英] Apache is downloading php files instead of displaying them
问题描述
操作系统和服务器信息:
- 的CentOS 6.4(最终)
- 的Apache 2.2.15
- PHP 5.5.1
我previously有安装了PHP 5.3.x,但决定升级。我先卸载了PHP 5.3.x,然后安装了PHP 5.5.1,但之后已完成安装apache没有解析PHP文件只是下载它们。我在这里计算器检查类似的问题,但至今没有人帮助我。
有关记录我在我的httpd.conf和php.conf以下行,应该让PHP的工作,但并不:
AddHandler的应用程序/ X的httpd - PHP .php5 .php4的.php .php3 .php2一个.phtml
将AddType应用/ X的httpd - PHP .php5 .php4的.php .php3 .php2一个.phtml
将AddType应用/ X的httpd - PHP源的.phps
AddHandler的PHP5脚本的.php
我真的AP preciate任何帮助。
谢谢你。
编辑:
我在php.conf这些行
< IfModule worker.c中&GT!;
的LoadModule php5_module模块/ libphp5.so
< / IfModule>
< IfModule worker.c中>
的LoadModule php5_module模块/ libphp5-zts.so
< / IfModule>
编辑:
通过删除
将AddType应用/ X的httpd - PHP .php5 .php4的.php .php3 .php2一个.phtml
阿帕奇不再下载该文件。现在,Apache是显示源$ C $ C,但不是所有的只是一部分。我加了
将AddType text / html的.PHP
但没有运气。
PHP的正确将AddType是应用程序/ X的httpd - PHP
将AddType应用/ X的httpd - PHP的.php
将AddType应用/ X的httpd - PHP源的.phps
另外,还要确保你的PHP模块加载
的LoadModule php5_module模块/ mod_php55.so
当你配置Apache然后尝试从其他浏览器中查看网页 - 我有天,当铬固执缓存结果,并继续下载源$ C $ C,而在其他浏览器,它只是罚款。 p>
OS and server information:
- CentOS 6.4 (Final)
- Apache 2.2.15
- PHP 5.5.1
I previously had php 5.3.x installed but decided to upgrade. I first uninstalled the php 5.3.x and then installed php 5.5.1 but after the installation completed apache did not parse the php files it just downloaded them. I have checked similar questions here in stackoverflow but none of them have helped me so far.
For the record I have the following lines in my httpd.conf and php.conf that should make php work but don't:
AddHandler application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml
AddType application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml
AddType application/x-httpd-php-source .phps
AddHandler php5-script .php
I would really appreciate any help. Thank you.
EDIT:
I have these lines in the php.conf
<IfModule !worker.c>
LoadModule php5_module modules/libphp5.so
</IfModule>
<IfModule worker.c>
LoadModule php5_module modules/libphp5-zts.so
</IfModule>
EDIT:
By removing the
AddType application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml
apache no longer downloads the file. Now apache is showing the source code, but not all of it just part. I added
AddType text/html .php
but no luck.
The correct AddType for php is application/x-httpd-php
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Also make sure your php module is loaded
LoadModule php5_module modules/mod_php55.so
When you're configuring apache then try to view the page from another browser - I've had days when chrome stubbornly caches the result and it keeps downloading the source code while in another browser it's just fine.
这篇关于Apache是下载PHP文件,而不是显示他们的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!