You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Xavier Lopez <za...@gmail.com> on 2011/06/16 07:57:10 UTC

[users@httpd] PHP Parsing Problem

Dear Users,

I'm still not getting Apache to parse PHP. I've learned a lot though,
here's what I know:

In apache2.conf, there are these lines:

Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf

When I run  ls /mods-enabled, I see php5.conf and php5.load, among others,
And when I run cat 'php5.load', I see LoadModule php5_module
/usr/lib/apache2/modules/libphp5.so.

Do these facts, taken together, not mean that PHP5 is installed,
available, and enabled?

Shouldn't Apache therefore parse PHP?

When I run apache2ctl -L. I don't see the string 'PHP' anywhere in the
output. Should I?

When I run a2enmod php5, it says it's already enabled.

This is my Virtual Host configuration:

<VirtualHost *:80>
        ServerName http://testing.dev
        ServerAdmin webmaster@localhost
        DocumentRoot /home/zave/Public/testing
        <FilesMatch "\.ph(p[2-6]?|tml)$">
           SetHandler application/x-httpd-php
        </FilesMatch>
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /home/zave/Public/testing>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>


Does anyone see what is preventing PHP from being parsed? I'm running
Apache 2.2.14/Ubuntu 10.04, LAMP Install. Thanks for your help thus
far.

-Xavier

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Re: [users@httpd] PHP Parsing Problem

Posted by za...@gmail.com.
Any php file that I try to open, including the one containing phpinfo(),  
which is called testphp.php in my case, causes Firefox to ask me what I  
want it to do with the file.

On , zeek <ze...@mogwai.ath.cx> wrote:




> Try the info.php test:




> phpinfo();

> ?>







> On Wed, Jun 15, 2011 at 10:57:10PM -0700, Xavier Lopez wrote:

> > Dear Users,

> >

> > I'm still not getting Apache to parse PHP. I've learned a lot though,

> > here's what I know:

> >

> > In apache2.conf, there are these lines:

> >

