Server downloading indexes file

omenix

Active Member
Aug 24, 2005
38
0
156
/dev/null
My server is keep downloading index files instead of displaying it. Any help ?

I already add this line in httpd.conf

AddType application/x-httpd-php .php
AddType application/x-httpd-php .php4
AddType application/x-httpd-php .php3
AddType application/x-httpd-php-source .phps

and the DirectoryIndex index.php

But still the server seems to be downloading instead of displaying it.. any other method?
something like editing the php.ini ?
 

jayh38

Well-Known Member
Mar 3, 2006
1,213
0
166
If you are downloading .php files instead of being parsed and rendered then your php engine is not running and parsing the pages so it delivers the file instead. You may want to check that your php directives are not commented out in httpd.conf as well as looking over your php.ini file for errors.

what does this command render?
httpd configtest
php -v

As for your www and http addresses, that is most likely a .htaccess configuration problem. Check your root directory and look at the .htaccess file
 

omenix

Active Member
Aug 24, 2005
38
0
156
/dev/null
jayh38 said:
If you are downloading .php files instead of being parsed and rendered then your php engine is not running and parsing the pages so it delivers the file instead. You may want to check that your php directives are not commented out in httpd.conf as well as looking over your php.ini file for errors.

what does this command render?
httpd configtest
php -v

As for your www and http addresses, that is most likely a .htaccess configuration problem. Check your root directory and look at the .htaccess file
# php -v
PHP 4.4.2 (cli) (built: Oct 10 2006 13:30:19)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
/etc/init.d/httpd configtest
Syntax OK

I will check the .htaccess and also is there anything I should edit on php.ini? since I already replace the php.ini-recommended to /usr/local/lib/php.ini


Heres the .htaccess for the current site

Heres the .htaccess for the current site

#good'ol rewrite
RewriteEngine on
RewriteBase /

# bot-protect
# RewriteCond %{HTTP_USER_AGENT} ^$ [NC]
# RewriteRule !robots\.txt|favicon\.ico - [F,L]

# rates to pricing migration 2006-04-13
RewriteRule ^rates/(.*)$ http://www.domain.com/pricing/$1 [R=301,L]

# clients area ssl only
RewriteCond %{SERVER_PORT} !443
RewriteCond %{REQUEST_URI} ^/clients/([^/]+)$ [NC]
RewriteRule ^(.*)$ https://www.domain.com/$1/ [R,L]

RewriteCond %{SERVER_PORT} !443
RewriteCond %{REQUEST_URI} ^/clients/.*$ [NC,OR]
RewriteCond %{REQUEST_URI} ^/contact(/|/.*)$ [NC]
RewriteRule ^(.*)$ https://www.domain.com/$1 [R,L]

RewriteCond %{SERVER_PORT} 443
RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
RewriteCond %{HTTP_HOST} !^(www\.l|l)www.domain.com$ [NC]
RewriteCond %{REQUEST_URI} !^/clients/.*$ [NC]
RewriteCond %{REQUEST_URI} !^/contac(t/|t).*$ [NC]
RewriteCond %{REQUEST_URI} !^/reader.php [NC]
RewriteRule ^(.*(\.(html|htm|cgi)|/))$ http://www.domain.com/$1 [R,L]

RewriteCond %{SERVER_PORT} 443
RewriteCond %{REQUEST_URI} ^/clients//$ [NC]
RewriteRule ^.*$ http://www.domain.com/ [R,L]

RewriteCond %{SERVER_PORT} 443
RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^(www\.l|l)www.domain.com$ [NC]
# RewriteCond %{REQUEST_URI} !^/www.domain.com/.*$
RewriteRule ^(.*(\.(html|htm|cgi|php)|/))$ www.domain.com/$1 [R,L]


# disable subdirs in client-upload dir
RewriteCond %{REQUEST_URI} /clients/.*$ [NC]
RewriteCond %{REQUEST_URI} /clients/.*/dir/.*$ [NC]
RewriteCond %{REQUEST_URI} /dir/.*/.*$ [NC]
RewriteRule ^.*$ - [F,L]

# disable .htaccess in client-upload dir
RewriteCond %{REQUEST_URI} /clients/.*$ [NC]
RewriteCond %{REQUEST_URI} /clients/(.*)/dir(.*)$ [NC]
RewriteCond /home/user/public_html/clients/%1/dir/.htaccess -f
RewriteRule ^.*$ - [F,L]

# disbale /www.domain.com blog
RewriteRule ^www.domain.com(.*)$ /reader.php?file=error404.html [L,NC]

# reader mapping
RewriteRule ^(.*\.(html|htm|cgi))$ /reader.php?file=$1 [L,QSA,NC]

RewriteCond %{REQUEST_URI} !/admin2/.* [NC]
RewriteRule ^(.*/)$ /reader.php?file=$1 [L,QSA,NC]

RewriteCond %{REQUEST_URI} !/clients/.*/ [NC]
RewriteCond %{REQUEST_URI} !/testtlk.php$ [NC]
RewriteCond %{REQUEST_URI} !/reader.php [OR,NC]
RewriteCond %{REQUEST_URI} /clients/.*/$ [NC]
RewriteCond %{REQUEST_URI} !/admin2/.* [NC]
RewriteRule ^(.*\.(php))$ /reader.php?file=$1 [L,QSA,NC]

<Files 403.shtml>
order allow,deny
allow from all
</Files>
 

anushkumar

Well-Known Member
May 14, 2005
57
1
158
cPanel Access Level
Root Administrator
What does your register globals say? did you do any updates lately?

nothing wrong with your htaccess. This seems like an issue with your php. Since it works with IE and not with the other browsers, probably a reboot might fix.