Hi All,

I recently set-up PHP4 on a system running RH Linux 6.1 and Apache 1.3.19.

I tried to use the 'auto_prepend_file FileName' command to prepend a file (named hello.php) to all the files served out of a directory.

I made the following entry in the .htaccess file in that directory:
'auto_prepend_file hello.php'

This worked just fine (hello.php was in the same directory).

However, when I placed the hello.php file in the DocumentRoot directory of Apache, and modified the code as below, it stopped working.
'auto_prepend_file /hello.php'

I get an error message as follows:
"Warning: Failed opening '/hello.php' for inclusion (include_path='./:/usr/local/lib/php') in Unknown on line 0"

I tried changing the doc_root variable in the php.ini file to point to the DocumentRoot of Apache. I still get the same error message.

I know this has something to do with the PHP configuration, because the same code under the same directory structure used to work on a different system running RH Linux 6.1, Apache 1.3.19 and PHP4.

Can anybody advice me on what I'm doing wrong?

Thanks,
Michael

    When auto_append'ing, or auto_prepend'ing, the file you are referencing must be in the include_path, or you must use an absolute path name.

    Example htaccess directives:


    php_value include_path /path/to/document/root

    php_value auto_prepend_file hello.php

    ...is essentially the same as...


    php_value auto_prepend_file /path/to/document/root/hello.php

      Macks,

      Thanks for the reply.

      That was the problem. Your help is much appreciated!! 🙂

      FYI -- I changed the 'include_path' directive in the php.ini file to include one more directory, the one I wanted.

      Best,
      Michael

        Write a Reply...