Score:0

PHP File Permissions and Running HTML Files as PHP

kw flag

I am running a Linux server (a DV server with Media Temple). It's a pretty standard LAMP setup. I'm running PHP 7.4.

I'm using two programs to upload files to the server: Filezilla and a tool called Codeanywhere.

When I upload a PHP file using SFPT with Filezilla the permissions are 664. When I create a PHP file with Codeanywhere the permissions are 644. Notice they are slightly different! Both files work when visited in a browser.

I also have a line in my .htaccess that causes .html files to run as PHP:

AddHandler application/x-httpd-ea-php74 .php .php7 .phtml .html

When I upload an HTML file using SFPT with Filezilla the permissions are still 664. When I create an HTML file with Codeanywhere the permissions are 644.

However, the HTML uploaded using Filezilla gets an Internal Server Error.

Any idea why the HTML file with 644 permissions will run, but the HTML file with 664 permissions won't run. Also, any way to change the default permissions when files are uploaded using Filezilla?

Edit: Additional Information

I've checked the error logs and there are not errors logged related to this issue. The error the browser receives it this:

GET https://sample_domain.com/test.html 500 (Internal Server Error)

If I switch the permissions to '644' on the HTML file, then it works fine.

Tom avatar
bf flag
Tom
What I recommend is accessing the Apache log to see what triggered the "Internal Server Error" error, along with the code. These errors log are usually located in `/var/log/apache2/error.log`
Adam avatar
kw flag
I did check the error log. Nothing helpful in the log. Seems like the error does not register.
vidarlo avatar
ar flag
What is it in the log? Are you sure it's the correct log file?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.