Re: .php3 files recognised but .php files not

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I would suggest removing "<IfModule mod_php7.c>" from your configuration.
It is possible mod_php7 is not actually loaded and you have some other part of your configuration that is setting the handler for .php files.
If you remove "<IfModule" and the module isn't loaded, you will get an error message instead of having HTTPD ignore the configuration.

"<IfModule" is sometimes considered a security risk. If it is critical that you have php code be processed instead of downloaded, you shouldn't let the server start if there is no php handler.

- Y

On Sun, Jun 10, 2018 at 3:57 PM Paul Gardiner <lists@xxxxxxxxxx> wrote:


On 10/06/2018 18:53, Michael A. Peters wrote:
> On 06/10/2018 06:04 AM, Paul Gardiner wrote:
>> I have just installed openSUSE Leap 15.0 on a server including Apache
>> 2.4.33 and php 7.2.5.
>>
>> If I attempt to access .php files, I'm offered them as downloads,
>> although renaming them to .php3 makes them work fine. I have this file
>> amongst my apache config
>>
>> conf.d/php7.conf
>>
>> <IfModule mod_php7.c>
>>        <FilesMatch "\.ph(p[345]?|tml)$">
>>            SetHandler application/x-httpd-php
>>        </FilesMatch>
>>        <FilesMatch "\.php[345]?s$">
>>            SetHandler application/x-httpd-php-source
>>        </FilesMatch>
>>         DirectoryIndex index.php4
>>         DirectoryIndex index.php5
>>         DirectoryIndex index.php
>> </IfModule>
>
> Just change it to
>
>
> <IfModule  mod_php7.c>
>    <FilesMatch \.php$>
>       SetHandler application/x-httpd-php
>    </FilesMatch>
>    <FilesMatch \.phps$>
>       SetHandler application/x-httpd-php-source
>    </FilesMatch>
>    DirectoryIndex index.php
> </IfModule>
>
> If you really need .php3 .php4 .php5 add them as separate FilesMatch
> directives.
>
> Lot of stuff in php3/4 is deprecated on php7 so scripts written for php
> that ancient are not likely to work unless they are very simple, and I
> don't recall .php5 ever being an extension ever officially being promoted.
>
> .php3 was because some servers had both php3 and php4 but I don't even
> recall .php4 being an officially endorsed extension, let alone .php5.

Thanks for the suggestion, but it still doesn't work: .php files are
still offered for download rather than being executed. Now that I've
made the change you suggested, .php3 files don't work either
unsurprisingly. There has to be something else in my configuration that
specifically stops .php files being executed but doesn't stop .php3. I
have no idea where to look.

Cheers,
        Paul.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux