php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #13810 Per directory php.ini overrides
Submitted: 2001-10-24 05:24 UTC Modified: 2010-04-12 02:43 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: richard at alavator dot com Assigned: pajoye (profile)
Status: Closed Package: *General Issues
PHP Version: 4.0.6 OS: All
Private report: No CVE-ID: None
 [2001-10-24 05:24 UTC] richard at alavator dot com
I run a server and have always used .htaccess to modify php settings on a per directory basis. I am now opening my server to other people, so I need to refine the security model, which prevents me from using PHP as a module.

Unfortunately, I can't use PHP as a CGI at this time, because I have no way of changing options on a per directory basis.

I would be nice if PHP could be compiled with an option which would have it perform the following actions each time it is invoked as a CGI:

1. Parse the normal configuration file
2. Look in each directory from the document root to the script directory, and progressively parse php.ini files in those directories "overriding" any settings from the main php.ini file (but not otherwise disturbing the php configuration)

This is probably a fairly intensive hit for memory hungry machines, but AFAIK, it is the only way to provide per-directory PHP options in a similar mannar to .htaccess on servers which don't have .htaccess, or where security makes using .htaccess impossible.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-24 23:19 UTC] richard at alavator dot com
I tried writing wrappers for PHP that called it with -d OPTION, and -s to show source, and then creating an apache Action in the .htaccess file, but this did now work, as PHP ignores the command line parameters when invoked as a CGI.

Another suitable workaround would be at have PHP pay attention to CERTAIN command line parameters (such as -d and -s) but refuse to process files specified on the command line, and only allow the adjustment of certain options.
 [2010-04-12 02:43 UTC] pajoye@php.net
-Status: Open +Status: Closed -Package: Feature/Change Request +Package: *General Issues -Assigned To: +Assigned To: pajoye
 [2010-04-12 02:43 UTC] pajoye@php.net
5.3+ has this feature for FCGI. pecl.php.net/htscanner allows that for 5.2.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jun 14 12:01:29 2024 UTC