My server is in /var/www/html I have a php script in /var/www/html/fileio_test/io_test.php
By default, Apache on Ubuntu runs as www-data.
Let's assume your folder is located in /var/www/mysite.
You can do this:
chown -R www-data:www-data /var/www/mysite
chmod -R og-r
/var/www/mysite
After doing this,www-data
(the Web server) will have full access to the site's files, while other non-root users will have no access at all.If you wish to allow select users to access the site, you can make the folder group-readable and add those users to the group www-data.
Set correct permissions on your apache files