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-27-2021, 02:53 PM   #1
walterbyrd
Member
 
Registered: Apr 2004
Posts: 734

Rep: Reputation: 46
apache2: blank page when I try to load php file


# uname -a
Linux servername 4.19.0-18-amd64 #1 SMP Debian 4.19.208-1 (2021-09-29) x86_64 GNU/Linux

# apache2 -v
Server version: Apache/2.4.38 (Debian)
Server built: 2021-09-30T03:50:49

# cat phpinfo.php
<?php phpinfo(); ?>

I was running lighttpd and php 7.0, and everything worked. I "upgraded" to php 7.3 and I kept getting 503 errors when trying to load a php page. Could not fix it, so gave up in frustration, removed lighttpd and php.
Then I reinstalled php, which automatically installs apache2. Now I just get blank pages when I try to run a php script.
 
Old 11-28-2021, 02:28 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
Quote:
Originally Posted by walterbyrd View Post
# uname -a
Linux servername 4.19.0-18-amd64 #1 SMP Debian 4.19.208-1 (2021-09-29) x86_64 GNU/Linux

# apache2 -v
Server version: Apache/2.4.38 (Debian)
Server built: 2021-09-30T03:50:49

# cat phpinfo.php
<?php phpinfo(); ?>

I was running lighttpd and php 7.0, and everything worked. I "upgraded" to php 7.3 and I kept getting 503 errors when trying to load a php page. Could not fix it, so gave up in frustration, removed lighttpd and php.
Then I reinstalled php, which automatically installs apache2. Now I just get blank pages when I try to run a php script.
Hi,

A blank page means that there is a php error.
Check the apache error_log and if you can't find anything useful, enable php logging
 
Old 11-28-2021, 11:00 AM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Duplicate of https://www.linuxquestions.org/quest...ks-4175703719/
 
Old 11-28-2021, 11:32 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,721

Rep: Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914
The OP is asking about apache/php versus lighttpd so it isn't IMHO a duplicate although related.
 
Old 11-28-2021, 11:32 AM   #5
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:
Originally Posted by ondoho View Post
Not really.
OP ditched the lighttpd/php of the other post and installed apache/php.
So now the problem is about php in apache, that gives a blank page.

Regards
 
Old 11-28-2021, 01:00 PM   #6
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,606

Rep: Reputation: 2549Reputation: 2549Reputation: 2549Reputation: 2549Reputation: 2549Reputation: 2549Reputation: 2549Reputation: 2549Reputation: 2549Reputation: 2549Reputation: 2549

Saying "I just get blank pages" doesn't tell us much!

First step, look at actual the HTTP response:
Code:
curl -isS 'https://example.com/phpinfo.php'
Next step, the server logs, i.e. error_log for Apache - this may or not include PHP errors - check the relevant php.ini to see where they are configured to go to.

If the issue isn't obvious from those three things, and searching for any error messages doesn't help, then post the relevant information here (inside code tags) - along with the output of "cat /etc/debian_version" to confirm which version of Debian Buster you're running.


Last edited by boughtonp; 11-28-2021 at 01:08 PM.
 
Old 12-08-2021, 11:18 AM   #7
giesbert
Member
 
Registered: Aug 2003
Location: The Netherlands
Distribution: Debian 12
Posts: 57

Rep: Reputation: 12
My first guess would be: Have you installed libapache2-mod-php?
 
Old 12-10-2021, 05:47 PM   #8
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Rep: Reputation: 54
By default php errors are off. You can enable error reporting in /etc/php.ini.

This is typically not recommended in prod though as some errors may reveal server info such as paths.

Typically it's good to have a dev server that matches the OS/software of prod so when you're coding you should get the errors in dev and be able to fix them, and then it should work on prod. But going between say, php 5 and php 7 there are some differences that can throw you off. So if the host is php 7 it's good to setup a local php 7 based server too.

Of course ensure php is actually being executed, so try something like <?php echo("test");?> to ensure it's executing. You can also do a syntax error on purpose just to see if the error shows up or not.
 
Old 12-12-2021, 04:42 AM   #9
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by Red Squirrel View Post
Typically it's good to have a dev server that matches the OS/software of prod so when you're coding you should get the errors in dev and be able to fix them, and then it should work on prod. But going between say, php 5 and php 7 there are some differences that can throw you off. So if the host is php 7 it's good to setup a local php 7 based server too.
In a pinch this can also be done on the same server, just a different virtual server, sub-domain or even port.
 
  


Reply

Tags
apache2, php



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
Include file won't load ??? PHP - Apache2 AH00035 error pizzipie Programming 1 12-16-2019 10:44 AM
mc4695MF prints test page fine, but application print are hazardous (OK/blank page) hardt68 Linux - Hardware 0 04-25-2014 07:44 PM
Apache2.0.52, t1lib-5.0.2, php-apache2-5.0.2 wizard7423 Slackware 2 04-04-2011 08:09 PM
page won't load (apache2+php on TSL 2.1) restless Linux - Software 1 08-13-2004 09:54 PM
RH & HP4050N PCL - page, pause, page, pause, page andguent Linux - Hardware 0 11-10-2003 08:35 AM

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

All times are GMT -5. The time now is 04:18 PM.

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