Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:16739 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63130 invoked by uid 1010); 16 Jun 2005 16:19:22 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 63115 invoked from network); 16 Jun 2005 16:19:21 -0000 Received: from unknown (HELO rowe-clan.net) (127.0.0.1) by localhost with SMTP; 16 Jun 2005 16:19:21 -0000 X-Host-Fingerprint: 207.155.252.9 valiant.concentric.net Solaris 8 (1) Received: from ([207.155.252.9:52552] helo=valiant.cnchost.com) by pb1.pair.com (ecelerity 1.2 r(5656M)) with SMTP id E8/34-20931-986A1B24 for ; Thu, 16 Jun 2005 12:19:21 -0400 Received: from rcsv650.rowe-clan.net (c-24-13-128-132.hsd1.il.comcast.net [24.13.128.132]) by valiant.cnchost.com id MAA13637; Thu, 16 Jun 2005 12:19:18 -0400 (EDT) [ConcentricHost SMTP Relay 1.17] Errors-To: Message-ID: <6.2.1.2.2.20050616111226.0baf82d0@pop3.rowe-clan.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.1.2 Date: Thu, 16 Jun 2005 11:16:49 -0500 To: internals@lists.php.net Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Subject: [PATCH] PHPIniDir for 1.3? From: wrowe@rowe-clan.net ("William A. Rowe, Jr.") Several of my administrators have grown to love PHPIniDir in the sapi/apache2handler/, so I've thrown together this patch for Apache 1.3 mod_php to provide the feature. I'm guessing alot of users would be grateful for it if they want to keep php.ini in the conf/ tree, or wherever makes the most sense for their system config. Can be applied to mod_php4.c or mod_php5.c below; --- sapi/apache/mod_php4.c +++ sapi/apache/mod_php4.c @@ -814,6 +814,18 @@ } /* }}} */ +/* {{{ php_apache_phpini_set + */ +static const char *php_apache_phpini_set(cmd_parms *cmd, void *mconfig, const char *arg) +{ + if (apache_sapi_module.php_ini_path_override) { + return "Only first PHPINIDir directive honored per configuration tree - subsequent ones ignored"; + } + apache_sapi_module.php_ini_path_override = ap_server_root_relative(cmd->pool, arg); + return NULL; +} +/* }}} */ + /* {{{ int php_xbithack_handler(request_rec * r) */ static int php_xbithack_handler(request_rec * r) @@ -918,6 +930,7 @@ {"php_flag", php_apache_flag_handler, NULL, OR_OPTIONS, TAKE2, "PHP Flag Modifier"}, {"php_admin_value", php_apache_admin_value_handler, NULL, ACCESS_CONF|RSRC_CONF, TAKE2, "PHP Value Modifier (Admin)"}, {"php_admin_flag", php_apache_admin_flag_handler, NULL, ACCESS_CONF|RSRC_CONF, TAKE2, "PHP Flag Modifier (Admin)"}, + {"PHPINIDir", php_apache_phpini_set, NULL, RSRC_CONF, TAKE1, "Directory containing the php.ini file (Admin)"}, {NULL} }; /* }}} */ --- sapi/apache/mod_php5.c +++ sapi/apache/mod_php5.c @@ -814,6 +814,18 @@ } /* }}} */ +/* {{{ php_apache_phpini_set + */ +static const char *php_apache_phpini_set(cmd_parms *cmd, void *mconfig, const char *arg) +{ + if (apache_sapi_module.php_ini_path_override) { + return "Only first PHPINIDir directive honored per configuration tree - subsequent ones ignored"; + } + apache_sapi_module.php_ini_path_override = ap_server_root_relative(cmd->pool, arg); + return NULL; +} +/* }}} */ + /* {{{ int php_xbithack_handler(request_rec * r) */ static int php_xbithack_handler(request_rec * r) @@ -918,6 +930,7 @@ {"php_flag", php_apache_flag_handler, NULL, OR_OPTIONS, TAKE2, "PHP Flag Modifier"}, {"php_admin_value", php_apache_admin_value_handler, NULL, ACCESS_CONF|RSRC_CONF, TAKE2, "PHP Value Modifier (Admin)"}, {"php_admin_flag", php_apache_admin_flag_handler, NULL, ACCESS_CONF|RSRC_CONF, TAKE2, "PHP Flag Modifier (Admin)"}, + {"PHPINIDir", php_apache_phpini_set, NULL, RSRC_CONF, TAKE1, "Directory containing the php.ini file (Admin)"}, {NULL} }; /* }}} */