Re: [users@httpd] Apache shows PHP code instead of executing it

2021-01-06 Thread Ruben Safir
On Wed, Jan 06, 2021 at 08:45:50PM -0500, Eric Covener wrote:
> On Wed, Jan 6, 2021 at 6:31 PM Ruben Safir  wrote:
> >
> > On 1/6/21 4:01 PM, d...@tuxweb.it wrote:
> > >
> > > This is because you did not tell apache to forward incoming HTTP
> > > requests to the PHP Engine.
> > > You can integrate Apache httpd with PHP in different ways, generally
> > > they are PHP-FPM (through fastcgi), mod_php (apache SAPI module) and CGI
> > > (discouraged because is very slow and does not scale well).
> >
> > Umm - use mod_php.  I know that the PHP website docs suggest otherwise,
> > but they are wrong.  It is the only way to integrate PHP into apache.
> > It might use more memory.  That is fine.  Memory is cheap.
> >
> > if you use Linux there is no problems and frankly threads and processes
> > both share light weight processes
> >
> > http://httpd.apache.org/docs/current/mpm.html
> > https://tldp.org/FAQ/Threads-FAQ/Types.html
> > https://www.kernel.org/doc/ols/2002/ols2002-pages-330-337.pdf
> > https://www.php.net/manual/en/faq.installation.php#faq.installation.apache2
> > https://www.php.net/manual/en/install.unix.apache2.php
> >
> >
> > Packing the PHP instance in a threaded fastcgi process is exactly what
> > you don't want.  Integrating it into the Apache runtime prevents needing
> > to create an entire clone call and all subsequent fork() calls,
> 
> Caveat: The above is not the conventional wisdom at all and
> misrepresents the tradeoffs.
> 


Who knows, maybe he can read for himself.  For almost 30 years we've
dealt with this.  I'm sorry, but fastcgi sucks.  It sucked in 1995, and
it is still sucks.  I mean it beats CGI and its better an nothing on
Windows for some time, but that is it.

unless you have something really short you have to do.  compiling mod_php
directly into apache allows you to not have to run an external module or
program, which is a smaller finger print, and allows you to use apache
memormy managment directly.

Not only that, but you can cache results, which is a major advantage.

Regardless of the snippiness, I ACTUALLY posted the documentation with
the recomemdnations so he could read them for himself...you education,
so he could make up his mind.

> -
> To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
> For additional commands, e-mail: users-h...@httpd.apache.org
> 

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] Apache shows PHP code instead of executing it

2021-01-06 Thread Eric Covener
On Wed, Jan 6, 2021 at 6:31 PM Ruben Safir  wrote:
>
> On 1/6/21 4:01 PM, d...@tuxweb.it wrote:
> >
> > This is because you did not tell apache to forward incoming HTTP
> > requests to the PHP Engine.
> > You can integrate Apache httpd with PHP in different ways, generally
> > they are PHP-FPM (through fastcgi), mod_php (apache SAPI module) and CGI
> > (discouraged because is very slow and does not scale well).
>
> Umm - use mod_php.  I know that the PHP website docs suggest otherwise,
> but they are wrong.  It is the only way to integrate PHP into apache.
> It might use more memory.  That is fine.  Memory is cheap.
>
> if you use Linux there is no problems and frankly threads and processes
> both share light weight processes
>
> http://httpd.apache.org/docs/current/mpm.html
> https://tldp.org/FAQ/Threads-FAQ/Types.html
> https://www.kernel.org/doc/ols/2002/ols2002-pages-330-337.pdf
> https://www.php.net/manual/en/faq.installation.php#faq.installation.apache2
> https://www.php.net/manual/en/install.unix.apache2.php
>
>
> Packing the PHP instance in a threaded fastcgi process is exactly what
> you don't want.  Integrating it into the Apache runtime prevents needing
> to create an entire clone call and all subsequent fork() calls,

Caveat: The above is not the conventional wisdom at all and
misrepresents the tradeoffs.

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] Apache shows PHP code instead of executing it

2021-01-06 Thread Ruben Safir
On 1/6/21 4:01 PM, d...@tuxweb.it wrote:
> 
> This is because you did not tell apache to forward incoming HTTP
> requests to the PHP Engine.
> You can integrate Apache httpd with PHP in different ways, generally
> they are PHP-FPM (through fastcgi), mod_php (apache SAPI module) and CGI
> (discouraged because is very slow and does not scale well).

Umm - use mod_php.  I know that the PHP website docs suggest otherwise,
but they are wrong.  It is the only way to integrate PHP into apache.
It might use more memory.  That is fine.  Memory is cheap.

if you use Linux there is no problems and frankly threads and processes
both share light weight processes

http://httpd.apache.org/docs/current/mpm.html
https://tldp.org/FAQ/Threads-FAQ/Types.html
https://www.kernel.org/doc/ols/2002/ols2002-pages-330-337.pdf
https://www.php.net/manual/en/faq.installation.php#faq.installation.apache2
https://www.php.net/manual/en/install.unix.apache2.php