> > Include /etc/apache2/mods-enabled/*.load

> > Include /etc/apache2/mods-enabled/*.conf

> >

> > When I run ls /mods-enabled, I see php5.conf and php5.load, among  
> others,

> > And when I run cat 'php5.load', I see LoadModule php5_module

> > /usr/lib/apache2/modules/libphp5.so.

> >

> > Do these facts, taken together, not mean that PHP5 is installed,

> > available, and enabled?

> >

> > Shouldn't Apache therefore parse PHP?

> >

> > When I run apache2ctl -L. I don't see the string 'PHP' anywhere in the

> > output. Should I?

> >

> > When I run a2enmod php5, it says it's already enabled.

> >

> > This is my Virtual Host configuration:

> >

> >

> > ServerName http://testing.dev

> > ServerAdmin webmaster@localhost

> > DocumentRoot /home/zave/Public/testing

> >

> > SetHandler application/x-httpd-php

> >

> >

> > Options FollowSymLinks

> > AllowOverride None

> >

> >

> > Options Indexes FollowSymLinks MultiViews

> > AllowOverride None

> > Order allow,deny

> > allow from all

> >

> >

> > ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

> >

> > AllowOverride None

> > Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch

> > Order allow,deny

> > Allow from all

> >

> >

> >

> > Does anyone see what is preventing PHP from being parsed? I'm running

> > Apache 2.2.14/Ubuntu 10.04, LAMP Install. Thanks for your help thus

> > far.

> >

> > -Xavier

> >

> > ---------------------------------------------------------------------

> > The official User-To-User support forum of the Apache HTTP Server  
> Project.

> > See http://httpd.apache.org/userslist.html> for more info.

> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org

> > " from the digest: users-digest-unsubscribe@httpd.apache.org

> > For additional commands, e-mail: users-help@httpd.apache.org



> ---------------------------------------------------------------------

> The official User-To-User support forum of the Apache HTTP Server Project.

> See http://httpd.apache.org/userslist.html> for more info.

> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org

> " from the digest: users-digest-unsubscribe@httpd.apache.org

> For additional commands, e-mail: users-help@httpd.apache.org




Re: [users@httpd] PHP Parsing Problem

Posted by zeek <ze...@mogwai.ath.cx>.

Try the info.php test:

<?php
phpinfo();
?>



On Wed, Jun 15, 2011 at 10:57:10PM -0700, Xavier Lopez wrote:
> Dear Users,
> 
> I'm still not getting Apache to parse PHP. I've learned a lot though,
> here's what I know:
> 
> In apache2.conf, there are these lines:
> 
> Include /etc/apache2/mods-enabled/*.load
> Include /etc/apache2/mods-enabled/*.conf
> 
> When I run  ls /mods-enabled, I see php5.conf and php5.load, among others,
> And when I run cat 'php5.load', I see LoadModule php5_module
> /usr/lib/apache2/modules/libphp5.so.
> 
> Do these facts, taken together, not mean that PHP5 is installed,
> available, and enabled?
> 
> Shouldn't Apache therefore parse PHP?
> 
> When I run apache2ctl -L. I don't see the string 'PHP' anywhere in the
> output. Should I?
> 
> When I run a2enmod php5, it says it's already enabled.
> 
> This is my Virtual Host configuration:
> 
> <VirtualHost *:80>
>         ServerName http://testing.dev
>         ServerAdmin webmaster@localhost
>         DocumentRoot /home/zave/Public/testing
>         <FilesMatch "\.ph(p[2-6]?|tml)$">
>            SetHandler application/x-httpd-php
>         </FilesMatch>
>         <Directory />
>                 Options FollowSymLinks
>                 AllowOverride None
>         </Directory>
>         <Directory /home/zave/Public/testing>
>                 Options Indexes FollowSymLinks MultiViews
>                 AllowOverride None
>                 Order allow,deny
>                 allow from all
>         </Directory>
> 
>         ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
>         <Directory "/usr/lib/cgi-bin">
>                 AllowOverride None
>                 Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
>                 Order allow,deny
>                 Allow from all
>         </Directory>
> 
> 
> Does anyone see what is preventing PHP from being parsed? I'm running
> Apache 2.2.14/Ubuntu 10.04, LAMP Install. Thanks for your help thus
> far.
> 
> -Xavier
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] PHP Parsing Problem

Posted by Lester Caine <le...@lsces.co.uk>.
Xavier Lopez wrote:
> I'm still not getting Apache to parse PHP. I've learned a lot though,
> here's what I know:

Try asking on the PHP list ...

On SUSE, simply adding php via the packager manager also enables it in a stock 
apache installation. SO I suspect you had a working setup and have changed 
something.

My own vhosts.d entries all contain

      Include /etc/apache2/conf.d/*.conf
in the actual <VirtualHost *:80> element

and I have a php5.conf entry in the conf.d directory that has the handler bits 
on separate lines ....

---
<IfModule mod_php5.c>
         AddHandler application/x-httpd-php .php4
         AddHandler application/x-httpd-php .php5
         AddHandler application/x-httpd-php .php
         AddHandler application/x-httpd-php-source .php4s
         AddHandler application/x-httpd-php-source .php5s
         AddHandler application/x-httpd-php-source .phps
         DirectoryIndex index.php4
         DirectoryIndex index.php5
         DirectoryIndex index.php
</IfModule>
---

So I wonder if you have conflicting stuff now between the two locations

It is getting quite annoying just how differently each linux distribution 
handles this area. The current discussion on the PHP lists is what should we 
bundle with PHP, but most distributions simply decide that themselves. And have 
created their own way of enabling stuff in Apache and PHP :(

-- 
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: PHP Parsing Problem

Posted by Igor Galić <i....@brainsware.org>.

----- Original Message -----
> Hello Zavelopez,
> 
> * zavelopez@gmail.com wrote '[1]:
> 
> > 2. The contents of the php5.conf file are as follows:
> 
> > <IfModule mod_php5.c>
> >     <FilesMatch "\.ph(p3?|tml)$">
> >         SetHandler application/x-httpd-php
> >     </FilesMatch>
> >     <FilesMatch "\.phps$">
> >         SetHandler application/x-httpd-php-source
> >     </FilesMatch>
> >     # To re-enable php in user directories comment the following
> >     lines
> >     # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as
> >     it
> >     # prevents .htaccess files from disabling it.
> >     <IfModule mod_userdir.c>
> >         <Directory /home/*/public_html>
> >             php_admin_value engine Off
> >         </Directory>
> >     </IfModule>
> > </IfModule>
> 
> For me there is missing an entry for the file ending .php. So it
> won't
> get interpreted and Apache offers it as download.
> 
> In my configuration I noted the following and it works:
> 
> ,----- [ mods-available/php5.conf ]
> | <IfModule mod_php5.c>
> |   AddType application/x-httpd-php .php .aspx
> |   AddType application/x-httpd-php-source .phps
> | </IfModule>
> `-----

This configuration is actually wrong. Or at least it's very bad.

See this: http://www.devside.net/articles/php for a full
"explanation" of why that is the case. Note that the PHP
documentation has been fixed since then.

See also: http://wiki.apache.org/httpd/PHPDownload

http://wiki.apache.org/httpd/DebianPHP

> CMIIW.
> 
> --
> Greetz,
> Christoph
> 
> [1] ~ Message from: 16.06.2011 @ 17:13:02 +0000 GMT
> mid:bcaec520ecc3b1832f04a5d7617d@google.com

i

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: PHP Parsing Problem

Posted by Christoph Koch <ap...@il-is-valid.com>.
Hello Zavelopez,

* zavelopez@gmail.com wrote '[1]:

> 2. The contents of the php5.conf file are as follows:

> <IfModule mod_php5.c>
>     <FilesMatch "\.ph(p3?|tml)$">
>         SetHandler application/x-httpd-php
>     </FilesMatch>
>     <FilesMatch "\.phps$">
>         SetHandler application/x-httpd-php-source
>     </FilesMatch>
>     # To re-enable php in user directories comment the following lines
>     # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
>     # prevents .htaccess files from disabling it.
>     <IfModule mod_userdir.c>
>         <Directory /home/*/public_html>
>             php_admin_value engine Off
>         </Directory>
>     </IfModule>
> </IfModule>

For me there is missing an entry for the file ending .php. So it won't
get interpreted and Apache offers it as download.

In my configuration I noted the following and it works:

,----- [ mods-available/php5.conf ]
| <IfModule mod_php5.c>
|   AddType application/x-httpd-php .php .aspx
|   AddType application/x-httpd-php-source .phps
| </IfModule>
`-----

