Reason for white/empty/blank screen when loading a php page ?

12-02-04, 02:05 PM
|
|
Newbie Coder
|
|
Join Date: Nov 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
Reason for white/empty/blank screen when loading a php page ?
I am trying to install a php script and when I try to pull it up via the web all I get is a blank/empty/white screen. I know this is vague, but I was wondering if there is there a common reason why this happens ?
|

12-02-04, 07:09 PM
|
 |
Aspiring Coder
|
|
Join Date: Oct 2003
Posts: 510
Thanks: 1
Thanked 1 Time in 1 Post
|
|
Posting your code will help someone to figure it out. It could be caused by several things.
|

12-02-04, 07:14 PM
|
|
Newbie Coder
|
|
Join Date: Nov 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
There's many php files, but since it all starts with an installer, ill post that
Quote:
<?
if (!isset($action)) {
?>
<html><head><title>Installation</title></head><body>
<form action="" method="POST">
<table align=center width=70%>
<tr><td align=right>Sql Server: </td><td align=left><input type="text" name="serv" size="40" value="localhost"></td></tr>
<tr><td align=right>Sql login: </td><td align=left><input type="text" name="logi" size="40"></td></tr>
<tr><td align=right>Sql password: </td><td align=left><input type="text" name="passw" size="40"></td></tr>
<tr><td align=right>Database name: </td><td align=left><input type="text" name="d_name" size="40"></td></tr>
<tr><td align=center colspan=2><input type="hidden" name="action" value="install"><input type="submit" value="save" size="40"> <input type="reset" value="clear" size="40"></td></tr></table>
</form></body></html>
<?
}
if (isset($action) && $action=="install")
{
$file = fopen("conf.php","r") or die ("No access to the file");
$rf = fread($file,filesize("conf.php")) or die ("No access to the file");
fclose($file);
$rf = eregi_replace("nameofserver",$_SERVER['SERVER_NAME'],$rf);
$rf = eregi_replace("nameofdbserver",$serv,$rf);
$rf = eregi_replace("dblogin",$logi,$rf);
$rf = eregi_replace("dbpassword",$passw,$rf);
$rf = eregi_replace("dbname",$d_name,$rf);
$file = fopen($_SERVER["DOCUMENT_ROOT"]."/inc/siteconf/".$_SERVER['SERVER_NAME'],"w") or die ("No access to file");
fwrite ($file,$rf) or die ("Please CHMOD 777 yourservername file");
fclose($file);
mysql_connect($serv, $logi, $passw) or die("can't connect to the database");
mysql_select_db($d_name) or die("can't select the database");
$fp = fopen($_SERVER["DOCUMENT_ROOT"]."/dump.sql","r+");
$content = fread($fp, filesize($_SERVER["DOCUMENT_ROOT"]."/dump.sql"));
fclose($fp);
$cont1 = explode(";", $content);
for ($i = 0; $i < count($cont1); $i++)
mysql_query($cont1[$i]);
header("Location: /index.php");
}
?>
|
I can try and do it manually from what I gather this is what the installer tries to accomplish
1) Save host path, user, pass, db to conf.php
2) create [sitename] config in /inc/siteconf/ with 777 CHMOD
3) Fill DB with dump.sql
Is this all it's asking to be done?
Last edited by ajs; 12-02-04 at 07:16 PM.
|

12-02-04, 10:07 PM
|
 |
Newbie Coder
|
|
Join Date: Jul 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Your essentially receiving an error because PHP has choked somewhere. If you have access to the error logs, take a peek at the error log and you will be able to see what's wrong.
On the other hand, just make an .htaccess file (assuming the server is Linux) and put this in the file:
This website has a quick breakdown for what the error numbers mean...
http://www.help.websiteos.com/suppor...es_and_php.htm
Good luck. If your still stuck, drop the errors on here and we'll see what we can do.
|

12-02-04, 11:46 PM
|
|
Newbie Coder
|
|
Join Date: Nov 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I am using a linux server and added that to the .htaccess file, where do I get the reports as it still displays a blank screen.
|

12-03-04, 01:36 AM
|
|
Junior Code Guru
|
|
Join Date: Jan 2004
Location: Helsinki, Finland
Posts: 666
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
didnt se the ! in the first if
my bad
but now i see a new issue.. the form action is set to "".. does it submit to self?
replace it with "<? echo $_SERVER['PHP_SELF']; ?>"
also this code requires register_globals to be enabled (baad thing).. so check if its on
(php.ini)
Last edited by <?Wille?>; 12-03-04 at 01:42 AM.
Reason: my bad
|

12-03-04, 01:57 AM
|
|
Newbie Coder
|
|
Join Date: Nov 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
|

12-03-04, 01:58 AM
|
|
Newbie Coder
|
|
Join Date: Nov 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
|
Originally Posted by <?Wille?>
didnt se the ! in the first if
my bad
but now i see a new issue.. the form action is set to "".. does it submit to self?
replace it with "<? echo $_SERVER['PHP_SELF']; ?>"
also this code requires register_globals to be enabled (baad thing).. so check if its on
(php.ini)
|
Oh, I got the script from someone else, Is there a way around register_globals ?
|

12-03-04, 03:06 AM
|
|
Junior Code Guru
|
|
Join Date: Jan 2004
Location: Helsinki, Finland
Posts: 666
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
|
Originally Posted by ajs
Oh, I got the script from someone else, Is there a way around register_globals ?
|
sure.. you send all info from form with method post.. so what you need to do is replace all thease $rf = eregi_replace("nameofdbserver",$serv,$rf);
to to something like this
$rf = eregi_replace("nameofdbserver",$_POST['serv'],$rf);
the action var also needs to be with $_POST[].. define from where they come and there is no need for register_globals to be enabled
hope it helps
Wille
|

12-03-04, 03:12 AM
|
|
Newbie Coder
|
|
Join Date: Nov 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for the tip.
I just checked with my hosting provider and register_globals is on
Last edited by ajs; 12-03-04 at 03:22 AM.
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|