|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-09-04 22:09 UTC] sniper@php.net
[2000-10-31 11:23 UTC] stas@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 13:00:02 2025 UTC |
php built as cgi : ./configure --prefix=/usr \ --with-config-file-path=/etc/php \ --enable-force-cgi-redirect \ --without-pcre-regex \ --enable-debug=no \ --enable-safe-mode $grep include_path /etc/php/php.ini include_path = . $ls include/me.inc include/me.inc $php -q -d include_path=.:include <?php include ('me.inc'); ?> ^D <b>Warning</b>: Failed opening 'me.inc' for inclusion (include_path='.') in <b>-</b> on line <b>2</b><br> I had a look at the code in sapi/cgi/cgi_main.c, php_ini.c as well as configuration-parser.y. configuration-parser.y and cgi_main.c. They all call php_ini.c/php_alter_ini_entry. It's called a first time from configuration-parser with '.' coming from /etc/php/php.ini and then called from the command-line "analyser" (/sapi/cgi/cgi_main.c) Because the value is already set, the first test in alter_ini_entry fails and returns (php_ini.c:143) : if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==FAILURE) { return FAILURE; } I use the cgi version in command line for some cron scripts related to a whole web-based application, that's the reason why I need this. The workaround I've found ? Have php.ini in the directory the scripts are in with the variables correctly set in it. :-((( BTW, have a look at this (shell related) one : $cat ./script.php #!/usr/bin/php -q -d include_path=foo <?php echo "Hello World"; ?> --- Depending on wich shell you run it from, php receives "php" "-q -d include_path=foo" "./script.php" (linux) "php" "-q" "./script.php" (solaris) as argv, leading to problems... Solution ? Ahem... Nasty one : #!/bin/bash /usr/bin/php -q -d include_path=foo <<EOF <?php echo "Hello World"; ?> EOF Flavien Lebarbe.