John Qian
John Qian

Reputation: 123

php.ini auto_prepend_file not affecting child directories

I've always placed

php_value auto_prepend_file [path to config.php]

in the .htaccess file to include my config.php file in every page. However, I just switched to a new host (namecheap), and this host gives me the error "Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration".

According to this answer, the host is forcing me to set the auto_prepend file directly in the php.ini. I did this (placed a php.ini into public_html and set the auto_prepend_file value), and it worked, but only for the home page. In every page besides the home page, the config.php is not included. It seems like the auto prepend only works on every page if I paste the php.ini into every directory, which definitely isn't proper. I'm at a loss how to include the config.php into every php file... I really don't want to paste a require_once command into every file.

Upvotes: 0

Views: 933

Answers (1)

John Qian
John Qian

Reputation: 123

Found the answer here.

I had to add suPHP_ConfigPath /home/username/public_html to make the php.ini file recursive instead of setting php_value.

Upvotes: 1

Related Questions