Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
# 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.
# 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
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.
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.
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336
Rep:
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.