CMIIW.

-- 
Greetz,
Christoph

[1] ~ Message from: 16.06.2011 @ 17:13:02 +0000 GMT
mid:bcaec520ecc3b1832f04a5d7617d@google.com


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Re: [users@httpd] PHP Parsing Problem

Posted by za...@gmail.com.
Igor,
this is what apache2ctl -M outputs:
php5_module (shared)

On , Igor Galić <i....@brainsware.org> wrote:




> ----- Original Message -----

> > Igor,

> > 1. Firefox asks me what I want it to do with the file whenever I try

> > to open a php file.

> > 2. The contents of the php5.conf file are as follows:

> >

> >

> > SetHandler application/x-httpd-php

> >

> >

> > SetHandler application/x-httpd-php-source

> >

> > # To re-enable php in user directories comment the following lines

> > # (from to .) Do NOT set it to On as it

> > # prevents .htaccess files from disabling it.

> >

> >

> > php_admin_value engine Off

> >

> >

> >



> apache2ctl -M shows the PHP module loaded?





> > Thank you for your help.

> >

> > -Xavier



> i



> --

> Igor Galić



> Tel: +43 (0) 664 886 22 883

> Mail: i.galic@brainsware.org

> URL: http://brainsware.org/



> ---------------------------------------------------------------------

> The official User-To-User support forum of the Apache HTTP Server Project.

> See http://httpd.apache.org/userslist.html> for more info.

> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org

> " from the digest: users-digest-unsubscribe@httpd.apache.org

> For additional commands, e-mail: users-help@httpd.apache.org




Re: [users@httpd] PHP Parsing Problem

Posted by Igor Galić <i....@brainsware.org>.

----- Original Message -----
> Igor,
> 1. Firefox asks me what I want it to do with the file whenever I try
> to open a php file.
> 2. The contents of the php5.conf file are as follows:
> <IfModule mod_php5.c>
> <FilesMatch "\.ph(p3?|tml)$">
> SetHandler application/x-httpd-php
> </FilesMatch>
> <FilesMatch "\.phps$">
> SetHandler application/x-httpd-php-source
> </FilesMatch>
> # To re-enable php in user directories comment the following lines
> # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
> # prevents .htaccess files from disabling it.
> <IfModule mod_userdir.c>
> <Directory /home/*/public_html>
> php_admin_value engine Off
> </Directory>
> </IfModule>
> </IfModule>

apache2ctl -M shows the PHP module loaded?


> Thank you for your help.
> 
> -Xavier

i

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Re: [users@httpd] PHP Parsing Problem

Posted by za...@gmail.com.
Igor,
1. Firefox asks me what I want it to do with the file whenever I try to  
open a php file.
2. The contents of the php5.conf file are as follows:
<IfModule mod_php5.c>
<FilesMatch "\.ph(p3?|tml)$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
# To re-enable php in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
<IfModule mod_userdir.c>
<Directory /home/*/public_html>
php_admin_value engine Off
</Directory>
</IfModule>
</IfModule>

