Issue
I am trying for days to enable php on my server. The web server is up, but php is not parsed.
First things first: the server is a CentOS 7 running apache2 and php 7. Everythign seems to be correctly installed:
OS:
uname -a
Linux rafiki 3.10.0-327.10.1.el7.x86_64 #1 SMP Tue Feb 16 17:03:50 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
and :
cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
apache:
httpd -v
Server version: Apache/2.4.6 (CentOS) Server built: Jul 18 2016 15:30:14
PHP:
php -v
PHP 7.0.10 (cli) (built: Aug 20 2016 07:47:25) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.10, Copyright (c) 1999-2016, by Zend Technologies
Then, in
/etc/httpd/conf/httpd.conf
there is this line:Include conf.modules.d/*.conf
And in
/etc/httpd/conf.modules.d/
:10-php.conf 00-base.conf 00-dav.conf 00-lua.conf 00-mpm.conf 00-proxy.conf 00-systemd.conf 01-cgi.conf
10-php.conf
content:<IfModule prefork.c> LoadModule php7_module modules/libphp7.so </IfModule> <IfModule !prefork.c> LoadModule php7_module modules/libphp7-zts.so </IfModule>
Here is output for
ls /etc/httpd/modules/ | grep php
libphp7.so libphp7-zts.so
In /var/www/, there is a test.php file, which content is:
<?php phpinfo(); ?>
When I try http://[myserver.domain]/test.php, apache serves the raw file, without parsing php code.
I went through a lot of researches including StackOverflow, but none of the results had a solution working for me.
Can someone please help me to get php run properly? Is there something I am doing wrong ?
Solution:
As pointed out by @kyshel, a simple reboot worked.
Solution
Try rebooting the server (as others have already suggested). It worked for me.
Answered By - Srihari Karanth Answer Checked By - David Marino (WPSolving Volunteer)