Apache,PHP,Centos 6 [英] Apache, PHP, Centos 6

查看:89
本文介绍了Apache,PHP,Centos 6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我导航到我的网站(例如www.mydomain.com)时,浏览器会打开一个弹出窗口以下载文件.

When I navigate to my website (e.g. www.mydomain.com), the browser opens a pop-up window to download a file.

在我的httpdocs文件夹中,我有: -index.html -index.php() -我没有.htaccess文件

In my httpdocs folder i have: - index.html - index.php () - I do NOT have .htaccess file

在浏览器中签入: -www.mydomain.com/index.html->效果很好 -www.mydomain.com/index.php->效果不佳(下载index.php文件) -www.mydomain.com->效果不佳(下载带有index.php内容的"descarga"文件).

Checking in the browser: - www.mydomain.com/index.html -> it works fine - www.mydomain.com/index.php -> it works WRONG (it downloads the index.php file) - www.mydomain.com -> it works WRONG (it download "descarga" file with index.php contents).

PHP已安装,当我运行php -v命令时,它表示我正在使用PHP 5.3

PHP is installed, and when I run the php -v command, it says that I am using PHP 5.3

我在同一服务器上还有其他域,可以很好地处理php文件,因此,只要PHP对我所有域都是常量,就不会出现AddHandler或LoadModule的问题.

I have other domains on the same server working fine with php files, so AddHandler or LoadModule should not be the problem as far as PHP is a constant for all my domains.

这是我的php.conf,看起来一切都正确:

This is my php.conf and looks like everythin is right:

# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
<IfModule prefork.c>
  LoadModule php5_module modules/libphp5.so
</IfModule>
<IfModule worker.c>
  LoadModule php5_module modules/libphp5-zts.so
</IfModule>

#
# Cause the PHP interpreter to handle files with a .php extension.
#
AddHandler php5-script .php
AddType text/html .php

#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php

我该如何尝试成功导航到我的域?

What should I try to navigate to my domain successfully?

推荐答案

确保已加载PHP模块.在配置中的某处,您应该看到类似以下内容的

Make sure you have the PHP module loaded. Somewhere in your config you should see something like:

LoadModule php5_module    modules/libphp5.so

然后,使您添加一个处理程序以处理扩展名为php的文件:

Then, make you you add a handler to handle files with the php extension:

AddHandler application/x-httpd-php .php .php5 .phtml
AddHandler application/x-httpd-php-source .phps

这篇关于Apache,PHP,Centos 6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