Unable to read .php file

Operating system: Ubuntu 20

I’m hosting my server from home with Virtualmin. Everything works fine except PHP. I’m unable to read.php file. Even after installing PHPMyAdmin, it’s still unable to read it.

I know there is content online on how to fix it, but they are no longer relevant.

How can’t I fix the reading problems?

PHPmyAdmin is a tool for managing MySQL databases. Installing it will not fix any PHP realated configuration issues on the server, despite what the name implies.

Kindly expand upon ‘unable to read .php files’ and also provide error logs so that we can understand the issue better and offer suggestions to address the issue.

So that is the solution?

Could you look in Virtualmin -> Logs and Reports -> Apache Error Log and see if you find anything relevant there?

In the log I see:

[Fri Feb 12 14:50:46.952912 2021] [autoindex:error] [pid 632015] [client] AH01276: Cannot serve directory /home/website/public_html/: No matching DirectoryIndex (index.php,index.php4,index.php5,index.htm,index.html) found, and server-generated directory index forbidden by Options directive

What to do?

Fix that problem. You don’t have a file named index.php, or you do and it’s got the wrong permissions/ownership.

@Joe How do I know if I have a file named index.php or not? I do upload a .PHP file to my website but I’m unable to read on my browser.

Also, how could I change permission and what do you mean by changing the permission.

You look. I’m not sure how you’re uploading your files, but let’s look to see if you got it in the right place.

Go to your Virtualmin.

Go to the virtual server you uploaded the index.php file to.

Go to the file manager.

Go to the public_html folder. It should be in there. If it isn’t, then you uploaded it to the wrong place.

Here’s an image of one of my virtual servers on where to look:

Now then, if it isn’t there, just go to the FILE tab in the upper right, click on UPLOAD TO THIS DIRECTORY from the dropdown list, and upload your index.php file.

I already did it:

Index.html is working but not index.php with PHP I get this error:

Thanks for your help

Do you have an index.html in there with an index.php at the same time? If so, try changing the name of the index.html to index-backup.html or simply remove it.

Then try your site again.

Your permissions are set to 777. That is always wrong, and will never work. Don’t ever do that.

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.