Thank you for your help.

-Xavier
On , Igor Galić <i....@brainsware.org> wrote:




> ----- Original Message -----

> > Dear Users,

> >

> > I'm still not getting Apache to parse PHP. I've learned a lot though,

> > here's what I know:

> >

> > In apache2.conf, there are these lines:

> >

> > Include /etc/apache2/mods-enabled/*.load

> > Include /etc/apache2/mods-enabled/*.conf

> >

> > When I run ls /mods-enabled, I see php5.conf and php5.load, among

> > others,

> > And when I run cat 'php5.load', I see LoadModule php5_module

> > /usr/lib/apache2/modules/libphp5.so.

> >

> > Do these facts, taken together, not mean that PHP5 is installed,

> > available, and enabled?

> >

> > Shouldn't Apache therefore parse PHP?

> >

> > When I run apache2ctl -L. I don't see the string 'PHP' anywhere in

> > the

> > output. Should I?

> >

> > When I run a2enmod php5, it says it's already enabled.

> >

> > This is my Virtual Host configuration:

> >

> >

> > ServerName http://testing.dev

> > ServerAdmin webmaster@localhost

> > DocumentRoot /home/zave/Public/testing

> >

> > SetHandler application/x-httpd-php

> >

> >

> > Options FollowSymLinks

> > AllowOverride None

> >

> >

> > Options Indexes FollowSymLinks MultiViews

> > AllowOverride None

> > Order allow,deny

> > allow from all

> >

> >

> > ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

> >

> > AllowOverride None

> > Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch

> > Order allow,deny

> > Allow from all

> >

> >

> >

> > Does anyone see what is preventing PHP from being parsed? I'm running

> > Apache 2.2.14/Ubuntu 10.04, LAMP Install. Thanks for your help thus

> > far.



> How, exactly, is the problem manifesting?



> What is the contents of the php5.conf file?



> > -Xavier



> i



> --

> Igor Galić



> Tel: +43 (0) 664 886 22 883

> Mail: i.galic@brainsware.org

> URL: http://brainsware.org/



> ---------------------------------------------------------------------

> The official User-To-User support forum of the Apache HTTP Server Project.

> See http://httpd.apache.org/userslist.html> for more info.

> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org

> " from the digest: users-digest-unsubscribe@httpd.apache.org

> For additional commands, e-mail: users-help@httpd.apache.org




Re: [users@httpd] PHP Parsing Problem

Posted by Igor Galić <i....@brainsware.org>.

----- Original Message -----
> Dear Users,
> 
> I'm still not getting Apache to parse PHP. I've learned a lot though,
> here's what I know:
> 
> In apache2.conf, there are these lines:
> 
> Include /etc/apache2/mods-enabled/*.load
> Include /etc/apache2/mods-enabled/*.conf
> 
> When I run  ls /mods-enabled, I see php5.conf and php5.load, among
> others,
> And when I run cat 'php5.load', I see LoadModule php5_module
> /usr/lib/apache2/modules/libphp5.so.
> 
> Do these facts, taken together, not mean that PHP5 is installed,
> available, and enabled?
> 
> Shouldn't Apache therefore parse PHP?
> 
> When I run apache2ctl -L. I don't see the string 'PHP' anywhere in
> the
> output. Should I?
> 
> When I run a2enmod php5, it says it's already enabled.
> 
> This is my Virtual Host configuration:
> 
> <VirtualHost *:80>
>         ServerName http://testing.dev
>         ServerAdmin webmaster@localhost
>         DocumentRoot /home/zave/Public/testing
>         <FilesMatch "\.ph(p[2-6]?|tml)$">
>            SetHandler application/x-httpd-php
>         </FilesMatch>
>         <Directory />
>                 Options FollowSymLinks
>                 AllowOverride None
>         </Directory>
>         <Directory /home/zave/Public/testing>
>                 Options Indexes FollowSymLinks MultiViews
>                 AllowOverride None
>                 Order allow,deny
>                 allow from all
>         </Directory>
> 
>         ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
>         <Directory "/usr/lib/cgi-bin">
>                 AllowOverride None
>                 Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
>                 Order allow,deny
>                 Allow from all
>         </Directory>
> 
> 
> Does anyone see what is preventing PHP from being parsed? I'm running
> Apache 2.2.14/Ubuntu 10.04, LAMP Install. Thanks for your help thus
> far.

How, exactly, is the problem manifesting?

What is the contents of the php5.conf file?

> -Xavier

i

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org