0

I've installed a fresh version of Centos 7, I'm new to Linux.

I installed Apache using yum -y install httpd and I can open the test page and everything is ok with it.

after that I installed PHP(5.4.16) using yum -y install php and it was successfully installed.

after that I restarted Apache using sudo systemctl restart httpd. now I made a info.php file with this code:

<php
phpinfo();
?>

and when I open http://localhost/info.php I get a blank screen with nothing in it.

I've already read lots of topics and questions about this and I did everything but nothing helped.
here are the things that may help you.

Error log:

[Sat Mar 12 12:56:33.235215 2016] [core:notice] [pid 12938] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Sat Mar 12 12:56:33.236027 2016] [suexec:notice] [pid 12938] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Sat Mar 12 12:56:33.251732 2016] [so:warn] [pid 12938] AH01574: module php5_module is already loaded, skipping
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message
[Sat Mar 12 12:56:33.253398 2016] [auth_digest:notice] [pid 12938] AH01757: generating secret for digest authentication ...
[Sat Mar 12 12:56:33.266274 2016] [lbmethod_heartbeat:notice] [pid 12938] AH02282: No slotmem from mod_heartmonitor
[Sat Mar 12 12:56:33.271424 2016] [mpm_prefork:notice] [pid 12938] AH00163: Apache/2.4.6 (CentOS) PHP/5.4.16 configured -- resuming normal operations
[Sat Mar 12 12:56:33.271462 2016] [core:notice] [pid 12938] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Sat Mar 12 12:58:08.594101 2016] [:error] [pid 12940] [client ::1:44873] script '/var/www/html/info.php' not found or unable to stat
[Sat Mar 12 13:01:56.086456 2016] [mpm_prefork:notice] [pid 12938] AH00170: caught SIGWINCH, shutting down gracefully
[Sat Mar 12 13:02:55.938198 2016] [core:notice] [pid 1400] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Sat Mar 12 13:02:56.048201 2016] [suexec:notice] [pid 1400] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Sat Mar 12 13:02:56.077712 2016] [so:warn] [pid 1400] AH01574: module php5_module is already loaded, skipping
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message
[Sat Mar 12 13:02:56.079255 2016] [auth_digest:notice] [pid 1400] AH01757: generating secret for digest authentication ...
[Sat Mar 12 13:02:57.017924 2016] [lbmethod_heartbeat:notice] [pid 1400] AH02282: No slotmem from mod_heartmonitor
[Sat Mar 12 13:02:57.038794 2016] [mpm_prefork:notice] [pid 1400] AH00163: Apache/2.4.6 (CentOS) PHP/5.4.16 configured -- resuming normal operations
[Sat Mar 12 13:02:57.038866 2016] [core:notice] [pid 1400] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'

Apache config file : Stock file

php.ini : stock file

.htaccess : no file

  • Do you have the file /etc/httpd/conf.d/php.conf, and can the apache user ID read it? – Bruce Ediger Mar 12 '16 at 23:33
  • your selinux is enabled you can disable it and restart the server. if you want it to be enabled then please check the context of the file which is newly created. – Mongrel Aug 9 '16 at 4:32
3

You're missing the ? in the opening tag. It should be:

<?php
phpinfo();
?>
0

Try enabling error reporting:

<?php

error_reporting(E_ALL);
phpinfo();

?> 
0

I've encountered this error also, What I did is added rights to php.conf file under /etc/httpd/conf.d.

  • What does that mean? How do you do that? – seizethecarp Nov 14 '18 at 21:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.