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

[4321 byte] By [mikee11a] at [2007-11-27 9:55:05]
# 1

Mike,

Thank you for your support of Cool Stack.

All of the puzzling issues you outline below stem from one mistake we made while building PHP. We included the following in the configure line :

--with-config-file-path=${PREFIX}/etc \

--with-config-file-scan-dir=${PREFIX}/etc \

The default apache httpd.conf we ship sets the PHPIniDir to ...php5/lib and so we ship php.ini in there.

But if you use php from the command line as in your examples below, it will ignore the php.ini in 'lib' and instead look for it in 'etc'. Since we included both the config-file-path and config-file-scan-dir directives, it does this scanning twice - that's the reason for your error messages indicating that the extension's are already loaded.

But this can be easily worked around as you discovered. I just tested with safe-mode off and had no trouble getting the mysql extension to work. Please do upgrade your APC to 3.0.14 which you can get from http://blogs.sun.com/shanti/entry/apc_update

Without that APC, you will get segv's while trying to use mysql.

Let me know if you're still running into issues with mysql and if so, please do post your test code snippet.

Thanks

Shanti

shantiSa at 2007-7-13 0:25:10 > top of Java-index,Open Source Technologies,OpenSPARC...
# 2

thank you so much, this did the trick.

The "key" in the work-around is to either install the new apc code, or comment it out in the etc/php.ini file. (this will keep your php-cli from dumping core each time it runs)

Just FYI: there are warning messages about multiple loads of ldap/mysql/etc. extensions, but it appears that for now we'll just have to live with them.

thanks again for the assistance, and hopefully this thread will keep someone else from pulling their hair out :-)

-- MikeE

mikee11a at 2007-7-13 0:25:10 > top of Java-index,Open Source Technologies,OpenSPARC...