Packing the PHP instance in a threaded fastcgi process is exactly what
you don't want.  Integrating it into the Apache runtime prevents needing
to create an entire clone call and all subsequent fork() calls,
-- 
So many immigrant groups have swept through our town
that Brooklyn, like Atlantis, reaches mythological
proportions in the mind of the world - RI Safir 1998
http://www.mrbrklyn.com

DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
http://www.nylxs.com - Leadership Development in Free Software
http://www2.mrbrklyn.com/resources - Unpublished Archive
http://www.coinhangout.com - coins!
http://www.brooklyn-living.com

Being so tracked is for FARM ANIMALS and extermination camps,
but incompatible with living as a free human being. -RI Safir 2013

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] Opening Web Interface

2021-01-06 Thread Tatsuki Makino
Brandon Helsley wrote on 2021/01/06 10:02:
> I'm trying to open the web interface for poudriere on FreeBSD and have
> copied the sample configuration file into the includes directory. I haven't
> made any changes to this configuration file or the httpd.conf file yet. I'm
> not sure which directives I need to add or MPM's or modules to open the web
> interface for poudriere. Could someone assist me?
> 

I think the shortest steps for what you want to do are as follows:

make -C /usr/ports/ports-mgmt/poudriere/ install
make -C /usr/ports/www/apache24/ install
cp /usr/local/share/examples/poudriere/httpd.conf.sample 
/usr/local/etc/apache24/Includes/poudriere.conf
service apache24 onerestart
fetch -o - "http://localhost/poudriere/"; | less

The default MPM is prepork, but there will be other MPMs available: event and 
worker.
You can use it by toggling comment out of LoadModule in 
/usr/local/etc/apache24/httpd.conf.

Regards.


-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] Apache shows PHP code instead of executing it

2021-01-06 Thread dino
> 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
This is because you did not tell apache to forward incoming HTTP requests to 
the PHP Engine.
You can integrate Apache httpd with PHP in different ways, generally they are 
PHP-FPM (through fastcgi), mod_php (apache SAPI module) and CGI (discouraged 
because is very slow and does not scale well).

Since you've installed the 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 Apache httpd with PHP-FPM. 
Personally I like to use mod_proxy_fcgi.so or mod_fastcgi.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 local 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 process

2: tell Apache httpd to send right incoming requests (those ending with .php 
for example) to PHP-FPM. One way is something like this:
# ...
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so

Listen *:80

ServerName yourservername
ErrorLog logs/your-error_log
CustomLog logs/your-access_log common
LogLevel warn

# Use local php-fpm process

# Enable http authorization headers

SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1



SetHandler "proxy:unix:/run/php/php7.3-fpm.sock|fcgi://localhost"


# Deny access to raw php sources by default
# To re-enable it's recommended to enable access to the files
# only in specific virtual host or directory
Require all denied

# Deny access to files without filename (e.g. '.php')

Require all denied



DocumentRoot /your/docroot

Options +FollowSymlinks -Includes
DirectoryIndex index.php
AllowOverride All
Require all granted



# ...
3: check all your paths and permissions

4: 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 like this into your application docroot (and enable 
mod_rewrite in httpd.conf). This way, any incoming request that is not a valid 
resolvable file or directory will be forwarded to index.php (that resolve to 
PHP-FPM due to the config you set at item 2):

#-
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
# Let PHP having access to Authorization: Bearer header
RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#-
HTH.
Ciao, Dino.


Re: [users@httpd] Apache shows PHP code instead of executing it

2021-01-06 Thread Kaushal Shriyan
On Wed, Jan 6, 2021 at 9:54 PM Ruben Safir  wrote:

> On 1/6/21 11:09 AM, Kaushal Shriyan wrote:
> > 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
>
>
> trun it on and read the docs.  You need to turn it one from httpd.conf
> and assign it to a php enabled uri
>

Hi Ruben,

I have added the below in /etc/httpd/conf/httpd.conf. The issue still
persists.


SetHandler application/x-httpd-php


#apachectl -M | grep -i PHP does not return anything.

==> /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,


Re: [users@httpd] Apache shows PHP code instead of executing it

2021-01-06 Thread Ruben Safir
On 1/6/21 11:09 AM, Kaushal Shriyan wrote:
> 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


trun it on and read the docs.  You need to turn it one from httpd.conf
and assign it to a php enabled uri


-- 
So many immigrant groups have swept through our town
that Brooklyn, like Atlantis, reaches mythological
proportions in the mind of the world - RI Safir 1998
http://www.mrbrklyn.com

DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
http://www.nylxs.com - Leadership Development in Free Software
http://www2.mrbrklyn.com/resources - Unpublished Archive
http://www.coinhangout.com - coins!
http://www.brooklyn-living.com

Being so tracked is for FARM ANIMALS and extermination camps,
but incompatible with living as a free human being. -RI Safir 2013

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



[users@httpd] Apache shows PHP code instead of executing it

2021-01-06 Thread 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)

I have placed the below file in /var/www/html directory.

#cat info.php

#

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