Kaushal Shriyan
2021-Jan-06 18:10 UTC
[CentOS] Apache shows PHP code instead of executing it
On Wed, Jan 6, 2021 at 9:48 PM Christopher Wensink < cwensink at five-star-plastics.com> wrote:> Does the file have execute permissions, what is the file's permissions > and is it owned by the user running apache? > > Chris >Hi Chris, I have added the below in /etc/httpd/conf/httpd.conf. The issue still persists. <FilesMatch \.php$> SetHandler application/x-httpd-php </FilesMatch> #apachectl -M | grep -i PHP does not return anything. # ll /var/www/html/info.php -rw-r--r-- 1 apache apache 23 Jan 6 21:12 /var/www/html/info.php # cat /var/www/html/info.php <?php phpinfo( ); ?> [root at hsbcnonproddeveloperportal www]# ==> /var/log/httpd/access_log <=192.168.0.95 - - [06/Jan/2021:23:38:03 +0530] "GET /info.php HTTP/1.1" 304 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" Best Regards, Kaushal
Alexander Dalloz
2021-Jan-06 18:18 UTC
[CentOS] Apache shows PHP code instead of executing it
Am 06.01.2021 um 19:10 schrieb Kaushal Shriyan:> On Wed, Jan 6, 2021 at 9:48 PM Christopher Wensink < > cwensink at five-star-plastics.com> wrote: > >> Does the file have execute permissions, what is the file's permissions >> and is it owned by the user running apache? >> >> Chris >> > Hi Chris, > > I have added the below in /etc/httpd/conf/httpd.conf. The issue still > persists. > > <FilesMatch \.php$> > SetHandler application/x-httpd-php > </FilesMatch> > > #apachectl -M | grep -i PHP does not return anythingConfigure php-fpm. https://www.stephenrlang.com/2018/02/centos-7-apache-2-4-with-php-fpm/ might help to find the right path to do so. Alexander