Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Alternative to chmod??

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Alternative to chmod??

Postby elitecodex » Fri Aug 16, 2002 6:49 am

I am writing a stats script that starts out with an installation script. This script generates the necessary configuration code and writes a new php file to be included in other pages. here is my problem. I realized that in order to get my script to actually write to "config.php" I have to chmod it to 666 ( using chmod("config.php", 0666);). Now, what can I do if get this?

Warning: chmod failed: Operation not permitted in /home/battlepa/public_html/stats/install.php on line 46

Is there any other way to script write access to this file? Or am I going to have to get the user to do that first? There has to be a way around this, I just dont know of one.

Thank you for any help in advance.

Will

PS: Ive been a Windows brat my entire life and know almost nothing of the Unix/Linux flavor of operating. Sorry if these is a bit easy :)
elitecodex
New php-forum User
New php-forum User
 
Posts: 68
Joined: Tue Jul 09, 2002 8:45 am
Location: East Coast, USA

Postby Jay » Fri Aug 16, 2002 8:47 am

Is the directory protected from the script? Sounds like there's a permission on the directory not allowing your script to make changes to the file within.
Jay
 

Postby elitecodex » Fri Aug 16, 2002 9:39 am

I cant get into my file manager at this point... I believe that all directores are by default 755. I have kept everything as simple as possible b/c I want to be able to port this to many different systems, and not everyone will have 777 on their entire site :)

So can I set a subdirectory or file to 666 if the parent directory is 755 ? God this Unix stuff is confusing. Better I start now then trying to learn it all in one semester hunh? :)

Thanks for your help.

Will
elitecodex
New php-forum User
New php-forum User
 
Posts: 68
Joined: Tue Jul 09, 2002 8:45 am
Location: East Coast, USA

Postby shufty » Sat Aug 17, 2002 1:41 pm

if the directory is 755 then you could create a new directory which you could CHMOD to 777 or 666 whcih would allow for the file to be changed/created. if there is an admin for the script then put it in there as it is kind of obvious where a config file is if its in a directory called config
shufty
New php-forum User
New php-forum User
 
Posts: 6
Joined: Sat Aug 17, 2002 5:45 am

Postby elitecodex » Sun Aug 18, 2002 3:57 pm

But how can I do that if i am not allowed to use the chmod() function? In my particular case, I tried to use chmod and it gave me the above error.
elitecodex
New php-forum User
New php-forum User
 
Posts: 68
Joined: Tue Jul 09, 2002 8:45 am
Location: East Coast, USA


Return to PHP coding => General

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.