Koozali.org: home of the SME Server

PHP doesn't execute

Kees Vonk

PHP doesn't execute
« on: June 02, 2003, 02:09:05 PM »
I have installed a SME 5.6 server for someone, which generally works great. However we cannot get PHP scripts to execute, every time we access a page which contains PHP (and has a .php extension) in the html directory we get a blank page. If we move the php page to cgi-bin we get a '500 Internal Server Error' and the httpd error_log says:

[Fri May 30 09:54:03 2003] [error] (13)Permission denied: exec of /home/e-smith/files/ibays/website/cgi-bin/phpindex.php failed
[Fri May 30 09:54:03 2003] [error] [client 10.1.2.67] Premature end of script headers: /home/e-smith/files/ibays/website/cgi-bin/phpindex.php


PHP is enabled in the ibays setup, we have PHPMyAdmin running without any problems and yet I cannot get php to execute in a normal ibay.

I have never done this before and do not know a lot about php so this is probably just something silly, but any help would be greatly appreciated.

Kees

Nathan Fowler

Re: PHP doesn't execute
« Reply #1 on: June 03, 2003, 08:40:25 AM »
Paste me your PHP code if you would, you have to be sure to include the PHP delimeters ;

Also, try a simple script like:
[Contents of test.php]

[EOF]

Additionally, PHP may be working but you may have an error and may have display_errors turned off in /etc/php.ini, hence the blank page with nothing but header information.

Try turning error debugging on in /etc/php.ini (display_errors on), restarting httpd (/etc/rc.d/init.d/httpd restart), and accessing the page again.  You won't be able to execute php scripts in cgi-bin, so don't bother trying there.

Hope this helped,
Nathan

Kees Vonk

Re: PHP doesn't execute
« Reply #2 on: June 03, 2003, 07:02:27 PM »
Thank you,

the test.php worked straight away, so I then set display_errors to 'on' and up popped the error I was looking for (it now also appears in the syslog which it didn't do before).

One more question though, is it possible to set display_errors for an individual website (ie. set the global default to 'off' and then change it for the one ibay)?

Thank you very much,

Kees

Nathan Fowler

Re: PHP doesn't execute
« Reply #3 on: June 03, 2003, 07:15:15 PM »
I'm very happy I was able to help you, I know how frustrating that stuff can be. ;)

I think you can use ini_set to set this value for a particular site upon execution of the PHP code.

http://us2.php.net/manual/en/function.ini-set.php

IE:

//Get previous value.
$prev_value = ini_get("display_errors");

//Set the value
ini_set("display_errors","1");

//Do some of your code here
//Blah blah, code code

//Set the value back to it's original
ini_set("display_errors",$prev_value);

?>

Nathan Fowler

Re: PHP doesn't execute
« Reply #4 on: June 03, 2003, 07:16:31 PM »
Note, on the bottom of the page under user comments this user says (but I've not yet validated it):

JeDi at Zwelche dot de
24-Apr-2003 06:30
 
There is another possibility by changing PHP Settings!

If your Webspace is able to handle ".htaccess" files, you're able to change PHP_INI Settings through this file!

To disable register_globals you have to set:
php_value register_globals 0

If you wanna set other settings, feel free, because there is no problem!

These Settings are set before running the script, e.g. the results of register_globals, when setting a parameter in the URL like 'foo.php?foo=stuff', is not present, $foo is unset.

Kees Vonk

Re: PHP doesn't execute
« Reply #5 on: June 03, 2003, 07:36:27 PM »
Thank you Nathan,

the .htaccess thingy works, thank you very much for all your help. I wish I got this level of support everywhere.


Kees

Nathan Fowler

Re: PHP doesn't execute
« Reply #6 on: June 03, 2003, 07:42:20 PM »
Behold the power of an open source community willing to help ;)

I'm glad everything is working great, now you can pass your expertise along to someone else with the same problem.

Thanks,
Nathan