MESSAGE
DATE | 2021-01-06 |
FROM | dino@tuxweb.it
|
SUBJECT | Re: [Hangout - NYLXS] [users@httpd] Apache shows PHP code instead
|
From hangout-bounces-at-nylxs.com Wed Jan 6 20:56:03 2021 Return-Path: X-Original-To: archive-at-mrbrklyn.com Delivered-To: archive-at-mrbrklyn.com Received: from www2.mrbrklyn.com (www2.mrbrklyn.com [96.57.23.82]) by mrbrklyn.com (Postfix) with ESMTP id 4ED2E163FD0; Wed, 6 Jan 2021 20:56:03 -0500 (EST) X-Original-To: hangout-at-nylxs.com Delivered-To: hangout-at-nylxs.com Received: from mailbackend.panix.com (mailbackend.panix.com [166.84.1.89]) by mrbrklyn.com (Postfix) with ESMTP id 2142C163FB7 for ; Wed, 6 Jan 2021 20:55:46 -0500 (EST) Received: from panix2.panix.com (panix2.panix.com [166.84.1.2]) by mailbackend.panix.com (Postfix) with ESMTP id 4DB8TF4N1bz1lLJ for ; Wed, 6 Jan 2021 20:55:45 -0500 (EST) Received: by panix2.panix.com (Postfix, from userid 20529) id 4DB8TF3zxzz1ZWJ; Wed, 6 Jan 2021 20:55:45 -0500 (EST) Resent-From: Ruben Safir Resent-Date: Wed, 6 Jan 2021 20:55:45 -0500 Resent-Message-ID: <20210107015545.GD16120-at-panix.com> Resent-To: hangout-at-nylxs.com X-Spam-Checker-Version: SpamAssassin 3.4.3 (2019-12-06) on mailcrunch1.panix.com X-Spam-Level: X-Spam-Status: No, score=-2.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.3 X-Spam-Relay-Country: UA US UA ** IN XX ** ** IT X-Original-To: mrbrklyn-at-panix.com Delivered-To: mrbrklyn-at-panix.com Received: from mail2.panix.com (mail2.panix.com [166.84.1.73]) by mailbackend.panix.com (Postfix) with ESMTP id 4DB1yQ4RzRz1QtS for ; Wed, 6 Jan 2021 16:02:06 -0500 (EST) Received: from mxout1-he-de.apache.org (mxout1-he-de.apache.org [95.216.194.37]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by mail2.panix.com (Postfix) with ESMTPS id 4DB1yQ3M0VzwrG for ; Wed, 6 Jan 2021 16:02:06 -0500 (EST) Received: from mail.apache.org (mailroute1-lw-us.apache.org [207.244.88.153]) by mxout1-he-de.apache.org (ASF Mail Server at mxout1-he-de.apache.org) with SMTP id 618A264769 for ; Wed, 6 Jan 2021 21:01:56 +0000 (UTC) Received: (qmail 7781 invoked by uid 500); 6 Jan 2021 21:01:50 -0000 Mailing-List: contact users-help-at-httpd.apache.org; run by ezmlm Precedence: bulk Delivered-To: mailing list users-at-httpd.apache.org Received: (qmail 7766 invoked by uid 99); 6 Jan 2021 21:01:50 -0000 Received: from spamproc1-he-fi.apache.org (HELO spamproc1-he-fi.apache.org) (95.217.134.168) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Jan 2021 21:01:50 +0000 Received: from localhost (localhost [127.0.0.1]) by spamproc1-he-fi.apache.org (ASF Mail Server at spamproc1-he-fi.apache.org) with ESMTP id 6A51AC0493 for ; Wed, 6 Jan 2021 21:01:49 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamproc1-he-fi.apache.org Authentication-Results: spamproc1-he-fi.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=tuxweb.it Received: from mx1-he-de.apache.org ([116.203.227.195]) by localhost (spamproc1-he-fi.apache.org [95.217.134.168]) (amavisd-new, port 10024) with ESMTP id cbm_KCiGYGb7 for ; Wed, 6 Jan 2021 21:01:44 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a01:4f8:241:95::62; helo=mx.tuxweb.it; envelope-from=prvs=0640434d01=dino-at-tuxweb.it; receiver= Received: from mx.tuxweb.it (mx.tuxweb.it [IPv6:2a01:4f8:241:95::62]) by mx1-he-de.apache.org (ASF Mail Server at mx1-he-de.apache.org) with ESMTPS id A79397FBDE for ; Wed, 6 Jan 2021 21:01:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxweb.it; s=mx3; h=References:In-Reply-To:To:Subject:Message-ID:From:Content-Type:Date :MIME-Version:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=uR7XiOuMF3Zc2Y/3SREs/EUuyya/OHVNRO6Q74ecjMI=; b=GCi8XmsjXDVObfSon2lmvqnDdV 0MgTWg+OdPjZi1cYHF0BfZi7bzA9Y6GqIR0vc+n20IGdevmlZluf78m4iNiWnpqZ8IJedVwNFelps JwGCTPA/is4uX8ztJjHEQE9J9nzGKKDiX4xQRbOtIj2ixRNbvm9kxoWD1Ew0LQrtcRM5tG0IugH9i L+I4sDnEz/v1d0lSPZ8+iP6yzXIwuT9SHR39JyQLehd5XiJzXSENWjDIA2VgM+TWi5oYuAf/xTf3X W7XokHBOW02M1jVlOV6b5+hDOrT/KBISPOJ9SwxshA3dL2f+8pBvRXMEkDiOcfytHn2dL4gwTVIJk yEWcznoA==; Authentication-Results: localhost; iprev=fail smtp.remote-ip=192.168.0.202; spf=fail smtp.mailfrom=tuxweb.it; dmarc=none header.from=tuxweb.it Received: from [192.168.0.202] (helo=mail.tuxweb.it) by mx.tuxweb.it stage1 with esmtps (Exim MailCleaner) id 1kxFw0-002U7d-EH for from ; Wed, 06 Jan 2021 22:01:38 +0100 Received: from mail.tuxweb.it ([::ffff:127.0.0.1]) (AUTH: LOGIN dino) by mail.tuxweb.it with ESMTPA; Wed, 06 Jan 2021 22:01:37 +0100 id 0000000000180219.000000005FF62531.000379DD X-MailCleaner-return_path: dino-at-tuxweb.it X-MailCleaner-sender_address: dino-at-tuxweb.it X-MailCleaner-recipients: users-at-httpd.apache.org X-MailCleaner-SPF: whitelisted (was fail) MIME-Version: 1.0 Date: Wed, 06 Jan 2021 21:01:25 +0000 X-Mailer: RainLoop/1.14.0 From: dino-at-tuxweb.it Message-ID: <243c937309de0b10b83d228c732f9aa3-at-tuxweb.it> To: users-at-httpd.apache.org In-Reply-To: References: <3f6a0a26-21a8-2bf7-94c7-a8e85d2ee372-at-panix.com> X-Originating-IP: 77.39.164.142 X-MailCleaner-TrustedIPs: Ok X-MailCleaner-RDNS: invalid reverse DNS for 192.168.0.202 Subject: Re: [Hangout - NYLXS] [users-at-httpd] Apache shows PHP code instead of executing it X-BeenThere: hangout-at-nylxs.com X-Mailman-Version: 2.1.30rc1 List-Id: NYLXS Tech Talk and Politics List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: users-at-httpd.apache.org Content-Type: multipart/mixed; boundary="===============1433892544==" Errors-To: hangout-bounces-at-nylxs.com Sender: "Hangout"
--===============1433892544== Content-Type: multipart/alternative; boundary="--=_RainLoop_178_901695381.1609966885"
----=_RainLoop_178_901695381.1609966885 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable
> When I invoke it from the browser Apache shows PHP code instead of=0A> = executing it. Please let me know if you need any additional information.= =0A> Thanks in Advance=0AThis is because you did not tell apache to forwa= rd incoming HTTP requests to the PHP Engine.=0AYou can integrate Apache h= ttpd with PHP in different ways, generally they are PHP-FPM (through fast= cgi), mod_php (apache SAPI module) and CGI (discouraged because is very s= low and does not scale well).=0A=0ASince you've installed the package php= 73-fpm-httpd-7.3.25-1.el7.ius.noarch I think you would like to use PHP-FP= M.=0ANow, there are also different ways to integrate Apache httpd with PH= P-FPM. Personally I like to use mod_proxy_fcgi.so or mod_fastcgi.so.=0A= =0ABTW, I'll try to point you to the right direction with mod_proxy_fcgi:= =0A=0A1: you need to configure PHP-FPM to listen to a local unix socket (= eg: /run/php/php7.3-fpm.sock), also configure the other PHP-FPM and php.i= ni parameters and permissions and start your PHP-FPM process=0A=0A2: tell= Apache httpd to send right incoming requests (those ending with .php for= example) to PHP-FPM. One way is something like this:=0A# ...=0ALoadModul= e proxy_module modules/mod_proxy.so=0ALoadModule proxy_fcgi_module module= s/mod_proxy_fcgi.so=0A=0AListen *:80=0A=0AServerName yo= urservername=0AErrorLog logs/your-error_log=0ACustomLog logs/your-access_= log common=0ALogLevel warn=0A=0A# Use local php-fpm process=0Aroxy_fcgi_module>=0A# Enable http authorization headers=0Avif_module>=0ASetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=3D= $1=0A=0A=0A=0ASetHandler = "proxy:unix:/run/php/php7.3-fpm.sock|fcgi://localhost"=0A=0A= =0A# Deny access to raw php sources by default=0A#= To re-enable it's recommended to enable access to the files=0A# only in = specific virtual host or directory=0ARequire all denied=0A= =0A# Deny access to files without filename (e.g. '.php')=0A.ph(p[3457]?|t|tml|ps)$">=0ARequire all denied=0A=0Ale>=0A=0ADocumentRoot /your/docroot=0A=0AOptions= +FollowSymlinks -Includes=0ADirectoryIndex index.php=0AAllowOverride All= =0ARequire all granted=0A=0A=0A=0A# ...=0A3: ch= eck all your paths and permissions=0A=0A4: if you would like to send any = incoming request to PHP-FPM (for ex. in case your application make use of= a controller), you would add a .htaccess file that contains something li= ke this into your application docroot (and enable mod_rewrite in httpd.co= nf). This way, any incoming request that is not a valid resolvable file o= r directory will be forwarded to index.php (that resolve to PHP-FPM due t= o the config you set at item 2):=0A=0A#----------------------------------= ---------------------------------------------------------------=0AOptions= +FollowSymLinks=0ARewriteEngine On=0ARewriteCond %{REQUEST_FILENAME} !-f= =0ARewriteCond %{REQUEST_FILENAME} !-d=0ARewriteRule ^ index.php [QSA,L]= =0A# Let PHP having access to Authorization: Bearer header=0ARewriteRule = .* - [env=3DHTTP_AUTHORIZATION:%{HTTP:Authorization}]=0A#----------------= -------------------------------------------------------------------------= --------=0AHTH.=0ACiao, Dino.
----=_RainLoop_178_901695381.1609966885 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
ext/html; charset=3Dutf-8" />per=3D"true" style=3D"font-family: arial, sans-serif; font-size: 13px;"><= div> iv>v>rder-left: 1px solid rgb(204,204,204);padding-left: 1ex">> When I invo= ke it from the browser Apache shows PHP code instead of > executing= it. Please let me know if you need any additional information. > T= hanks in Advance This is because you did not tell apac= he to forward incoming HTTP requests to the PHP Engine. You can integr= ate Apache httpd with PHP in different ways, generally they are PHP-FPM (= through fastcgi), mod_php (apache SAPI module) and CGI (discouraged becau= se is very slow and does not scale well).
Since you've installed t= he package php73-fpm-httpd-7.3.25-1.el7.ius.noarch I think you would like= to use PHP-FPM. Now, there are also different ways to integrate Apach= e httpd with PHP-FPM. Personally I like to use mod_proxy_fcgi.so or mod_f= astcgi.so.
BTW, I'll try to point you to the right direction with = mod_proxy_fcgi:
1: you need to configure PHP-FPM to listen to a lo= cal unix socket (eg: /run/php/php7.3-fpm.sock), also configure the other = PHP-FPM and php.ini parameters and permissions and start your PHP-FPM pro= cess
2: tell Apache httpd to send right incoming requests (those e= nding with .php for example) to PHP-FPM. One way is something like this:<= /p>
# ... LoadModule proxy_module modules/mod_pro= xy.so LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so Li= sten *:80 <VirtualHost *:80> ServerName yourservername Err= orLog logs/your-error_log CustomLog logs/your-access_log common Log= Level warn # Use local php-fpm process <IfModule proxy_fcgi_= module> # Enable http authorization headers <IfModule setenvi= f_module> SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION= =3D$1 </IfModule> <FilesMatch ".+\.ph(p[3457]?|t|tml)$= "> SetHandler "proxy:unix:/run/php/php7.3-fpm.sock|fcgi://localhost= " </FilesMatch> <FilesMatch ".+\.phps$"> # Deny acce= ss to raw php sources by default # To re-enable it's recommended to en= able access to the files # only in specific virtual host or directory<= br>Require all denied </FilesMatch> # Deny access to files wi= thout filename (e.g. '.php') <FilesMatch "^\.ph(p[3457]?|t|tml|ps)$= "> Require all denied </FilesMatch> </IfModule> r> DocumentRoot /your/docroot <Directory /your/docroot> Op= tions +FollowSymlinks -Includes DirectoryIndex index.php AllowOverr= ide All Require all granted </Directory>
</VirtualH= ost> # ...
3: check all your path= s and permissions
4: if you would like to send any incoming reques= t to PHP-FPM (for ex. in case your application make use of a controller),= you would add a .htaccess file that contains something like this into yo= ur application docroot (and enable mod_rewrite in httpd.conf). This way, = any incoming request that is not a valid resolvable file or directory wil= l be forwarded to index.php (that resolve to PHP-FPM due to the config yo= u set at item 2):
#-----------------------------------------------= -------------------------------------------------- Options +FollowSymL= inks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f Rewrit= eCond %{REQUEST_FILENAME} !-d RewriteRule ^ index.php [QSA,L] # Let= PHP having access to Authorization: Bearer header RewriteRule .* - [e= nv=3DHTTP_AUTHORIZATION:%{HTTP:Authorization}] #----------------------= -------------------------------------------------------------------------= --
HTH. Ciao, Dino. v>
----=_RainLoop_178_901695381.1609966885--
--===============1433892544== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline
_______________________________________________ Hangout mailing list Hangout-at-nylxs.com http://lists.mrbrklyn.com/mailman/listinfo/hangout
--===============1433892544==--
--===============1433892544== Content-Type: multipart/alternative; boundary="--=_RainLoop_178_901695381.1609966885"
----=_RainLoop_178_901695381.1609966885 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable
> When I invoke it from the browser Apache shows PHP code instead of=0A> = executing it. Please let me know if you need any additional information.= =0A> Thanks in Advance=0AThis is because you did not tell apache to forwa= rd incoming HTTP requests to the PHP Engine.=0AYou can integrate Apache h= ttpd with PHP in different ways, generally they are PHP-FPM (through fast= cgi), mod_php (apache SAPI module) and CGI (discouraged because is very s= low and does not scale well).=0A=0ASince you've installed the package php= 73-fpm-httpd-7.3.25-1.el7.ius.noarch I think you would like to use PHP-FP= M.=0ANow, there are also different ways to integrate Apache httpd with PH= P-FPM. Personally I like to use mod_proxy_fcgi.so or mod_fastcgi.so.=0A= =0ABTW, I'll try to point you to the right direction with mod_proxy_fcgi:= =0A=0A1: you need to configure PHP-FPM to listen to a local unix socket (= eg: /run/php/php7.3-fpm.sock), also configure the other PHP-FPM and php.i= ni parameters and permissions and start your PHP-FPM process=0A=0A2: tell= Apache httpd to send right incoming requests (those ending with .php for= example) to PHP-FPM. One way is something like this:=0A# ...=0ALoadModul= e proxy_module modules/mod_proxy.so=0ALoadModule proxy_fcgi_module module= s/mod_proxy_fcgi.so=0A=0AListen *:80=0A=0AServerName yo= urservername=0AErrorLog logs/your-error_log=0ACustomLog logs/your-access_= log common=0ALogLevel warn=0A=0A# Use local php-fpm process=0Aroxy_fcgi_module>=0A# Enable http authorization headers=0Avif_module>=0ASetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=3D= $1=0A=0A=0A=0ASetHandler = "proxy:unix:/run/php/php7.3-fpm.sock|fcgi://localhost"=0A=0A= =0A# Deny access to raw php sources by default=0A#= To re-enable it's recommended to enable access to the files=0A# only in = specific virtual host or directory=0ARequire all denied=0A= =0A# Deny access to files without filename (e.g. '.php')=0A.ph(p[3457]?|t|tml|ps)$">=0ARequire all denied=0A=0Ale>=0A=0ADocumentRoot /your/docroot=0A=0AOptions= +FollowSymlinks -Includes=0ADirectoryIndex index.php=0AAllowOverride All= =0ARequire all granted=0A=0A=0A=0A# ...=0A3: ch= eck all your paths and permissions=0A=0A4: if you would like to send any = incoming request to PHP-FPM (for ex. in case your application make use of= a controller), you would add a .htaccess file that contains something li= ke this into your application docroot (and enable mod_rewrite in httpd.co= nf). This way, any incoming request that is not a valid resolvable file o= r directory will be forwarded to index.php (that resolve to PHP-FPM due t= o the config you set at item 2):=0A=0A#----------------------------------= ---------------------------------------------------------------=0AOptions= +FollowSymLinks=0ARewriteEngine On=0ARewriteCond %{REQUEST_FILENAME} !-f= =0ARewriteCond %{REQUEST_FILENAME} !-d=0ARewriteRule ^ index.php [QSA,L]= =0A# Let PHP having access to Authorization: Bearer header=0ARewriteRule = .* - [env=3DHTTP_AUTHORIZATION:%{HTTP:Authorization}]=0A#----------------= -------------------------------------------------------------------------= --------=0AHTH.=0ACiao, Dino.
----=_RainLoop_178_901695381.1609966885 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
ext/html; charset=3Dutf-8" />per=3D"true" style=3D"font-family: arial, sans-serif; font-size: 13px;"><= div> iv>v>rder-left: 1px solid rgb(204,204,204);padding-left: 1ex">> When I invo= ke it from the browser Apache shows PHP code instead of > executing= it. Please let me know if you need any additional information. > T= hanks in Advance This is because you did not tell apac= he to forward incoming HTTP requests to the PHP Engine. You can integr= ate Apache httpd with PHP in different ways, generally they are PHP-FPM (= through fastcgi), mod_php (apache SAPI module) and CGI (discouraged becau= se is very slow and does not scale well).
Since you've installed t= he package php73-fpm-httpd-7.3.25-1.el7.ius.noarch I think you would like= to use PHP-FPM. Now, there are also different ways to integrate Apach= e httpd with PHP-FPM. Personally I like to use mod_proxy_fcgi.so or mod_f= astcgi.so.
BTW, I'll try to point you to the right direction with = mod_proxy_fcgi:
1: you need to configure PHP-FPM to listen to a lo= cal unix socket (eg: /run/php/php7.3-fpm.sock), also configure the other = PHP-FPM and php.ini parameters and permissions and start your PHP-FPM pro= cess
2: tell Apache httpd to send right incoming requests (those e= nding with .php for example) to PHP-FPM. One way is something like this:<= /p>
# ... LoadModule proxy_module modules/mod_pro= xy.so LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so Li= sten *:80 <VirtualHost *:80> ServerName yourservername Err= orLog logs/your-error_log CustomLog logs/your-access_log common Log= Level warn # Use local php-fpm process <IfModule proxy_fcgi_= module> # Enable http authorization headers <IfModule setenvi= f_module> SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION= =3D$1 </IfModule> <FilesMatch ".+\.ph(p[3457]?|t|tml)$= "> SetHandler "proxy:unix:/run/php/php7.3-fpm.sock|fcgi://localhost= " </FilesMatch> <FilesMatch ".+\.phps$"> # Deny acce= ss to raw php sources by default # To re-enable it's recommended to en= able access to the files # only in specific virtual host or directory<= br>Require all denied </FilesMatch> # Deny access to files wi= thout filename (e.g. '.php') <FilesMatch "^\.ph(p[3457]?|t|tml|ps)$= "> Require all denied </FilesMatch> </IfModule> r> DocumentRoot /your/docroot <Directory /your/docroot> Op= tions +FollowSymlinks -Includes DirectoryIndex index.php AllowOverr= ide All Require all granted </Directory>
</VirtualH= ost> # ...
3: check all your path= s and permissions
4: if you would like to send any incoming reques= t to PHP-FPM (for ex. in case your application make use of a controller),= you would add a .htaccess file that contains something like this into yo= ur application docroot (and enable mod_rewrite in httpd.conf). This way, = any incoming request that is not a valid resolvable file or directory wil= l be forwarded to index.php (that resolve to PHP-FPM due to the config yo= u set at item 2):
#-----------------------------------------------= -------------------------------------------------- Options +FollowSymL= inks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f Rewrit= eCond %{REQUEST_FILENAME} !-d RewriteRule ^ index.php [QSA,L] # Let= PHP having access to Authorization: Bearer header RewriteRule .* - [e= nv=3DHTTP_AUTHORIZATION:%{HTTP:Authorization}] #----------------------= -------------------------------------------------------------------------= --
HTH. Ciao, Dino. v>
----=_RainLoop_178_901695381.1609966885--
--===============1433892544== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline
_______________________________________________ Hangout mailing list Hangout-at-nylxs.com http://lists.mrbrklyn.com/mailman/listinfo/hangout
--===============1433892544==--
|
|