Jump to content


Photo

PHP showing blank pages


  • Please log in to reply
10 replies to this topic

#1 poirot

poirot

    Newbie

  • Member
  • Pip
  • 1 posts
  • Main OS: Windows Vista

Posted 26 January 2010 - 08:39 PM

I tried both Production and Development versions of php.ini, but when there are any errors in the php file the server will display a totally blank page, which is extremely counter productive. Why not just show the errors? ;)

Instead of showing this:
 

Show this:

Parse error: syntax error, unexpected ',' in W:\www\file.php on line 8

(running Uniserver 5.5)

EDIT: This problem (I don't know if it's intended "feature") occurs with all versions since 4.4, I had to use 3.5 to avoid this annoyance.

#2 Retsel

Retsel

    Newbie

  • Member
  • Pip
  • 3 posts
  • Main OS: Windows XP

Posted 04 June 2010 - 12:42 PM

I think the answer I just got for my problem might be helpful to you. I don't know how to link to it so I'll repeat the answer (from Ric) here:
--------------------------------
There are two configuration files for PHP production and development.

For security reasons Uniform Server defaults to production and error reporting to screen is disable.

To check which file you are using, from UniTray run “Server Status”
A script will run, fourth line down shows which file is switch in.

For error reporting you need to use the development file.
From UniTray select “Advanced”
From sub-menu run the third item from bottom “php.ini switch to development”
Restart servers to allow new configuration to be picked up.

Errors will be displayed to screen
Additional errors are found in file UniServer\usr\local\apache2\logs\error.log
This file is accessible from UniTray “Server information and logs”

This answer was from Ric
----------------------------------------
Hope this helps,
Retsel

#3 Znote

Znote

    Junior Member

  • Member
  • Pip
  • 37 posts
  • Gender:Male
  • Main OS: Windows 7

Posted 07 June 2010 - 02:40 AM

Put this is your index.php (main file) of your website.

<?php
ini_set('error_reporting', E_ALL | E_STRICT);
ini_set('display_errors', 'Off');
ini_set('log_errors', 'on');
ini_set('error_log', 'error.txt');
if(filesize('error.txt') > 10485760)
	ini_set('log_errors', 'off');
?>

With this script, users who surf the website will not see the error, however, it will be saved in a text document, waiting for you to check it out and lets you see and fix the errors. Even those you haven't found yourself, but other users have found. Will be written in the text document. Very handy. :angry:

Create a file named error.txt in same dir as index.php and you're good to go :angry:

I am representing the open tibia community otland.net
otland.net is contributing open source server software to an 2d mmorpg game called Tibia.

Here are some Uniform server tutorials/guide contributions from me:
VIDEO TUTORIAL: I teach newbreeds to install and operate uniform server: (Updated for Coral 8.x)
http://youtu.be/AsyxPhDTOcI

Uniform Server newbie guide:
Securely installing Uniform Server for total newbeginners:
http://otland.net/f4...-0-3-6-a-77593/
(also contains how to get our open source tibia game, and connect it successfully to the uniform mysql server).

How to add a website for our open source tibia game which includes highscore, create account and so on: (On uniform server)
http://otland.net/f4...m-server-91951/


#4 deathcon4

deathcon4

    Newbie

  • Member
  • Pip
  • 3 posts
  • Main OS: Windows XP

Posted 12 August 2010 - 04:35 PM

I have the same problem, my pages no loads, I tried meny things.

I put this code and no worked.

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Teste</title>
</head>

<body>
<? echo "Hellow world"; ?>

<?php
echo "Este servidor fornece suporte ao PHP";
?>
<?php
ini_set('error_reporting', E_ALL | E_STRICT);
ini_set('display_errors', 'Off');
ini_set('log_errors', 'on');
ini_set('error_log', 'error.txt');
if(filesize('error.txt') > 10485760)
ini_set('log_errors', 'off');
?>
</body>

</html>
But, if I would put parted in file with php extension, works perfctly.
I don't understand what is happening.

#5 Ric

Ric

    Project Manager

  • Admin
  • PipPipPipPipPip
  • 1,535 posts
  • Gender:Male
  • Location:Cambridge,UK
  • Interests:Electronics
    Internet in general
    Open source projects
  • SourceForge IDmpgcan
  • Wiki ID: Ric
  • Main OS: Windows XP

Posted 12 August 2010 - 06:04 PM

OK Lets take a step back!
I assume you have switched to development mode. :)

Reduce your test code to this:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Teste</title>
</head>
<body>
<? echo "Hellow world"; ?>
<?php
echo "Este servidor fornece suporte ao PHP";
?>
</body>
</html>
Save the file as test.htm or test.html to folder UniServer\www

Run servers and type http://localhost/test.htm or http://localhost/test.html

Yep! A blank page. The server is not configured to pass files with extensions .htm or .html to the PHP processor.

Hence no matter what you do you will never see an error message! :angry:

1] Now rename your file to test.php
Type http://localhost/test.php

Result as shown: “Este servidor fornece suporte ao PHP”

2] There is no “ Hellow world” as expected. This is because short tags are not enabled :)
Hence change this:
<? echo "Hellow world"; ?>
To
<?php echo "Hello world"; ?> B)

3] If you do want to pass .htm and .html files to the PHP processor
Quick fix:
Edit file UniServer\www\.htaccess
Add the following line to end of file
AddType application/x-httpd-php .html .htm

4]Alternatively edit Apache config
\UniServer\usr\local\apache2\conf\httpd.conf
Locate this line:
AddType application/x-httpd-php .phtml .php3 .php
And add the extensions
AddType application/x-httpd-php .phtml .php3 .php .html .htm

All .htm and .html pages are passed regardless whether they contain no php. It is a hit on processor time. Hey! Your server, if that’s what you want, no problem B)

All the best
Ric :)

#6 Steve-CC

Steve-CC

    Newbie

  • Member
  • Pip
  • 3 posts
  • Main OS: Windows XP

Posted 23 August 2010 - 08:01 PM

I am a new user and I am having this problem with blank pages as well.

I have read all of the above and I have put UniServer into development mode and tried the test code supplied by Ric above (Thanks Ric) both named as test.htm and test.php.
I get a blank page with every time.

I checked C:\UniformServer\UniServer\usr\local\apache2\logs
I have checked both the error.log and access.log but do not show any errors for when I access the test.htm or test.php or any of the other short php files I have created. If I try to access a page in the directory using an incorrect file name I get a 404 error message but if I type the correct file name I get no error message, my browser shows the name fo the file and I get a blank page.

I should add. I have been using Uniform Servers for several days and have several Drupal sites installed under it working A-OK. It is just now that I have begun to try to write some of my own PHP that I hit this snag. Drupal sites still work just fine.

Any other ideas on how to get php files to display correctly?

Thanks,

Steve

#7 deathcon4

deathcon4

    Newbie

  • Member
  • Pip
  • 3 posts
  • Main OS: Windows XP

Posted 24 August 2010 - 01:57 AM

I have the same problem, all pages loads a blank page in any place that I put the file.

#8 Steve-CC

Steve-CC

    Newbie

  • Member
  • Pip
  • 3 posts
  • Main OS: Windows XP

Posted 24 August 2010 - 05:21 PM

I've been experimenting and had partial success - Some non blank screens - as follows:

This code
<?php
print "Hello Web!";
?>
gets me a page that says - Hello Web!

This code
<?php
phpinfo();
?>
gets me a page the PHP Info page as expected.

This code
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Test</title>
</head>
<body>
<? echo "Hello world";?>
<?php
print "Este servidor fornece suporte ao PHP";
?>
</body>
</html>
gets me a page that is completely blank.

and

This code
<html>
<head>
<title>Listing 3.2 A PHP script including HTML</title>
</head>
<body>
<b>
<?php
print "hello world";
?>
</b>
</body>
</html>

gets me a page that is completely blank

I sure hope somebody will be able to help us out with this

Thanks

Steve

#9 Steve-CC

Steve-CC

    Newbie

  • Member
  • Pip
  • 3 posts
  • Main OS: Windows XP

Posted 25 August 2010 - 04:57 PM

Well - I feel like an idiot but I am no longer getting blank pages so I thought I'd better admit my stupidity to save others time and trouble.

When some of my php scripts started working I got suspicious that maybe I was saving them incorrectly as formatted files since I was using Wordpad and Notepad as editors. Sure enough that was the problem.

#10 Ric

Ric

    Project Manager

  • Admin
  • PipPipPipPipPip
  • 1,535 posts
  • Gender:Male
  • Location:Cambridge,UK
  • Interests:Electronics
    Internet in general
    Open source projects
  • SourceForge IDmpgcan
  • Wiki ID: Ric
  • Main OS: Windows XP

Posted 25 August 2010 - 05:23 PM

Welcome to the master class – Of idiots! :)
I checked your code and could not fault it.

That little gem had not crossed my mind! :angry:
Thanks for the post. B)
All the best
Ric B)

Yep! I was looking for something I missed. :)

#11 joejac

joejac

    Newbie

  • Member
  • Pip
  • 4 posts
  • Main OS: Windows Vista

Posted 22 January 2011 - 05:16 PM

Thanks a lot for this topic.
It helped to solve my issue of the blank page.
Unfortunately the new php is issuing awful "notices" before rendering the page. Any way, I disabled development and I will check later.
Best regards
joejac




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users