tags:

views:

56

answers:

3

Hello,

I have developed a script but whenever i open admin panel it shows just a blank page, however the same script works fine on my another server. I tried changing chmod of files and folders 644, 755, 775 and 777 but still it outputs a blank page.

The main script works fine but its only admin panel thats not working. I check .htaccess also same on both servers.

Any idea what is wrong?

Thank You.

+2  A: 

put this at the top of your admin page

ini_set('display_errors',1);
error_reporting(E_ALL);

The servers probably have different things installed which is causing an error that you can see.

Galen
still the page is blank and no error logs are created
Shishant
sorry there was some silly mistake by me i tried again adding those lines and got this as my 1st error `Notice: Undefined index: submit in /var/www/admin/index.php on line 8`
Shishant
the function on line 8 is `if($_POST['submit'] == 'Login')`
Shishant
+2  A: 

Check the error log of your HTTP server (e.g. Apache). In 99% of cases of a blank page, PHP has experienced a fatal error and exited before generating any output.

If this script works on another server, I'd check that the script can find everything it needs to include or require. Files not found are common fatal errors when moving a script from one environment to another. For instance, if you deployed the file to the new server without configuring the include_path correctly.


Re your comment about the notice you got:

Notice: Undefined index: submit in /var/www/admin/index.php on line 8

the function on line 8 is if($_POST['submit'] == 'Login')

This means your $_POST array does not contain a field 'submit'. Referencing a non-existant array index in PHP is an E_NOTICE. You can fix this in the following way:

if (array_key_exists('submit', $_POST) && $_POST['submit'] == 'Login')
Bill Karwin
checked all files are present
Shishant
A: 

This may sound stupid, but seeing as you all you said was it "outputs a blank page", are you sure there's no output at all? Have you checked the page source, just in case? Remember that if your page starts with a bad HTML tag or something similar, there will be output but that doesn't mean anything is actually rendered in the browser.

Also make sure output buffering isn't on... I can't remember if this can cause issues when trying to debug, but who knows?

Narcissus
theres no output `<html><head/><body/></html>` however when i echo before error line 8 as mentioned in comment of Galen i get echo outputted .
Shishant