How to setup auto_prepend_file with safe mode and open basedir restriction

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.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <b> <pre> <h1> <h2> <h3> <h4> <h5> <h6> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <div> <style><img> <br> <blockquote>
  • Lines and paragraphs break automatically.
  • You may insert videos with [video:URL]

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.

CafeWebmaster.com(CW) is a free online community for webdevelopers and beginners. Anybody can share their code, articles, tips, tutorials, code-examples or other webdesign related material on the site. Newbies can submit their questions and reply to existing questions. CW does not guarantee or warrant reliability of code, data and information published on the site. Use the site on your own risk. The site takes no responsibility of direct or indirect loss or any kind of harm to its users. The site also doesn't take responsibility of infected files or source code with any kind of infection or viruses, worms, spywares, malwares, trojan horses. CW reserves the right to edit, move, or delete any of content for any reason.