1

I've got a university club website at thing.uni.ac.uk/meow/foobar which also has the domain foobar.co.uk. I don't have access to the config. I set up this website using HTML/CSS/JS alone and it's been fine, but now I've started learning PHP and I'm trying to switch to .php pages instead of .html pages.

When debugging the problem I'm about to describe, I made a page.php file and a page.html file that are identical (a simple hello world without any PHP tags). The problem I face is that if I try to go to foobar.co.uk/alpha/example/page.php, I get the following Internal Server Error:

/www/htdocs/meow/foobar/alpha/example is not owned by group g_www_bar_meow_foobar or any other acceptable groups.

But if I go to foobar.co.uk/alpha/example/page.html, it works fine. If I try to go to the non-existent foobar.co.uk/alpha/example/badger.php it gives me the 404 page as I would expect. If I move page.php to foobar.co.uk/alpha/page.php then it works.

Update

I've checked the permissions of page.php that isn't in the offending directory compared to page.php that is, and both seem to have the same permissions:

enter image description here


I'm not sure this has anything to with the problem, but I have a htaccess file in the foobar.co.uk/ directory which contains:

#redirect from the other domain to foobar.co.uk
RewriteCond %{HTTP_HOST} !^(www\.)?foobar\.co\.uk$ [NC]
RewriteRule ^(.*)$ http://foobar.co.uk/$1 [R=302,L]

#remove trailing slash if not a directory
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ /$1 [R=301,L]

#301 from example.com/page.html to example.com/page
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*\.html\ HTTP/
RewriteRule ^(.*)\.html$ /$1 [R=301,L]

#example.com/page will display the contents of example.com/page.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+)$ $1.html [L,QSA]

(This is only the part which I think could be relevant) But this should only do rewrites for html files.

  • 2
    This is not owned by group tells me that it is a ownership or permissions thing. Php likely requires execute privs where html only requires read. If you have access to the directory, check the owner and group for the files you created and compare that to php pages that work okay. – closetnoc Nov 4 '15 at 1:58
  • As closetnoc says. I don't see how this can be related to .htaccess. – MrWhite Nov 4 '15 at 1:59
  • @closetnoc Sorry about the delay checking this. Anyway, the permissions seem to be the same for working php pages that aren't in this folder and broken identical copies that are in this folder. I've updated the question with a screenshot – binaryfunt Dec 7 '15 at 11:47
  • @closetnoc I thought the same thing... shouldn't the permissions be set to 755? – elbrant Dec 26 '18 at 18:52
-1

What if you use php only as a container and include an html page in it? This would by the way be a good way to re-use html code.

For instance you have the contents in an html file called example.htm and in the php file you write:

<?php include('example.htm'); ?>

  • The point is nobody can access the page.php, regardless of its contents – binaryfunt Nov 5 '15 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.