Forum Moderators: coopster

Message Too Old, No Replies

auto_prepend_file

not working - sanity check please

         

lorax

1:55 am on Jan 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'm using htaccess to prepend a file like so:

php_value auto_prepend_file "/var/www/html/test"

The "test" file has a simple echo in it:

<?php
echo "<h1>HELLO</h1>";
?>

My understanding of the auto_prepend_file is that it will run the file it calls everytime a PHP file is requested by the webserver. So in this case, I'm calling a phpinfo.php file. I should see HELLO at the top of the page - yes?!

I'm not and I don't know why. The PHP install is mod_php. And yes, according to the host, Apache will allow PHP setting changes within the htaccess file.

So what am I missing (I have this horrible feeling this is going to be one of those DOH moments).

jollymcfats

2:12 am on Jan 15, 2005 (gmt 0)

10+ Year Member



That looks just like my (working) httpd.conf setup, except that I don't use quotes around the filename.

You could also drop a

error_log("foo");
into your test file on the off chance that phpinfo() is somehow messing with your output.

lorax

2:15 am on Jan 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I've tried it with and without the quotes but I still get a blank page. Perhaps that's a clue I should have given. There's no error returned - only a blank page.

>> error_log

It's worth a shot.

jollymcfats

2:34 am on Jan 15, 2005 (gmt 0)

10+ Year Member



I poked at my setup a bit and found that a parse error in the prepended file will return a blank page, as will specifying a bad file path. Both produced warnings in my error log.

Breaking the permissions on the file didn't produce any errors at all, it just quietly skipped the prepend.

jollymcfats

2:37 am on Jan 15, 2005 (gmt 0)

10+ Year Member



I suppose I should also add that I've got warnings cranked up to 11. These came through at the "Warning" log level.

lorax

2:43 am on Jan 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Re: parse error.

Found it. And it was a DOH moment. :)

Thanks.