FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » manually create/manage new themes
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
manually create/manage new themes [message #17904] Sat, 24 April 2004 06:47 Go to next message
lahoo is currently offline  lahoo   Sweden
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 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
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
some really important questions [message #17910 is a reply to message #17908] Sat, 24 April 2004 21:58 Go to previous messageGo to next message
lahoo is currently offline  lahoo   Sweden
Messages: 62
Registered: April 2004
Karma: 0
Member
I know I wtote a handfull, or so, of questions but the the one related to the actual subject of this thread was left unanswered:
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?

I've read through the manual and it doesn't provide any technical detalils on the way thems and templates work.
Is such information available?

Please don't see the following question as critisism. It is asked out of pure curiosity and the need to know.
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?

I really hope that I shouldn't need starting to look for a forum system again now that I've spent some 20+ hours on installing and understanding FUD.
Re: some really important questions [message #17911 is a reply to message #17910] Sat, 24 April 2004 22:09 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
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 #17912 is a reply to message #17911] Sat, 24 April 2004 22:51 Go to previous messageGo to next message
lahoo is currently offline  lahoo   Sweden
Messages: 62
Registered: April 2004
Karma: 0
Member
I'll look into the info you gave me and maybe the pitfalls of getting directories with wrong ownership can be avoided easilly.

My idea is to manually create all the diirectories that f.i. include/theme.inc will try to create prior to using certain features in admin interface. By doing so the script scould work out smoothly. That was the way I used to get my forum installed. I had to analyse install.php and by trial and error get all done.

I'll try to analyze all of the .inc files to find out which of them that creates directories and by doing so get to know which actions I have to do and when. If you already has such information compiled I would be very happy if you would share it with me.

Am I the only one who have had these permission problems? If not it would be a nice gesture to include a chapter about it in the installation guide.
Re: some really important questions [message #17913 is a reply to message #17912] Sun, 25 April 2004 02:59 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
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 Go to previous messageGo to next message
lahoo is currently offline  lahoo   Sweden
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 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
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 #17925 is a reply to message #17919] Sun, 25 April 2004 19:57 Go to previous messageGo to next message
lahoo is currently offline  lahoo   Sweden
Messages: 62
Registered: April 2004
Karma: 0
Member
Citat:

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?


Yes due to three reasons
  1. It felt safer not having DATA_ROOT in a browsable part of the file system.
  2. I didn't read anything disadvantageous about it.
  3. I had in mind easilly deploying the forum in multiple instances.

As a clarification I'll shortly mention the way the service provider (surftown.se) works.

Me and my girlfriend have three domains. Each web-enabled domain and sub domain will get its own folder within our account's non-browsable home folder. The structure is like below:
~/
.._data/
....FUDforum_data_root/ this is my data root
.........
..domain1.nu/
..forum.domain1.nu/
....forum/ www root for the forum
.........
....install/ where I kept install.php
..domain2.net/
..domain3.net/
.....


Citat:

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.


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
.........
.....


Does this proposed solution give me any side-effects or downsides as of the three reasons I wrote above?

Did I miss something in the installation description or are we, through my struggles, finding out what the manual should say? If solving my problems will contribute to the user community I'm happy to have done so - freedom of software!

Can I preserve my setup by the following procedure?
  1. copy the folders and files from data root to www root
  2. replace soft links to point to their targets new location
  3. through the admin interface alter the path to data root

Does the procedure have gaps?
Is it not possible to conduct such a move, ie. do I have to re-install from install.php?

Anything else I should think about prior to redo the installation.

While having your attention I have one final question - what is the template set path_info used for and how does it differ from default? I've not found anything in the manual mentioning path_info.
Re: some really important questions [message #17926 is a reply to message #17925] Sun, 25 April 2004 20:07 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
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 #17927 is a reply to message #17926] Sun, 25 April 2004 20:31 Go to previous messageGo to next message
lahoo is currently offline  lahoo   Sweden
Messages: 62
Registered: April 2004
Karma: 0
Member
Thanks for potentially very usefull findings, information and support.

Citat:

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 (?).


The only data I would like to preserve is the settings I've made in the admin control pages. That data ought to be in MySQL but is it affected by running install.php again?

Also, in my many questions in the last message I asked about what the template set path_info is and when/how to use it. My curiosity is still there.
Re: some really important questions [message #17928 is a reply to message #17927] Sun, 25 April 2004 20:34 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
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 #17929 is a reply to message #17928] Sun, 25 April 2004 20:39 Go to previous messageGo to next message
lahoo is currently offline  lahoo   Sweden
Messages: 62
Registered: April 2004
Karma: 0
Member
I'll try to move the forum the way I outlined. If I screw it up I can always reinstall as a backup solution.
Re: some really important questions [message #17972 is a reply to message #17919] Wed, 28 April 2004 04:39 Go to previous messageGo to next message
lahoo is currently offline  lahoo   Sweden
Messages: 62
Registered: April 2004
Karma: 0
Member
Moving the data files was no problem, my plan on how to do it worked out. However the problem that new directories created when managing themes and template sets has httpd as owner remains.

That's probably beyond your control and I'll try to bring it up with my WSPs support. They really suck and the answer will be a non-constructive one such as "That's the way it is". Sad
Re: some really important questions [message #17981 is a reply to message #17972] Wed, 28 April 2004 13:33 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
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 #17986 is a reply to message #17981] Wed, 28 April 2004 14:43 Go to previous messageGo to next message
lahoo is currently offline  lahoo   Sweden
Messages: 62
Registered: April 2004
Karma: 0
Member
Just as I guessed the braindead support of my WSP answered "we don't support your scripts", and nothing else, when I asked why their PHP made mkdir() create folders with owner httpd:httpd.

I did that prior to performing the actions. In addition to that I chmod:ed as many folders up the directory hieracrchy as possible with 777.

Since it seems that I'll have to do all the theme and template management by hand I would like to take away a lot of the burden by remving all translations but Swedish and perhaps English. Is this feasible?

What else that just removing the language sub-folders of i18n/ do I have to do in order to disable other translations than Swedish / English?
Re: some really important questions [message #17987 is a reply to message #17986] Wed, 28 April 2004 14:49 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
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 Go to previous messageGo to next message
lahoo is currently offline  lahoo   Sweden
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 #17990 is a reply to message #17989] Wed, 28 April 2004 15:36 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
To bypass safe_mode you need to do a little trick Smile

You need to create a simple file upload form, and upload your PHP scripts via that form. That'll cause the ownership of the script to become the same as the webserver. Now this little script can read/write/create files that are owned by the webserver bypassing silly "Safe Mode". Alternatively you can use the copy() function to make a copy of the script, that'll be the same as uploading it.

The problem you've described is due to the fucked up nature of safe_mode. Your script mkdir.php is owned by you (you:you) when you create a directory it's ownership is httpd:httpd cause the script was ran via the webserver. When you try to create another directory inside the initial directory, "safe mode" is triggered because the owner of mkdir.php != owner of the directory inside which you are trying to create directory #2.


FUDforum Core Developer
Re: some really important questions [message #17991 is a reply to message #17990] Wed, 28 April 2004 15:46 Go to previous messageGo to next message
lahoo is currently offline  lahoo   Sweden
Messages: 62
Registered: April 2004
Karma: 0
Member
So what I should have done from the very beginning was not to upload install.php using an FTP-client but rather by first making an upload-script and then posting install.php to the server.

It might be a wise thing to mention this in the installation instruction.

Changing owner of every file created by FUD installation script or later seems to be an awful amount of work.

Another consequence of what you mentioned ought to be that it is virtually impossible to do any work what so ever with files needed by the forum via FTP without screwing things up. What I've done several times is to download a lot of files suffering from being owned by httpd:httpd and then uploading them again.
Re: some really important questions [message #17992 is a reply to message #17991] Wed, 28 April 2004 15:52 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
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 #17993 is a reply to message #17992] Wed, 28 April 2004 15:57 Go to previous messageGo to next message
lahoo is currently offline  lahoo   Sweden
Messages: 62
Registered: April 2004
Karma: 0
Member
Citat:

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.


If that's the case it obviously didn't work that way for me since I had to (see an earlier thread) create all the folders manually during the install process.

... or can it have had someting with the faulty compile.inc file that you supplied me a replacement for? I uploaded it via FTP and hence it ought to not be owned by httpd:httpd.
Re: some really important questions [message #17994 is a reply to message #17993] Wed, 28 April 2004 16:08 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
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 #17996 is a reply to message #17994] Wed, 28 April 2004 16:44 Go to previous messageGo to next message
lahoo is currently offline  lahoo   Sweden
Messages: 62
Registered: April 2004
Karma: 0
Member
Is the current 2.6.2 release updated with the working compile.inc or should I go for the latest release candidate if I decide to start all over again?

However, revisiting my very first thread shows that I had a horseload of problems even prior to hitting the faulty include.inc. http://fudforum.org/forum/index.php?t=tree&goto=17762&rid=1511

[Updated on: Wed, 28 April 2004 16:48]

Report message to a moderator

Re: some really important questions [message #17997 is a reply to message #17996] Wed, 28 April 2004 17:02 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
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
Re: some really important questions [message #18000 is a reply to message #17997] Wed, 28 April 2004 18:56 Go to previous messageGo to next message
lahoo is currently offline  lahoo   Sweden
Messages: 62
Registered: April 2004
Karma: 0
Member
Either that's the same as the current problem... or not. Razz Obviously.

If I try another parallell installation I'll observe what happens. A difference between this thread and the one I mentioned some messages ago is that then root was the owner and now httpd.
Re: some really important questions [message #18044 is a reply to message #17990] Sat, 01 May 2004 08:24 Go to previous messageGo to next message
lahoo is currently offline  lahoo   Sweden
Messages: 62
Registered: April 2004
Karma: 0
Member
I did some further reading and would like to hear your comments on wether the value of safe_mode_gid can affect the situation? The WSP that host my domains has this value set to off.

For complete configuration info see http://ws1.surf-town.net/phpinfo.php
ShoRe: some really important questions [message #18066 is a reply to message #18044] Wed, 05 May 2004 12:31 Go to previous message
Ilia is currently offline  Ilia   Netherlands
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
This should not make a difference.

FUDforum Core Developer
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How to read new messages?
Next Topic: protect users against spam bots collecting emails
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 20:32:53 GMT 2024

Total time taken to generate the page: 0.02288 seconds