You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by e-letter <in...@gmail.com> on 2010/08/15 17:56:51 UTC

[users@httpd] configure apache to parse php

Readers,

According to the php manual, apache should be configured to parse php, e.g.:

<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch

Apparently this should be part of the addtype directive. I don't
understand which file I am to edit and add the code shown above. Can
somebody help please?

---------------------------------------------------------------------
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] configure apache to parse php

Posted by Nick Kew <ni...@webthing.com>.
On 15 Aug 2010, at 16:56, e-letter wrote:

> Readers,
> 
> According to the php manual, apache should be configured to parse php, e.g.:
> 
> <FilesMatch \.php$>
>    SetHandler application/x-httpd-php
> </FilesMatch

That's one option, though AddHandler would be simpler.
> 
> Apparently this should be part of the addtype directive.

No.  AddType for handlers (like php) was a grotty hack needed in Apache 1.0.
It's been obsolete since AddHandler was introduced in Apache 1.1 (1996).
If you see it recommended, treat that as a warning sign about whatever
you're reading at the time.

> I don't
> understand which file I am to edit and add the code shown above. Can
> somebody help please?

See the docs from your package.  There's also a page about it at the
httpd wiki (follow links from httpd.apache.org).

-- 
Nick Kew
---------------------------------------------------------------------
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] configure apache to parse php

Posted by Nerius Landys <nl...@gmail.com>.
> According to the php manual, apache should be configured to parse php, e.g.:
>
> <FilesMatch \.php$>
>    SetHandler application/x-httpd-php
> </FilesMatch
>
> Apparently this should be part of the addtype directive. I don't
> understand which file I am to edit and add the code shown above. Can
> somebody help please?

In my opinion the preferred way to build PHP is with APACHE "Build
Apache module" set to on.

If you installed Apache from ports, you want to edit for example
/usr/local/etc/apache22/httpd.conf .
Relevant lines in httpd.conf that configure PHP are, if you are
configuring the Apache module.


LoadModule php5_module        libexec/apache22/libphp5.so

    DirectoryIndex index.html index.php
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
    php_value include_path .:/usr/local/share/pear:/some/dir/to/php_includes
    php_value display_errors On

---------------------------------------------------------------------
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