i've got a php project with a configuration file config.php that stores config information like database info, sites, etc.
normally we'd include this config file towards the top of every php page like require_once(".../config.php) however, i've discovered a method to do that by creating b .htaccess file and can include this:
php_value auto_prepend_file /home/public_html/..../config.php
this works fine until i moved it towards the hosting that is shared. apparently, this hosting that is shared enables us to alter the PHP version from 4x to 5x. After altering to 5x, i realized they've produced b .htaccess file using the following content:
<FilesMatch "\.php$"> # phpvs v5 AddHandler x-httpd-php5 .php # phpvs v5 </FilesMatch> # phpvs v5
with this particular, it ignores the include road to the config file.. how do i start fixing this? i certainly don't wanna include my config.php in each and every php files.
An htaccess file isn't limited to that contains just one directive. You could have both.
normally we'd include this config file towards the top of every php page like require_once(".../config.php) however, i've discovered a method to do that by developing a .htaccess file and can include this
Most likely not the best move. It's more stable and portable to get this done inside your PHP rather than depend on .htaccess. Depending on .htaccess means in case your web server is transformed or reconfigured it's prone to cease working (while you found).
Yes, it does not answer your question however i would consider returning to carrying this out using require_once() within the appropriate PHP files.