Doc #33430 [Com]: auto_prepend_file not respected in command line environment
| From: | php at keithtyler dot com | Date: | Thu, 17 May 2012 00:09:37 +0000 |
| Subject: | Doc #33430 [Com]: auto_prepend_file not respected in command line environment | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-8367@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=33430&edit=1
ID: 33430
Comment by: php at keithtyler dot com
Reported by: gk at proliberty dot com
Summary: auto_prepend_file not respected in command line
environment
Status: Not a bug
Type: Documentation Problem
Package: Documentation problem
Operating System: RH 9 Linux
PHP Version: 5.0.3
Block user comment: N
Private report: N
New Comment:
Uh, this is a different bug than the one at 34367. Pretty clearly.
Previous Comments:
------------------------------------------------------------------------
[2005-09-05 09:57:50] sniper@php.net
No need to have two reports about exactly same issue.
------------------------------------------------------------------------
[2005-09-04 19:13:40] csaba at alum dot mit dot edu
Oops, that's not how I verified (I was mixing tests there). I verified using:
php.exe -d auto_prepend_file=pop.php -r popup('Hi');
php-win.exe -d auto_prepend_file=pop.php -r popup('Hi');
and these both failed since they didn't find popup defined.
Please see http://bugs.php.net/34367 for a distinct but
related bug.
Csaba
------------------------------------------------------------------------
[2005-09-04 18:35:00] csaba at alum dot mit dot edu
I'd like to add that this bug exists on my 2005 Aug 31 PHP 5.1 / Win XP Pro.
It seems that it is a bug and not a documentation problem, because each of php.exe, php-win.exe, and
php-cgi.exe include the auto_prepend_file if invoked in interactive mode. Please change the
Category appropriately.
Here's how I tested (must be on a windows system):
Make one file, pop.php:
<?php
function popup($text, $title="PHP popup") {
$oWSH = new COM("WScript.Shell");
if (is_null($text)) $text = "NULL";
$oWSH->Popup($text, 4, $title, 131120);
}
popup ("inside pop.php");
?>
now it may be tested as follows from the command line (type in one single long line at the prompt
from the directory of php.php):
echo "<?php popup('prepend OK');var_dump(get_included_files());exit(); ?>"
| php.exe -d auto_prepend_file=pop.php -a
Of course you can replace php.exe with php-win.exe or php-cgi.exe In all three cases you get the
expected behaviour of two popups showing.
It would be very useful to have this bug fixed for my situation where I want to have an automatic
include file for the CLI versions of PHP, but I want to disable that include file when I fall into
PHP via Apache. Which disabling I would do my means of the apache directive:
PHP_value auto_prepend_file none
Csaba Gabor from Vienna
PS. I have verified that the -r version does not work by typing, from the command line:
php.exe -r pop.php
php-win.exe -r pop.php
(php-cgi.exe doesn't take a -r argument)
------------------------------------------------------------------------
[2005-06-22 09:38:44] gk at proliberty dot com
Description:
------------
auto_prepend_file, auto_append_file values are not effective in command line (CLI-SAPI) code: php -r
<code>
The value of auto_prepend_file is correctly reported as having been read from the php.ini file (or
equivalent -d command line assignment), but the file is not 'prepended' prior to execution
of command line code.
If this is by design, then this behavior is inconsistent with how other php.ini values are respected
in the command line code environment and should be documented since it is not intuitive.
Please do not bogusify this report.
If not a design bug, then this is a documentation bug and a feature request.
Reproduce code:
---------------
cat /auto_prepend_file.php
<?php echo __FILE__."\n"; ?>
php -d auto_prepend_file=/auto_prepend_file.php -r 'echo "code";';
Expected result:
----------------
auto_prepend_file.php
code
Actual result:
--------------
code
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=33430&edit=1