Re: Re: httpd not interpreting a php file
| From: | Richard | Date: | Sat, 25 Oct 2014 07:23:11 +0000 |
| Subject: | Re: Re: httpd not interpreting a php file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-324006@lists.php.net to get a copy of this message | ||
------------ Original Message ------------
> Date: Saturday, October 25, 2014 08:01:00 +0100
> From: Tim Streater <tim@clothears.org.uk>
> To: Gergely Buday <gbuday@gmail.com>
> Cc: php-general@lists.php.net
> Subject: [PHP] Re: httpd not interpreting a php file
>
> On 25 Oct 2014 at 07:34, Gergely Buday <gbuday@gmail.com> wrote:
>
>>>> I did tests and my Apache does interpret simple php files.
>>>>
>>>> I copied a directory structure from a working web server and my
>>>> login.php is not interpreted. Apache emits some source code
>>>> from the file.
>>>
>>> Did you copy httpd.conf?
>>
>> I use the default httpd.conf as provided on centos 7 httpd
>> installation, modulo
>>
>> ProxyPassMatch ^/(.*\.php(/.*)?)$
>> fcgi://127.0.0.1:9000/var/www/html/$1
>> DirectoryIndex /index.php
>>
>> What do you mean by copying? From what place to where?
>
> Well you said you copied a directory structure. So I assume you
> are making a new installation, meaning you need to copy the
> httpd.conf file too.
>
> 1) As asked by francis, does your httpd.conf file have a statement
> like: AddType application/x-httpd-php .php
>
> 2) Does your httpd.conf file have a statement like: LoadModule
> php5_module /usr/libexec/apache2/libphp5.so (with the appropriate
> path)
>
> 3) Why do you not tell us your operating system and version of
> apache?
>
> --
> Cheers -- Tim
>
He indicated that he is using centos-7, in which case, the httpd
version should be httpd-2.4.6-18.
So, ... in the /etc/httpd/conf.d directory do you have a "php.conf"
file? There should be:
SetHandler application/x-httpd-php
AddType text/html .php
lines. Are they there, uncommented? Note that the "SetHandler" is
within a "<FilesMatch \.php$>" construct, so the extension on your
php files matters.
Additionally, do you have an /etc/httpd/conf.modules.d directory
that contains the file "10-php.conf"? If so, it should have the
"LoadModule php5_module modules/libphp5.so" line.
By the way, where is the line:
DirectoryIndex /index.php
That leading "/" is not the default construct.
- Richard