tags:

views:

98

answers:

5

I have a server setup where a test script with just phpinfo() works fine.

When I try to run my application on it, it shows up as a blank screen.

I am calling index.php from the browser. The first few lines are as:

<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
require_once('codelibrary...

Yet, the screen continues to be blank.


Edit 1

Here's the structure of the files:

/.htaccess
/index.php
/codelibrary/inc/user-top.php
/codelibrary/inc/variables.php
/codelibrary/inc/config.php

index.php

<?php 
require_once('codelibrary/inc/user-top.php'); 
...

/codelibrary/inc/user-top.php

<?php
require_once("./codelibrary/inc/variables.php"); 
...

/codelibrary/inc/variables.php

<?php
include_once('config.php');
...

I thought the referencing here might be a problem, so I changed it to:

require_once("./codelibrary/inc/config.php");

as well, but no luck.


Edit 2

Ah ha! Thanks Col and TopQ for pointing out that I should look at the log file, it says:

[10-Sep-2010 17:06:02] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/suhosin.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20090626/suhosin.so: cannot open shared object file: No such file or directory in Unknown on line 0

+1  A: 

Use "view source" in your browser to see if anything is being written by your script that the browser might not be rendering visibly.

EDIT

If you're getting an http 500 response, then you can always do a php lint check on your script from the command line:

php -l <filename.php>

An extremely useful and oft-forgotten check on the syntax of your code.

Mark Baker
Hi Mark - no, nothing is showing (after fire's changes, just the 500)
tzmatt7447
In response to the php -l: Thanks for pointing that out I had no idea! It said: No syntax errors detected in index.php
tzmatt7447
Possibly worth doing a php -l lint check on all of the included scripts as well, though if the problem was in one of those I'd have expected you to get a displayed error because the main script has loaded successfully and should be executing to do the includes
Mark Baker
jailshell-3.2$ php -l index.php No syntax errors detected in index.php jailshell-3.2$ php -l codelibrary/inc/user-top.php No syntax errors detected in codelibrary/inc/user-top.php jailshell-3.2$ php -l codelibrary/inc/variables.php No syntax errors detected in codelibrary/inc/variables.php jailshell-3.2$ php -l codelibrary/inc/config.php No syntax errors detected in codelibrary/inc/config.php
tzmatt7447
+3  A: 

Try setting display_errors from a .htaccess file

php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on
fire
Interesting suggestion. Removed the old .htaccess and set it to what you mentioned, got a "500 Internal Server Error"
tzmatt7447
hold on - something may be wrong with the above. If I have JUST these 3 lines, I get the 500 error in the phpinfo script! If I dont have a .htaccess, the phpinfo script works fine.
tzmatt7447
500 errors **can** be permission/ownership based - I've sometimes found uploading a script as root to a clients account can cause the script to 500
Ross
Interesting - I didnt know that, but thats not the case here. -rw-r--r-- 1 myuser myuser 86 Sep 10 05:23 .htaccess
tzmatt7447
And neither am I root in any of the other files
tzmatt7447
what happens if you have ~nothing~ in the script, just <?php ?> does it still 500 ?
Ross
php_flags should be 0s and 1s, not on and off
Col. Shrapnel
fire/Ross - Are you sure I'm supposed to have just these three lines in the .htaccess? Yes, it still gives a 500.
tzmatt7447
whaaa.........!
tzmatt7447
these 500s most likely from bad .htaccess
Col. Shrapnel
@Col. - I have this now, but its still the same! php_flag display_startup_errors 1php_flag display_errors 1php_flag html_errors 1
tzmatt7447
just `php_flag display_errors 1` is enough, no need to play with others. and `php_value error_reporing 2048` would be nice too
Col. Shrapnel
your web_server may not support these commands at all. To check an error log is obligatory.
Col. Shrapnel
No luck with the php_value error_reporing 2048. Where would the error log be Col. sir?
tzmatt7447
+1  A: 

The problem is possibly the following: The error occurrs before your script runs (i.e. while parsing. Probably some syntax error). Since your script does not run, the error-level cannot be changed dynamically. You need to set error_reporting in your php.ini, or try fire's suggestion, which should produce equivalent results.

elusive
A: 

Check the PHP error log. Usually syntax error or missing dependencies.

TopQ
Sorry - gotta ask - where would that be located?
tzmatt7447
@tzm where all other web-server logs being located. you have to consult a server admin/support for that
Col. Shrapnel
(embarrassed) sorry, i figured that out...
tzmatt7447
A: 

As noted in the other answers here if there is an error present in your script it will fail to set the error levels dynamically.

You can add the proper directives to either the .htaccess file in the current directory, the webserver config or the php.ini file (http://php.net/manual/en/errorfunc.configuration.php). You need to prefix those with the php_flag directive a la php_flag display_errors on.

If you can't add the commands to the .htaccess files it is most probable that your server config does not allow for overrides for those properties. Consult with the server maintainer for either changing these values, allowing you to override these directives on a per-folder basis and having access to error logs for your virtual hosts.

ikanobori