Forum Moderators: phranque
I've got a handy little random-quotes kind of script that's written in PHP. The script runs through it's PHP stuff, then echos the quote. The idea is to then include the PHP script in another page, either using PHP includes or, if you're using standard HTML pages, using SSI.
So you've got the script that echos output, then a regular
<!--#include virtual="/path/to/quotescript.php" --> SSI on the HTML page. This procedure works great on one host I have an account with. On a new site I'm setting up, on a different host, I keep getting the old familiar
An error occurred while processing this directive message when I try to call the script with SSI. I've done all the obvious things, checked the path, looked over the SSI "syntax," ran the script alone in my browser to make sure it was working, etc. Everything checked out okay.
I then tried creating a new PHP file. I never even used
<?php to start PHP processing the file, just wrote out some text and saved it. Then I tried to use SSI to include that file. It also failed, same error. What I've narrowed it down to is that the server is happy to use SSI to include any file, regardless of extension, unless and until it's set to parse that file for PHP. As soon as I allow the server to parse the file for PHP, the SSI fails (even if I never even start PHP in the file in question).
After such a lengthy explanation, the question itself is disgustingly short. Why on earth won't the server include a file that's being parsed for PHP, when it's more or less the same server setup and configuration as another server that handles it flawlessly?
Any ideas on what to check or how to troubleshoot this will be greatly appreciated.
Thanks,
Matthew
Don't leave out the <?php .......?> it's bad practice, and makes your scripts open to hackers etc.
Why waste your time with the SSI part, just use php includes,
I have to use these includes on standard HTML pages. On these same pages, I have to include the HTML output of some CGI scripts, and so far I haven't found a way to get that with PHP includes. So for now it's SSI or nothing, unfortunately.
Incidentally, I tried creating a PHP file just to see if I could use PHP includes with this script, and it still failed. I don't know why. Actually I'm about to swap the site to a different host; this isn't the first Mickey Mouse problem I've encountered on this server and I'm just about through with them.
Oh, that kind of problem, say no more. Took me a while to realize that the constant problems I was having with cheapo hosts were costing me far more than the few dollars a month I was saving, since using higher end hosts I have no significant issues as a rule, and any I do have are always resolved asap, with no headaches.
I have to include the HTML output of some CGI scripts, and so far I haven't found a way to get that with PHP includes.