Kaushal Shriyan
2021-Jan-06 16:13 UTC
[CentOS] Apache shows PHP code instead of executing it
Hi, I am running the below php, httpd and CentOS Linux version. # rpm -qa | grep php php73-mbstring-7.3.25-1.el7.ius.x86_64 php73-json-7.3.25-1.el7.ius.x86_64 php73-fpm-7.3.25-1.el7.ius.x86_64 php73-pdo-7.3.25-1.el7.ius.x86_64 php73-gd-7.3.25-1.el7.ius.x86_64 php73-mysqlnd-7.3.25-1.el7.ius.x86_64 php73-xml-7.3.25-1.el7.ius.x86_64 php73-opcache-7.3.25-1.el7.ius.x86_64 php73-fpm-httpd-7.3.25-1.el7.ius.noarch php73-common-7.3.25-1.el7.ius.x86_64 php73-fpm-nginx-7.3.25-1.el7.ius.noarch php73-cli-7.3.25-1.el7.ius.x86_64 php73-bcmath-7.3.25-1.el7.ius.x86_64 # rpm -qa | grep httpd httpd24u-2.4.46-1.el7.ius.x86_64 httpd24u-tools-2.4.46-1.el7.ius.x86_64 httpd24u-filesystem-2.4.46-1.el7.ius.noarch php73-fpm-httpd-7.3.25-1.el7.ius.noarch # cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core) I have placed the below file in /var/www/html directory. #cat info.php <?php phpinfo( ); ?> # I am seeing this in the logs ==> access_log <=192.168.0.95 - - [06/Jan/2021:21:42:21 +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" When I invoke it from the browser Apache shows PHP code instead of executing it. Please let me know if you need any additional information. Thanks in Advance. Best Regards, Kaushal
Christopher Wensink
2021-Jan-06 16:16 UTC
[CentOS] Apache shows PHP code instead of executing it
Does the file have execute permissions, what is the file's permissions and is it owned by the user running apache? Chris On 1/6/2021 10:13 AM, Kaushal Shriyan wrote:> Hi, > > I am running the below php, httpd and CentOS Linux version. > > # rpm -qa | grep php > php73-mbstring-7.3.25-1.el7.ius.x86_64 > php73-json-7.3.25-1.el7.ius.x86_64 > php73-fpm-7.3.25-1.el7.ius.x86_64 > php73-pdo-7.3.25-1.el7.ius.x86_64 > php73-gd-7.3.25-1.el7.ius.x86_64 > php73-mysqlnd-7.3.25-1.el7.ius.x86_64 > php73-xml-7.3.25-1.el7.ius.x86_64 > php73-opcache-7.3.25-1.el7.ius.x86_64 > php73-fpm-httpd-7.3.25-1.el7.ius.noarch > php73-common-7.3.25-1.el7.ius.x86_64 > php73-fpm-nginx-7.3.25-1.el7.ius.noarch > php73-cli-7.3.25-1.el7.ius.x86_64 > php73-bcmath-7.3.25-1.el7.ius.x86_64 > > # rpm -qa | grep httpd > httpd24u-2.4.46-1.el7.ius.x86_64 > httpd24u-tools-2.4.46-1.el7.ius.x86_64 > httpd24u-filesystem-2.4.46-1.el7.ius.noarch > php73-fpm-httpd-7.3.25-1.el7.ius.noarch > > # cat /etc/redhat-release > CentOS Linux release 7.9.2009 (Core) > > I have placed the below file in /var/www/html directory. > > #cat info.php > <?php > > phpinfo( ); > > ?> > # > > I am seeing this in the logs > > ==> access_log <=> 192.168.0.95 - - [06/Jan/2021:21:42:21 +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" > > When I invoke it from the browser Apache shows PHP code instead of > executing it. Please let me know if you need any additional information. > Thanks in Advance. > > Best Regards, > > Kaushal > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos-- Christopher Wensink IS Administrator Five Star Plastics, Inc 1339 Continental Drive Eau Claire, WI 54701 Office: 715-831-1682 Mobile: 715-563-3112 Fax: 715-831-6075 cwensink at five-star-plastics.com www.five-star-plastics.com
Am 06.01.21 um 17:13 schrieb Kaushal Shriyan:> Hi, > > I am running the below php, httpd and CentOS Linux version. > > # rpm -qa | grep php > php73-mbstring-7.3.25-1.el7.ius.x86_64 > php73-json-7.3.25-1.el7.ius.x86_64 > php73-fpm-7.3.25-1.el7.ius.x86_64 > php73-pdo-7.3.25-1.el7.ius.x86_64 > php73-gd-7.3.25-1.el7.ius.x86_64 > php73-mysqlnd-7.3.25-1.el7.ius.x86_64 > php73-xml-7.3.25-1.el7.ius.x86_64 > php73-opcache-7.3.25-1.el7.ius.x86_64 > php73-fpm-httpd-7.3.25-1.el7.ius.noarch > php73-common-7.3.25-1.el7.ius.x86_64 > php73-fpm-nginx-7.3.25-1.el7.ius.noarch > php73-cli-7.3.25-1.el7.ius.x86_64 > php73-bcmath-7.3.25-1.el7.ius.x86_64 > > # rpm -qa | grep httpd > httpd24u-2.4.46-1.el7.ius.x86_64 > httpd24u-tools-2.4.46-1.el7.ius.x86_64 > httpd24u-filesystem-2.4.46-1.el7.ius.noarch > php73-fpm-httpd-7.3.25-1.el7.ius.noarch > > # cat /etc/redhat-release > CentOS Linux release 7.9.2009 (Core)The above packages are not from CentOS repositories. Maybe its more effective to use the mailing list of the corresponding repo? -- Leon