manually create/manage new themes [message #17904] |
Sat, 24 April 2004 06:47 |
lahoo
Messages: 62 Registered: April 2004
Karma: 0
|
Member |
|
|
The server I use for my forum sometimes assigns wrong ownership to directories created by actions taken in the admin control panel (and the installation PHP script).
I just tried to create a theme to play with in my learning process but got
Warning: fopen(): SAFE MODE Restriction in effect. The script whose uid is <I will not dislose this> is not allowed to access <FUD WWWRoot>/theme/testtema owned by uid <I will not dislose this> in <FUD data root>/include/compiler.inc on line 367
Warning: fopen(<FUD WWWRoot>/theme/testtema/actions.php): failed to open stream: The file or directory cannot be found in <FUD data root>/include/compiler.inc on line 367
Couldn't write to <FUD WWWRoot>/theme/testtema/actions.php
The problem is that directories are created by httpd:httpd and not by <myuser>:<mygroup>.
Is there a way around that problem, i.e. something you can change in the code creating the files and directories?
An alternative way is if you tell me if and how I can create the themes manually. Which folders should be duplicated, in which manner and what else needs to be done?
Please, please help.
|
|
|
Re: manually create/manage new themes [message #17908 is a reply to message #17904] |
Sat, 24 April 2004 20:51 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
This is not a forum bug, but rather how PHP/Apache works. The installer is being ran from PHP/Apache and consequently all files created via the web are owned by PHP/Apache. There is no way to avoid that, unless your ISP uses PHP-CGI in which case PHP runs under your user.
FUDforum Core Developer
|
|
|
|
Re: some really important questions [message #17911 is a reply to message #17910] |
Sat, 24 April 2004 22:09 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
lahoo wrote on Sat, 24 April 2004 17:58 |
An alternative way is if you tell me if and how I can create the themes manually. Which folders should be duplicated, in which manner and what else needs to be done?
In other words, how do I manage themes and templates manually if there's no easy way around the permission problems?
|
You can create a template set manually by making a copy of the default directory inside the thm/ directory. Creating a theme manually is not something I would advise doing, however if you need to do, the methods for doing so can be found inside include/theme.inc, you can see how they are used from admthemes.php.
Quote: |
Is such information available?
|
What information are you looking for specifically. The basic gist of it is that the compiler.inc takes templates, i18n files and php source code and based on that generates the final files. This of course involves resolving various parts of the templates to text & PHP variables.
Quote: |
Do you regard FUD forum to be installable and managable under these cicumstances with continous permission related failures when managin themes plus the server running PHP in safe mode?
|
Sure, FUDforum is not affected by safe_mode, it'll work just fine on safe_mode system. If you need to change files outside of FUDforum it may be more difficult then on a system without safe mode. However, by unlocking the forum files, you can still download them via FTP and consequently replace them manually. The operation of the forum itself is not at all hindered by safe_mode restrictions.
FUDforum Core Developer
|
|
|
|
Re: some really important questions [message #17913 is a reply to message #17912] |
Sun, 25 April 2004 02:59 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
While there have been problems in the past with safe_mode installs, if you follow the instructions listed in the installer to the letter you should be able to go through it without any difficulties. The only tricky part is the creation of the initial directory.
The permission issue can be mostly resolved by "unlocking files" option in the admin control panel. Doing so will reset the forum's file permissions in such a way as to allow manual access to them.
FUDforum Core Developer
|
|
|
Re: some really important questions [message #17914 is a reply to message #17913] |
Sun, 25 April 2004 06:35 |
lahoo
Messages: 62 Registered: April 2004
Karma: 0
|
Member |
|
|
About theme management
Citat: | The permission issue can be mostly resolved by "unlocking files" option in the admin control panel. Doing so will reset the forum's file permissions in such a way as to allow manual access to them.
|
I've reviewed this setting and it said, in large red text, that my files were currently unlocked. To make sure that they were really unlocked I used the feature to unlock them. After doing so I went back to the theme management and tried creating a new theme based on default. The result was exactly the same as the one I stated in the initial message in this thread.
Your answer then was that
Citat: | This is not a forum bug, but rather how PHP/Apache works. The installer is being ran from PHP/Apache and consequently all files created via the web are owned by PHP/Apache. There is no way to avoid that, unless your ISP uses PHP-CGI in which case PHP runs under your user.
|
... and later you said
Citat: | Creating a theme manually is not something I would advise doing
|
Which is your recommendation to me on how to manage themes?
What's left if there's no way around the PHP/Apache limitation that makes it impossible to use the theme management in admin control panel and creating them manually is not recommended?
If you feel a sence of desperation in my questions you're probably right. I really hope that there is a solution that I have overlooked but hopelessness is starting to set in...
Is it a prerequisite for FUDforum that my "ISP uses PHP-CGI"? I haven't found anything in the documentation about system requirements other than regarding versions of PHP, MySQL and PostgreSQL.
About installation
Citat: | While there have been problems in the past with safe_mode installs, if you follow the instructions listed in the installer to the letter you should be able to go through it without any difficulties. The only tricky part is the creation of the initial directory.
|
I did, in fact, follow the instructions in the manuals installation chapter to the point. Since safe_mode is enamled I created a temporary folder named install, copied the install.php file there and ran it from that URL. Neither forum data root nor server root resdes in or as decendant to install/. Did I overlook or misinterprete anything?
By the way, there is an interpretation/language issue with the manual when it comes to the chapter http://fudforum.org/doc/d/html/install.script.html
First it says
Citat: | It is recommended to copy the script into the web directory where you intend to install the forum. To begin the installation of the forum, use your browser to access the install.php file.
|
... and then
Citat: | Important
If your PHP has safe_mode enabled, you'll see an indicator that it is enabled in red on top of the install wizard. If safe_mode is enabled, you CAN NOT use specify the directory where you've placed install.php as Server Root or Forum Data Root.
|
Firstly it would be an improvement if you in the inital quote could include a reference to the special case for safe_mode. You might add "This recommendation doesn't apply to users that have PHP safe_mode, see below."
Secondly the wording marked in red is strange. I think it would be wise to revise it into either "MUST NOT use" or "MUST NOT specify" since use and specify says the same thing.
|
|
|
Re: some really important questions [message #17919 is a reply to message #17914] |
Sun, 25 April 2004 15:13 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
Ok, I've just tried to replicate the problem but am unable to do so. Does the WWW_ROOT_DIRK differ from DATA_ROOT in your installation?
If they do not (my test case).
The install process under safe_mode should be perfomed in the following way.
Copy install.php into the directory which will be the parent directory of where the forum is to be installed. For the duration of the install make sure that this directory is writeable by the webserver. Then running the installer specify the directory where to install it, in safe_mode situation keep DATA_ROOT and WWW_ROOT_DISK the same directory. If you follow these steps you should be able to create new themes via the FUDforum interface.
FUDforum Core Developer
|
|
|
|
Re: some really important questions [message #17926 is a reply to message #17925] |
Sun, 25 April 2004 20:07 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
While it is not recommended to keep data & www in the same dir, it is completely safe as the forum places .htaccess files denying direct access to those directories.
There is no disadvantage to keeping things in 2 directories other then it makes it a tiny bit more difficult to do manual backups since you need to backup 2 directories instead of just 1.
For ease of deployment is it simpler to keep everything in 1 directory.
Quote: |
So, what I should have done is to have the following structure, right?
~/
.....
..forum.domain1.nu/ put install.php here during installation
....forum/ www root and data root
.........
.....
|
Yes and temporarily chmod forum.domain1.nu 777.
Quote: |
Does this proposed solution give me any side-effects or downsides as of the three reasons I wrote above?
|
No.
Quote: |
Can I preserve my setup by the following procedure?
copy the folders and files from data root to www root
replace soft links to point to their targets new location
through the admin interface alter the path to data root
|
Yes, except you need to MOVE and not COPY the folders, copying will preserve the folder owner/group. Although if you are having safe_mode issues it may be simpler to just re-install since you forum does not yet have any data (?).
FUDforum Core Developer
|
|
|
|
Re: some really important questions [message #17928 is a reply to message #17927] |
Sun, 25 April 2004 20:34 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
The forum settings are stored inside GLOBALS.php, the other things are stored inside MySQL. Running an installer over existing data will overwrite the data, that's why for upgrades there is a separate upgrade script.
PATH_INFO theme differs from default theme by having URLs that are search engine friendly, meaning that instead of index.php?foo=bar&bar=foo you get something like index.php/foo/bar/
FUDforum Core Developer
|
|
|
|
|
Re: some really important questions [message #17981 is a reply to message #17972] |
Wed, 28 April 2004 13:33 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
You need to use the forum's "Lock/Unlock Forum's Files" admin control panel to unlock the forum files, at which point you will be able to access them from your account.
FUDforum Core Developer
|
|
|
|
Re: some really important questions [message #17987 is a reply to message #17986] |
Wed, 28 April 2004 14:49 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
You can safely remove the folders inside the i18n/ directory, just make sure you have no themes based on the languages you are going to remove.
PHP's mkdir() makes files as httpd:httpd because that's the user:group of the webserver, since PHP runs as the webserver user, all of the files it creates are owned by the webserver.
FUDforum Core Developer
|
|
|
Re: some really important questions [message #17989 is a reply to message #17987] |
Wed, 28 April 2004 15:27 |
lahoo
Messages: 62 Registered: April 2004
Karma: 0
|
Member |
|
|
Citat: | PHP's mkdir() makes files as httpd:httpd because that's the user:group of the webserver, since PHP runs as the webserver user, all of the files it creates are owned by the webserver.
|
Yes, but then, when trying to write files to that directory it impersonates our account. Further, issuing a mkdir() in PHP with specified permissions of the resulting folder doesn't set that permission on the folder.
I made a test script to demo this to the support group of my WSP:
<html>
<body>
<?php
echo 'create123 - ';
if (mkdir('123', 0777))
echo 'ok';
else
echo 'not ok';
echo '<br>create 123/456 - ';
if (mkdir('123/456', 0777))
echo 'ok';
else
echo 'not ok';
?>
</body>
</html>
I placed this piece of code as mkdir.php in a folder named _test/ and chmod:ed _test to 755. _test is owned, just like all other files/folders in our webplace, by xyz:xyz where xyz is our account.
When mkdir.php is run under these conditions I get
"Warning: mkdir(123): Permission denied in [...]/_test/mkdir.php on line 5"
If I chmod _test/ to 777 and try again mkdir.php will create the folder 123 as being owned by httpd:httpd. Despite specifying 0777 the folder created has rwxr-xr-x
When the second mkdir() is executed I get
"Warning: mkdir(): SAFE MODE Restriction in effect. The script whose uid is 107299 is not allowed to access .../_test/123 owned by uid 398 in .../_test/mkdir.php on line 12"
So... the script is run by 107299 but the folder is created by 398.
If I knew about the amount of problem this odd behaviour would cause me prior to getting the great idea to install FUDforum I would never have bothered. On the paper the system specs matched. I put all the blame on the WSP.
[Updated on: Wed, 28 April 2004 15:30] Report message to a moderator
|
|
|
|
|
Re: some really important questions [message #17992 is a reply to message #17991] |
Wed, 28 April 2004 15:52 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
No, Install.php has a work-around for safe_mode, which involves making a copy of itself thereby gaining the necessary permissions to bypass safe_mode.
As far as uploading via FTP, it all depends on your FTP client, if you client overwrites the file (this does not change user/group) it would be ok, but yours probably removes the old file and replaced it with a new one. This causes the ownership to change. In this instance you should use the forum's built-in filemanager.
FUDforum Core Developer
|
|
|
|
Re: some really important questions [message #17994 is a reply to message #17993] |
Wed, 28 April 2004 16:08 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
It would seem likely that the modified compile.inc is the culprit. My own tries to install the forum in a safe_mode environment had all worked properly.
FUDforum Core Developer
|
|
|
|
Re: some really important questions [message #17997 is a reply to message #17996] |
Wed, 28 April 2004 17:02 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
The template problem was something that new compiler.inc resolved, the other problem was due to weirdness that somehow caused directories that were initially created by the installer to be owned by root:root.
FUDforum Core Developer
|
|
|
|
|
|