You are correct, the PHP files should be hidden.
More precisely, you should not have permission to view a directory listing for the Apache2 server's root directory and its subdirectories in a web browser.
Attempting to do so should display an HTML page that says something like this:
You don't have permission to access / on this server.
Apache/2.4.7 (Ubuntu) Server at ide50-your-username.cs50.io Port 443
If, instead, you see a directory listing that starts off with:
Index of /
... this is a security problem. It means two things.
First of all, Apache's root directory does not have an
index.html file. It should have one. You can prevent Apache from generating such a list by creating your own index file.
Second of all, you have just discovered the real difference between using
chmod 711 and
chmod 755 for directories. I suggest that you immediately try setting the permissions of the root directory to:
chmod 711 ~/workspace/myfolder
and tell me whether you can still see your PHP files listed.
Can't reply in comments now (because mobile) but the answer to your questions are:
- permissions for directories should be
chmod 711, not
- permissions for PHP files should be
- the permission error is a good thing! You actually don't want to give all the Bad People of the Internet permission to see a listing of your PHP files!
- if your file is called
foo.php, you can view it in the browser by appending
/foo.php to the default site URL.
- if you want the default site URL to load a page, you must change the PHP file for the default homepage to
index.php. But you can't rename all your files
index.php, so you will also need to understand URLs and pathnames. (Hopefully, you have already done
server.c, so you'll have some understanding of
Hope this helps!