Jump to content

Php Index Not Always Being Processed


Guest AtariAge

Recommended Posts

Posted

I am having a strange problem. Yesterday I moved my site from one dedicated cPanel server to another. I'm running newer versions of Apache (2.2 instead of 1.x) and (PHP 5.x instead of 4.x). Everything seems to be working fine except for one thing that is driving me nuts. For some users, when they go to the root of the website, they the raw PHP file instead of the properly parsed file. However, visiting "http://www.atariage.com/index.html" works fine.

So, visiting this sometimes displays PHP for some of my users:

http://www.atariage.com

Visiting this does not:

http://www.atariage.com/index.html

Also, visiting the SSL version of the site without explicitly including the index works:

https://www.atariage.com

My php.conf looks as follows:

# LibPHP5 configuration

LoadModule php5_module modules/libphp5.so

AddType application/x-httpd-php .php5 .html .php4 .php .php3 .php2 .phtml


# End of autogenerated PHP configuration.

In the httpd.conf, the DirectoryIndex variable looks as follows:

DirectoryIndex  index.html index.htm index.shtml index.xhtml index.wml index.perl index.pl index.plx index.ppl index.cgi index.jsp index.js index.jp index.php4 index.php3 index.php index.phtml default.htm default.html home.htm

In my error log, I have been seeing this error (and I know this is one of the people having problems):

[Sun Nov 11 13:47:47 2007] [error] [client 69.183.160.82] File does not exist: /home/atariage/public_html/'.$BASE_DOC.'

[Sun Nov 11 13:47:47 2007] [error] [client 69.183.160.82] File does not exist: /home/atariage/public_html/'.$BASE_DOC.'

[Sun Nov 11 13:47:47 2007] [error] [client 69.183.160.82] File does not exist: /home/atariage/public_html/<



$BASE_DOC is a variable used by several of the PHP scripts generating the output for the index (and other pages throughout the site). I assume the above errors are not being generated by PHP since they are not prefixed with a PHP tag (like "PHP Warning").

Any ideas?

Thanks in advance..

..Al

Posted

Can you post the code using $BASE_DOC - it would appear that the syntax is causing that variable to not get parsed out to the path properly. Maybe something like this is happening

require '$BASE_DOC/somefile';

But because it's in single quotes it's not getting parsed to the variable's value?

Posted

Can you post the code using $BASE_DOC - it would appear that the syntax is causing that variable to not get parsed out to the path properly. Maybe something like this is happening



require '$BASE_DOC/somefile';



But because it's in single quotes it's not getting parsed to the variable's value?


Unfortunately there are several large files involved in generating the index on the main page of the site and they all use the $BASE_DOC variable. These files have been like this for years now (more or less), so I think it's some weird difference in the way PHP and/or Apache is behaving. My money would be on Apache, because the screenshot someone posted to my forum showed that the PHP wasn't being processed at all and was simply output straight to the user's browser (very nice). I nearly had a heart attack when I saw that.

My first response was to check $BASE_DOC in each of these files, but I did not see anything unusual. It seems as if for some people Apache is not processing the index.html, but ONLY in cases where the index is not explicitly specified.

..Al
Posted

Can they regularly reproduce the issue? Are .htaccess files enabled on your server? Try adding

AddType application/x-httpd-php .php5 .html .php4 .php .php3 .php2 .phtml



To a .htaccess file in the appropriate directory and see if they can duplicate the issue still.

Posted

Can they regularly reproduce the issue? Are .htaccess files enabled on your server? Try adding



AddType application/x-httpd-php .php5 .html .php4 .php .php3 .php2 .phtml



To a .htaccess file in the appropriate directory and see if they can duplicate the issue still.


Yes, they are enabled. I can try that and see if it makes any difference, thanks. :)

..Al
Posted

It's quite odd that anything on the server-side would only causes issues for a few users tbh.


Oh trust me I know! Driving me nuts this has. I haven't heard any issues now from anyone in a few days, so I suspect the problem has gone away. I copied my index.html file to index.php and updated the DirectoryIndex so that .php comes before .html, in case there was some bizarre Apache issue that was causing this. Back when the site was initially created in 2000, we didn't want to have any ".php" files on the site, as it was much less common then, so we just made sure all .html files were run through the PHP processor (since the entire site is dynamically generated, this was not a big deal). Never seen an oddball issue like this before, and it's disconcerting to see raw PHP files spewed to end users. As far as I know, it is/was happening only on the main index for the site, not in other directories. It's more aggravating in that I cannot reproduce the issue myself, but I'm sure you know that feeling from trying to reproduce bugs submitted for IP.Board. :)

Thanks again for your suggestions. Until I hear from more someone else still experiencing the issue, I'll assume that it's gone away, but I probably won't ever know exactly what caused it or what fixed it (if anything I did even made a difference!)

..Al

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...