How to setup auto_prepend_file with safe mode and open basedir restriction

Submitted by Anonymous (not verified) on Fri, 03/13/2009 - 19:59

You want to setup an auto_prepend_file or auto_append_file on a shared webhosting server. It is enaugh to change setting in php.ini file usually. But it does not work under safe_mode with open basedir restriction and suexec. To run it without turning off your security settings:

  • edit php.ini file : pico -w /usr/local/lib/php.ini
  • set safe_mode_include_dir = /path/to/your/safe_mode_inc_dir
  • add "/path/to/your/safe_mode_inc_dir" to include_path
  • set auto_prepend_file = /path/to/your/safe_mode_inc_dir/your_auto_prepend.php
  • restart your webserver : httpd restart

Be sure to not blocking anything with your auto_prepend_file errors or header-outputs like spaces newlines etc.