homepage Welcome to WebmasterWorld Guest from 54.227.146.68
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Apache not serving PHP files after nameserver change
dpinion




msg:4280700
 3:20 pm on Mar 12, 2011 (gmt 0)

Greetings,
I am having an issue where we originally had a site up and running using the default domain that the host provided us. Yesterday I began to point our main example.com domain to the new webhost. Since it began switching when I try to visit the site in any browser I get a prompt telling me:

"You have chosen to open

which is a: application/x-httpd-php
from: http://example.com

what should firefox do with this file?"

I have tried restarting both apache and the server. .htaccess directives(these worked before the nameserver change):

RewriteEngine on
RewriteBase /
Options -Multiviews
DirectoryIndex index.htm index.html index.php

# Use PHP5 as default
AddHandler application/x-httpd-php .php
AddType application/x-httpd-php .php


to get the site to stop doing this when it was the default domain, but now they seem to have no effect.

In my httpd.conf file I have the following:

<VirtualHost example.com>

DocumentRoot "/var/www/host/example.com/httpdocs/"
<Directory "/var/www/host/example.com/httpdocs/">
Options FollowSymLinks
AllowOverride All
Order deny,allow
allow from all
</Directory>
</VirtualHost>


Any ideas? Thanks so much for any help.

 

jdMorgan




msg:4283391
 12:18 am on Mar 18, 2011 (gmt 0)

If the "default domain" was configured separately under the control of your hosting company, then the easiest thing to do might be to request a copy of the VirtualHost section their default httpd.conf file -- the one that they used to configure your "default domain." Then modify it as you wish.

It looks like the set-up for scripting support is missing from your custom config file, and very likely there are other things missing as well.

Also, consider moving your .htaccess directives to a <Directory /> container in httpd.conf once you get them debugged -- there is a sometimes-quite-large performance advantage to this, but comparatively few webmasters have this option because they don't have server config access and so are forced to use .htaccess. Directives in config files are "compiled" once at server restart, whereas directives in .htaccess are "interpreted" for each and every HTTP request to the server. A comparison with a pre-compiled "C" executable versus an interpreted PERL script would be fair... Also, if all .htaccess directives can be moved to a config file, then you can use AllowOverride None. Then no per-request directory-walks will be required, and no .htaccess files will be fetched -- a further performance improvement (and reduces disk usage as well).

Jim

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved