Main Area and Open Discussion > General Software Discussion
Help Request: Php files on Apache server not loading right
barney:
Unfortunately, other than trying to run phpinfo(), I don't know a way to verify mod_php except by checking the .conf/.ini files. However, most everything I've found does not include mod_php save for Apache 1.x. Seems it's being ... deprecated? ... or just replaced by FastCGI <shudder />.
HTML pages work just fine, although I've very few w/o some PHP content ;).
I guess the .htaccess is short enough to post. It's one I've used for quite a while now, although I don't understand everything I know about it :(.
--- ---# Enable Server-Side Includes
AddType text/html .shtml
AddHandler server-parsed .shtml
AddHandler server-parsed .html
Options FollowSymLinks Includes
# Define default pages
DirectoryIndex index.html index.php
# Linking Control - allow only blank or listed referers
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?win7rc3ggw/.*$ [NC]
RewriteRule \.(bmp|gif|jpg|png)$ - [F]
# Prevent viewing of htaccess
<Files ~ "^\.ht">
order allow,deny
deny from all
satisfy all
</Files>
# Disable directory listing from this point
Options +Indexes
# Omit certain file types from the directory listing
IndexIgnore *.bmp *.gif *.jpg *.png
#Handle HTML as PHP
AddHandler application/x-httpd-php .html
barney:
OK, this seems to have been resolved ... at least, PHP is showing properly now, although the index order is not being followed.
I loaded the httdp.conf file in WinMerge, along with a known good file from another machine. After poring over it for what seemed hours, I kept finding some lines that were indicated as being different even though they were, visually, identical. I deleted those lines, then retyped them. Suddenly, stuff works.
Barring any other evidence, I'm constrained to assume that there were non-visible characters in the replaced lines that Apache could recognize even though I couldn't see them. I suppose I should have loaded both files into a hex editor (PSPad has that capability, though it's seldom used on my part.) to see what the difference was, but by the time I thought of that, I'd already implemented the changes.
At any rate, although I don't fully understand the whys & wherefores, so far things seem to be fixed. Sorry to have troubled you with such a simplistic issue.
Deozaan:
I'm not sure, but it could have been different EOL characters.
barney:
That's something to consider if a similar file is encountered in the future. Uncertain, though. *nix uses LF for EOL, Mac uses CR, and Win uses both - so if one or the other were missing, the line would not display properly in the editor (I use PSPad for .htaccess/.conf/.ini files, with CR+LF as default line ending, when working in Windows). Unless Win looks at the order, i.e., LF+CR as opposed to CR+LF? I'm really not certain there, but I don't think that matters. If I get time, I'll put a text file in PSPad in hex, then change the order, see what transpires.
Since I frequently hit CTRL while typing, I'm inclined to think that may have been the cause. I usually can tell that's happened because some hot-keyed app will pop up, stealing the focus while I'm typing merrily away. It's possible, I'd guess, that some CTRL-key combos could put a non-visible character in a text string when it doesn't activate an application. Another area of ignorance, but I seem to remember having that problem with VB apps back in the corporate days.
mouser:
ps -- just a pet peeve -- when starting a new topic, can we all make sure we try to specify topic titles that will help people searching identify the topic contents.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version