Message boards : Web interfaces : Permission Problems in PHP
Message board moderation
Author | Message |
---|---|
Send message Joined: 31 Jan 08 Posts: 5 |
Hi, I'm new to BOINC and I'm hoping someone can help. I'm not sure if this is the right place to put this but here it goes anyway. I am a graduate student new to a project at UDEL (Docking@home). I am trying to set up a server on one of my machines at school so I can get familiar with the infrastructure of BOINC before I go tinkering around with the real deal. Here is my problem. I am having trouble getting the automatically generated web-site that BOINC comes with to work. I keep having problems with permissions. PHP is not able to create new files in the directories. I have tried setting the permissions of the entire example uperCASE project to 777 to no avail. I still get permission denied errors in my /var/log/apache2/error_log file and a blank web-site. I put an echo ("test"); on the first line of the /html/users/ folder and it will print out to my browser, so it is reading from the proper directory. But if I put an echo("test"); after the first include directive I get nothing in the browser. (Could it be an include problem?) I followed the instructions the best I could, I have a boinc_admin user that created the project using ./make_project --test_app myProject, I have a boinc group that wwwrun is a part of. I even copied the required configuration file to my httpd.conf file. The ./make_project seemed to run flawlessly, but I still can't see the web-site in the browser. I've searched high and low for some answers and all I get is that I have not set my permissions properly in the folders, but I've tried everything. Somewhere is was suggested that my php.ini file might have safe_mode turned on, but I checked and this is not the case. Any help or redirection would be greatly appreciated, if I am doing something totally stupid please be gentle, I'm new to BIONC. |
Send message Joined: 19 Jan 07 Posts: 1179 |
Looks like the include file is causing an error, which stops further execution; but the error isn't being shown. Make sure you have error reporting turned on in php.ini. |
Send message Joined: 31 Jan 08 Posts: 5 |
Looks like the include file is causing an error, which stops further execution; but the error isn't being shown. Make sure you have error reporting turned on in php.ini. Ok after digging through the include files I found that translation.inc was crashing PHP at line 422. While it was calling the buildLanguages() function. After commenting out that line (and turning on the error reporting in php.ini) I get the following error in the browser. Warning: %v%v() [function.%v]: failed to open stream: Permission denied in /data/home/boinc_admin/projects/licon/html/inc/translation.inc on line 414 Warning: fwrite(): supplied argument is not a valid stream resource in /data/home/boinc_admin/projects/licon/html/inc/translation.inc on line 415 Warning: fclose(): supplied argument is not a valid stream resource in /data/home/boinc_admin/projects/licon/html/inc/translation.inc on line 416 ERROR: Could not load language interface. This is a fatal error, exiting. Notice: Use of undefined constant flush - assumed 'flush' in /data/home/boinc_admin/projects/licon/html/inc/translation.inc on line 438 I'm assuming it is a result of not being able to create the file and write to it, but I still can't get the stupid permissions to work. NOTE: With the line uncommented I only get the permission errors and no fatal errors from PHP. |
Send message Joined: 31 Jan 08 Posts: 5 |
Ok, I think I figures out what happened. I followed the instructions from ./make_project to copy the boinc configuration information to the httpd.conf file. This creates aliases to the directories where my project. is. For some reason or another, PHP wasn't able to create files in the folder specified in the alias. So I checked my document root, which was in a different location than my project folder.(/srv/www/htdocs/) In here I created a short php script that opens a file, an viola, it works! Ok, so I an create files here but not over there, so yes, I copy the project folder to the document root, and yes, php can create files again. I assure you that all the permissions where the same as when I had them elsewhere, so it was location that was the factor. (I think) So I'm not to familiar with how aliases work, but do they have to be in a sub-directory that is in the document root? If so, that was my problem. Otherwise I just don't know what's going on. In my schools httpd.conf file they set up a virtual host and set the document root to the project folder, I'm gonna copy their config file and see if I can get it working on from my project directory, otherwise I'll just leave it in the default document root where it works. |
Send message Joined: 27 Jun 06 Posts: 305 |
It could be a PHP security setting that doesn't allow access to directories below the web root directory (like a restricted shell). |
Send message Joined: 31 Jan 08 Posts: 5 |
Ok, so I didn't figure out what causing me so many problems but here is how I solved it. After much frustration with getting the permissions right, I thought, hell, if chmod -R 777 doesn't work then maybe changing the owner and group to that of apache will. So, to the project directory (outside of the document root of apache) as root I changed owner to wwwrun and the group to www of all the project folders. chown -R wwwrun ./projects/licon chgrp -R www ./projects/licon Then tried refreshing the page. Wholly crap it works! Ok, so I can't leave it like that so I figured I'd change it back and see what happens. chown -R boinc_admin ./projects/licon chgrp -R boinv ./projects/licon And it still works. I couldn't believe it. The owner and group where back to what they where when it wasn't working and yet ... now it is. I tried the same thing again, this time without refreshing the browser between changing ownership from boin_admin to wwwrun, and it didn't work, permission still denied. So for some reason unknown to me, I was able to get it working by 1st changing ownership to wwwrun, and group to www, refreshing the browser then back to boinc_admin and boinc. God knows this was driving me crazy. The way I figured out was by creating new folders and trying to open a file through php. Any new folder I created was able to have a index.php file and be able to create a test file. If i tried to put an index.php in any of the boinc project folders, it wouldn't have it and it would give me a permission denied error, even though the permissions/owners/groups where exactly the same on both the project folders and the new folders I created in the project sub-directory. I really don't understand why what I did fixed the problem, ... but it did. |
Send message Joined: 12 Feb 06 Posts: 232 |
If you chmod 777 then it doesn't really matter what the owner and group are, eh? -- Eric Myers "Education is not the filling of a pail, but the lighting of a fire." -- William Butler Yeats |
Send message Joined: 31 Jan 08 Posts: 5 |
I finally figured out the culprit but I have no solution yet. Apparently anything in the top folder of where I had the BOINC project didn't respect any of the group permissions. Only owners could access the files. If you are a member of the group that the file was attached to, you still where denied permission. This is why even chmod 777 didn't work because it would only allow the owner to modify the files, no matter what. I created a new folder at the root level. This one did respect permissions accordingly and it worked as expected. I am still not sure why anything in that other folder wouldn't. I have since left that little project since I was only doing it to get some knowledge on BOINC. If anyone has some insight at to what would cause a folder to not respect group permissions I am all ears. |
Send message Joined: 2 Sep 05 Posts: 103 |
If anyone has some insight at to what would cause a folder to not respect group permissions I am all ears. It's probably due to the group (or other, depending on the ownership) permissions on the directory or one of its parents. Check the relevant permissions on the path to the file.
"The ultimate test of a moral society is the kind of world that it leaves to its children." - Dietrich Bonhoeffer |
Copyright © 2025 University of California.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License,
Version 1.2 or any later version published by the Free Software Foundation.