Re: changing the ini from a file

From: Date: Thu, 17 Jan 2008 19:34:24 +0000
Subject: Re: changing the ini from a file
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-267505@lists.php.net to get a copy of this message
""Daniel Brown"" <parasane@gmail.com> wrote in message news:ab5568160801160907xa2525actd211b48e23f55e56@mail.gmail.com...
On Jan 16, 2008 12:02 PM, Jim Lucas <lists@cmsws.com> wrote:
Jim Lucas wrote:
Wolf wrote:
I'm using .htaccess to do php_value auto_prepend_file "auth.php" The problem is that there are very specific files that I want to be able to NOT run that in. I guess I could just move them to a directory and use .htaccess to perform a php_value auto_prepend_file "" But I was hoping to not have to make a separate folder for that. Anyone encoutered being able to change/disable the setting on the fly in a specific file? Thanks! Wolf
Just had an interesting way of solving this problem come to mind. I would like others to way in on this. You can do this completely from within apache. For the pages that you want to have auth.php included with, give them and extension of .phtml or something else... Then, configure apache to allow php to process those like this AddType application/x-httpd-php .php AddType application/x-httpd-php .phtml then in apache, could be in httpd.conf or .htaccess have something like this. <Files .phtml>
    php_value auto_prepend_file "auth.php"
</Files> When finished, restart apache and you should be good to go. I would try something like this. Should work, others might have better ideas.
Now that I am looking at this a second time. Couldn't all this apache stuff be done in the .htaccess file? Just place all the following in a .htaccess file, then change the extension on the file(s) that you want to have work this way. I don't think you need to touch the httpd.conf file at all. AddType application/x-httpd-php .php AddType application/x-httpd-php .phtml <Files .phtml>
     php_value auto_prepend_file "auth.php"
</Files>
Then all of the links or includes would have to be updated to handle the .phtml extension change, too. Good idea, but it sounds to be like what he's asking unfortunately just isn't possible without some form of major overhaul. -- </Dan>
Well, at least it will be usefull next time someone does a project in which they want to auto-add a header, or some authorization code.

« previous php.general (#267505) next »