Apache, PHP, Centos 6

房东的猫 提交于 2019-12-13 03:53:53

问题


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

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

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 is installed, and when I run the php -v command, it says that I am using PHP 5.3

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.

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?


回答1:


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

LoadModule php5_module    modules/libphp5.so

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



回答2:


I would recommend you take advantage of yum as it can help you get things setup quickly, and allows for easy ways to update your server down the road per the yum update command. The following are some commands that may be of use to you:

yum update
yum install php*
yum install httpd*
yum update
chkconfig httpd on
/etc/init.d/httpd start
service httpd restart



回答3:


I solved the problem.

There was just one domain asking me to download a file, rest of domains were working fine.

I could not find what was the problem so I went to my Plesk Panel, I deleted that domain, and I created the same domain again. After that it was working fine.

My server is a Linux CentOS 6, and I use Parallel Plesk Panel 11.

Thanks to everybody that was trying to help me on this issue.

J. Pablo.



来源:https://stackoverflow.com/questions/18499753/apache-php-centos-6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!