LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-10-2009, 03:39 AM   #1
jsteel
Member
 
Registered: Mar 2007
Location: England
Distribution: Arch
Posts: 392

Rep: Reputation: 34
Some PHP pages don't work.


Hi,

I have a server running Debian stable with Apache and PHP5.

I have a Perl web application running perfectly, but when I try and set up a PHP web application (a booking system in this case) the index.php does not display (blank page). This has happened on both PHP systems that I have tried (CRBS and ERBS).

A simple PHP test page works. I have tried "chowning" the contents with www-data and "chmoding" it with 777 and that does not make any difference.

Any ideas? Thanks.
 
Old 11-10-2009, 04:18 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi

Turn "display_errors" to On in php.ini to see if you find something. Don't forget to set it back to Off when done.

Regards
 
Old 11-10-2009, 04:34 AM   #3
jsteel
Member
 
Registered: Mar 2007
Location: England
Distribution: Arch
Posts: 392

Original Poster
Rep: Reputation: 34
Thanks for this suggestion. I've checked (see below) and it is already on.

cat /etc/php5/apache2/php.ini | grep display_errors

; instead (see below). Keeping display_errors enabled on a production web site
; possible values for display_errors:
;display_errors = "stderr"
display_errors = On
; Even when display_errors is on, errors that occur during PHP's startup
 
Old 11-10-2009, 04:47 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
Have you checked the apache logs?
 
Old 11-10-2009, 04:50 AM   #5
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
index.php files do not display?

For example if you have a file at /var/www/foo/index.php and you open you browser at "http://localhost/foo/" you don't see the file?

What if you piont your browser at: "http://localhost/foo/index.php"?

If the above describes your situation then it looks like you need to add "index.php" to the list of "DirectoryIndex" in your /etc/apache/httpd.conf

Or, maybe I'm completely on the wrong track...

Evo2.
 
Old 11-10-2009, 04:51 AM   #6
jsteel
Member
 
Registered: Mar 2007
Location: England
Distribution: Arch
Posts: 392

Original Poster
Rep: Reputation: 34
Yes I checked to see if anything had been written to a log with the following command:

ls -l /var/log/ | grep 11-10 (today's date)

Nothing to do with Apache/PHP is shown and nothing at the time of the problem.
 
Old 11-10-2009, 04:53 AM   #7
jsteel
Member
 
Registered: Mar 2007
Location: England
Distribution: Arch
Posts: 392

Original Poster
Rep: Reputation: 34
evo2,
Thanks but no that's not the problem. Even specifying the index.php in the URL does not help. With a test index.php page (with a simple PHP echo or similar) works fine.
 
Old 11-10-2009, 04:59 AM   #8
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Quote:
Originally Posted by jsteel View Post
Yes I checked to see if anything had been written to a log with the following command:

ls -l /var/log/ | grep 11-10 (today's date)

Nothing to do with Apache/PHP is shown and nothing at the time of the problem.
I think Debian has dedicated apache logs in /var/log/apache2/, which your grep above would miss.

Evo2.
 
Old 11-10-2009, 05:10 AM   #9
jsteel
Member
 
Registered: Mar 2007
Location: England
Distribution: Arch
Posts: 392

Original Poster
Rep: Reputation: 34
Ah yes, thanks.

Nothing in the error log, but in the access log I have the following (doesn't look helpful to me):

*MY IP* - - [10/Nov/2009:11:10:06 +0000] "GET /bookings/index.php HTTP/1.1" 200 20 "-" "Mozilla/5.0 (X11; U; Linux i686; en; rv:1.9.0.15) Gecko/20080528 Epiphany/2.22"
*MY IP* - - [10/Nov/2009:11:10:08 +0000] "GET /bookings/index.php HTTP/1.1" 200 20 "-" "Mozilla/5.0 (X11; U; Linux i686; en; rv:1.9.0.15) Gecko/20080528 Epiphany/2.22"
 
Old 11-10-2009, 05:18 AM   #10
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Quote:
Originally Posted by jsteel View Post
Ah yes, thanks.

Nothing in the error log, but in the access log I have the following (doesn't look helpful to me):

*MY IP* - - [10/Nov/2009:11:10:06 +0000] "GET /bookings/index.php HTTP/1.1" 200 20 "-" "Mozilla/5.0 (X11; U; Linux i686; en; rv:1.9.0.15) Gecko/20080528 Epiphany/2.22"
*MY IP* - - [10/Nov/2009:11:10:08 +0000] "GET /bookings/index.php HTTP/1.1" 200 20 "-" "Mozilla/5.0 (X11; U; Linux i686; en; rv:1.9.0.15) Gecko/20080528 Epiphany/2.22"
Looks like the page is being served up ok to me. Maybe it's a problem with your browser. Have you tried something other than epiphany?

Evo2.
 
Old 11-10-2009, 05:22 AM   #11
jsteel
Member
 
Registered: Mar 2007
Location: England
Distribution: Arch
Posts: 392

Original Poster
Rep: Reputation: 34
Yes, Firefox (Iceweasel) on Debian and IE8 on Windows XP.
 
Old 11-10-2009, 05:41 AM   #12
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
*MY IP* - - [10/Nov/2009:11:10:06 +0000] "GET /bookings/index.php HTTP/1.1" 200 20 "-" "Mozilla/5.0 (X11; U; Linux i686; en; rv:1.9.0.15) Gecko/20080528 Epiphany/2.22"
I don't think that the page size is just 20 bits long.
Take a look at the beginning of index.php to see if it starts with "<?php" or just "<?"
In the second case use "short_open_tag = on" in php.ini and see if it works. Of course you have to restart apache after changing php.ini.
 
Old 11-10-2009, 06:23 AM   #13
jsteel
Member
 
Registered: Mar 2007
Location: England
Distribution: Arch
Posts: 392

Original Poster
Rep: Reputation: 34
Both PHP web applications use <?php at the beginning of their index.php pages.

short_open_tag is already set to "on":

cat /etc/php5/apache2/php.ini | grep open_tag
short_open_tag = On
 
Old 11-10-2009, 06:46 AM   #14
jsteel
Member
 
Registered: Mar 2007
Location: England
Distribution: Arch
Posts: 392

Original Poster
Rep: Reputation: 34
If I add an "echo 'testing';" after the <?php in the index.php that is not working, the word "testing" is displayed on the page. If I put it at the bottom it is not displayed. There must be something in these pages that is stopping the page from loading. Could it be something to do with MySQL?
 
Old 11-10-2009, 07:00 AM   #15
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Could be a mysql connection problem among other things, but without the errors output it's difficult to say.
Use the following in php.ini and see if you get any output:
Code:
display_errors = On
display_startup_errors = On
error_reporting = E_ALL
 
  


Reply



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
PHP pages are displayed as blank pages Hirszu Linux - Software 6 03-03-2008 12:09 AM
installed php and apache yet my php pages dont load ?? jessica_lilly Linux - Software 1 11-13-2007 01:57 AM
Suse 9.3/apache2/php4 - Firefox tries to download index.php, other *php pages work stefanlasiewski SUSE / openSUSE 1 01-18-2006 06:12 PM
can't view php pages allan_y Linux - Software 2 07-23-2004 11:48 PM
[PHP] How do I view PHP pages?? vbp6us Linux - General 4 04-16-2003 06:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:02 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration