LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 03-02-2008, 06:29 AM   #1
Hirszu
Member
 
Registered: Mar 2005
Distribution: Ubuntu 7.10
Posts: 40

Rep: Reputation: 15
PHP pages are displayed as blank pages


I recently compiled Apache 2.2.8 and PHP 5.2.5 from source and did everything as in the official PHP documentation. The weird thing is that I've got blank pages on almost every PHP page. One script works and I don't know how it's possible. I used to run nginx before, but I removed it. The Ubuntu packages also don't work.

My httpd.conf is the default one with PHP enabled. My php.ini is the default php.ini-recommended. How can I fix this weird behavior?
 
Old 03-02-2008, 08:08 AM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,884

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
Use:
Code:
short_open_tag = On
in php.ini to see if it works.
 
Old 03-02-2008, 09:38 AM   #3
Hirszu
Member
 
Registered: Mar 2005
Distribution: Ubuntu 7.10
Posts: 40

Original Poster
Rep: Reputation: 15
I'm using my own scripts and I'm aware of the short_open_tag variable, so I use the <?php open tag. Anyway, I tested it and it doesn't work.

If I create a phpinfo script, it works. If I run a more complex script like
Code:
<?php
// here some requires
// and a class definition
?>
<!-- here comes the html -->
<?php
// an echo
?>
it spawns a blank page. If PHP weren't working properly, I'd see only the HTML with the PHP code in the source and not a blank page.
 
Old 03-02-2008, 09:52 AM   #4
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
check the apache log file for hints; I don't have access at the moment to my slackware server, but somewhere in /var/log/

//edit:
you start with PHP open tag; if something goes wrong in that first part (before you get to the html part), apache might/will abort resulting in blank page

Last edited by Wim Sturkenboom; 03-02-2008 at 09:54 AM.
 
Old 03-02-2008, 12:20 PM   #5
Hirszu
Member
 
Registered: Mar 2005
Distribution: Ubuntu 7.10
Posts: 40

Original Poster
Rep: Reputation: 15
Ok, it seemed to be a stupid question. I had display_errors turned off in my php.ini and my scripts are spawning errors so I've got blank pages as result. Thanks anyway!

EOT
 
Old 03-02-2008, 12:31 PM   #6
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 114Reputation: 114
that'll do it every time!

If you have php installed for use from the command line, you can also try to run your scripts by the invocation php myscript.php.

If you get html text output, you are good to go. Otherwise, you will get descriptive error messages, regardless of what the PHP plugin to apache is configured to do.

Also, if you have php available at the command line, then starting a script with shebang php lets you run scripts written in php exactly the same way you run perl scripts or bash scripts.

Specifically, on my system, if the first line is:

#!/usr/bin/php

then I can execute php scripts like any other command.
 
Old 03-03-2008, 12:09 AM   #7
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
Quote:
Originally Posted by Hirszu View Post
Ok, it seemed to be a stupid question. I had display_errors turned off in my php.ini and my scripts are spawning errors so I've got blank pages as result. Thanks anyway!

EOT
My opinion:
If this is a production server, it should be off for security reasons. Under other circumstances (e.g. development), it's up to you.

Last edited by Wim Sturkenboom; 03-03-2008 at 12:23 AM.
 
  


Reply

Tags
apache2, blank, pages, php


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Blank Pages xxclixxx Linux - Server 2 10-16-2007 01:14 PM
trouble with the way man pages are displayed win32sux Slackware 28 04-13-2006 06:28 AM
web pages displayed on one machine but not other phoenixenigma Linux - Software 3 02-23-2006 01:54 PM
php 5.0 blank pages (fedora) spacy2003 Linux - Software 2 02-06-2005 01:34 PM
Blank pages before and after printing bspicer Linux - General 0 05-13-2002 02:16 PM


All times are GMT -5. The time now is 09:55 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration