Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: .php3 files recognised but .php files not |
|
Author |
|
Glidos
Joined: 09 Jun 2018 Posts: 4 Location: UK, Oxford
|
Posted: Sat 09 Jun '18 18:27 Post subject: .php3 files recognised but .php files not |
|
|
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
Code: |
<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>
|
I tried adding an extra FilesMatch clause, matching precisely .php, just in case something has become broken with regular expression matching, but that didn't help.
Please can someone suggest a way to track down the problem? |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Sun 10 Jun '18 5:27 Post subject: |
|
|
<FilesMatch "\.php[345]?s$">
What's the 's' |
|
Back to top |
|
Glidos
Joined: 09 Jun 2018 Posts: 4 Location: UK, Oxford
|
Posted: Sun 10 Jun '18 15:01 Post subject: |
|
|
That clause is for displaying php source, I believe. It's the top clause that should match .php files and ensure they are interpreted.
I also added the clause <FilesMatch "\.php$">, but it didn't help. |
|
Back to top |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1266 Location: Amsterdam, NL, EU
|
Posted: Sun 10 Jun '18 21:55 Post subject: |
|
|
Code: | <FilesMatch "\.ph(p[345]?|tml)$"> |
Rather cryptic and hard to read. Did you try
Code: | <FilesMatch "\.(php|php3|php4|php5|phtml)$"> |
|
|
Back to top |
|
Glidos
Joined: 09 Jun 2018 Posts: 4 Location: UK, Oxford
|
Posted: Sun 10 Jun '18 23:54 Post subject: |
|
|
Jan-E wrote: | Did you try
Code: | <FilesMatch "\.(php|php3|php4|php5|phtml)$"> |
|
I agree.
I tried simply Code: | <FilesMatch "\.php$"> | , but it didn't help, although it did stop .php3 files working, unsurprisingly. |
|
Back to top |
|
Glidos
Joined: 09 Jun 2018 Posts: 4 Location: UK, Oxford
|
Posted: Tue 12 Jun '18 16:42 Post subject: |
|
|
I eventually tracked down the problem. Initially .php files were offered for download because I hadn't added php7 to the list of modules to load. I fixed that very quickly, but there after the file was cached by my browser. Obvious I guess, but it confused me.
Thanks for the help. |
|
Back to top |
|
|
|
|
|
|