Coolstack Php cli issue with config-files, safe_mode and other things?
Using the coolstack apache/php combination I'm running into
something that seems like a bug (or at least an interesting mis-feature)?
Try a simple php program likethis:
<pre>
<?php
passthru("/usr/bin/ls /etc/inet");
?>
</pre>
--
If you hit the web-page you'll see that it produces no output.
This is normal because of a fine feature called"safe mode".
Add the following section to your: /opt/coolstack/php5/lib/php.in and refresh your apache2 server.
; Safe Mode
safe_mode = Off
Should all be working now. So you've TURNED safe-mode off. Goodness?/font>
--
Now lets go take a look at php CLI?
Let us the same script, just a little differently.
Create a file as as follows, and chmod 755 it.
cat ./phptest2.php
#!/opt/coolstack/php5/bin/php
<?php
passthru("/usr/bin/ls /etc/inet");
?>
Here is what happens when we run it:
./phptest2.php
sh: /usr/local/php/bin/ls: not found
Notice, its trying to run the"ls" program from a"safe-mode" directory?
(in other words, the php-cli-executable isn't honoring the directives in the php-config-file?)
===================================
Nowthis is where things get interesting?
cp /opt/coolstack/php5/lib/php.ini /opt/coolstack/php5/etc
(and disable/enable apache)
And lets run our little program again:
./phptest2.php
PHP Warning: Module'mysql' already loaded in Unknown on line 0
PHP Warning: Module'mysqli' already loaded in Unknown on line 0
PHP Warning: Module'apc' already loaded in Unknown on line 0
datemsk.ndpd
hosts
ike
inetd.conf
inetd.conf.sec
?..
As you can see, the program is working fine now, meaning that safe-mode
has been disabled per the config-file in the"new" directory?
===================================
Nowif that was the end of the story, I should have been able to deal with
this work-around?
The problem is that those PHP Warnings above seem more than warnings?
things like the MYSQL extension etc. no longer appear to work
(function calls are no longer recognized) when running inthis mode.
(if you remove the entries from the etc/php.ini there are no warnings,
but they still don't appear to work )
Can anyoneelse confirmthis behavior?
(possibly suggest a work-around that keeps all the pieces working?)
===================================
Per the php documentation: ( http://us.php.net/manual/en/features.commandline.php ) there are (2)
versions of the php executable:
Bydefault when executing make, both the CGI and CLI are built and
placed as sapi/cgi/php and sapi/cli/php respectively, in your PHP source
directory. You will note that both are named php. What happens during
make install depends on your configure line.
It might be helpfulfor coolstack that install BOTH versions (php.cli and php.cgi)
in the php5/bin directory, as there appear to perhaps be slight differences between these versions.
Do you have any ideas on how I can fix what I'm running into?
( my manually compiled version of apache/php doesn't run into this problem,
but I'd like to use (and encourage others) to use the coolstack AMP suite you guys have put together. )
Thanks,
-- MikeE

