Problem with script - file permissions
Moderator: General Moderators
-
pentiumhead
- Forum Newbie
- Posts: 9
- Joined: Wed Aug 17, 2005 11:24 am
Problem with script - file permissions
hi,
I have a script that needs to open and write to a file. It worked on my system but when i uploaded it to my hosting, the script will not run and i get the error:
Warning: fopen(output.php): failed to open stream: Permission denied in .......
how do i solve this problem
Kay
I have a script that needs to open and write to a file. It worked on my system but when i uploaded it to my hosting, the script will not run and i get the error:
Warning: fopen(output.php): failed to open stream: Permission denied in .......
how do i solve this problem
Kay
-
pentiumhead
- Forum Newbie
- Posts: 9
- Joined: Wed Aug 17, 2005 11:24 am
This is what i got:
Warning: chmod(): Operation not permitted in /home/hyper/public_html/downloadp/chmod.php on line 9
Code:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
chmod("setup.php","0777");
?>
</body>
</html>
Warning: chmod(): Operation not permitted in /home/hyper/public_html/downloadp/chmod.php on line 9
Code:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
chmod("setup.php","0777");
?>
</body>
</html>
-
pentiumhead
- Forum Newbie
- Posts: 9
- Joined: Wed Aug 17, 2005 11:24 am
I opened windows ftp and typed remote and i got the message:
214-The following SITE commands are recognized
ALIAS
CHMOD
IDLE
214 Pure-FTPd - http://pureftpd.org/
how do i chmod?
Kay
214-The following SITE commands are recognized
ALIAS
CHMOD
IDLE
214 Pure-FTPd - http://pureftpd.org/
how do i chmod?
Kay
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Code: Select all
quote chmod <permission> <filename>-
pentiumhead
- Forum Newbie
- Posts: 9
- Joined: Wed Aug 17, 2005 11:24 am
I got this:
Warning: Unknown(/home/hyper/public_html/downloadp/setup.php): failed to open stream: Permission denied in Unknown on line 0
Warning: Unknown(/home/hyper/public_html/downloadp/setup.php): failed to open stream: Permission denied in Unknown on line 0
Warning: (null)(): Failed opening '/home/hyper/public_html/downloadp/setup.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in Unknown on line 0
What do i do now?
Thanks for your help
Kay
Warning: Unknown(/home/hyper/public_html/downloadp/setup.php): failed to open stream: Permission denied in Unknown on line 0
Warning: Unknown(/home/hyper/public_html/downloadp/setup.php): failed to open stream: Permission denied in Unknown on line 0
Warning: (null)(): Failed opening '/home/hyper/public_html/downloadp/setup.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in Unknown on line 0
What do i do now?
Thanks for your help
Kay
-
pentiumhead
- Forum Newbie
- Posts: 9
- Joined: Wed Aug 17, 2005 11:24 am
-
crazycaddy
- Forum Commoner
- Posts: 43
- Joined: Fri Aug 05, 2005 6:59 am
- Location: England, UK
-
pentiumhead
- Forum Newbie
- Posts: 9
- Joined: Wed Aug 17, 2005 11:24 am
No luck
I connected to my server
and typed in the command line:
But still it didn't work.
kay
I connected to my server
and typed in the command line:
Code: Select all
ftp> quote chmod 777 setup.phpkay
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
tryor other numbers (leaving the leading zero), such as 0746, 0766, but 0646 or 0746 shoudl do it.
Overall though, since you are writing to a php file, be very very very careful what you are writing in. If a user can control any aspect of the data being written, I'd be very very wary, because someone managing to inject a small amount of php code, can do wonderous amounts of damage.
Code: Select all
quote chmod 0646 setup.phpOverall though, since you are writing to a php file, be very very very careful what you are writing in. If a user can control any aspect of the data being written, I'd be very very wary, because someone managing to inject a small amount of php code, can do wonderous amounts of damage.
Do you create the file/folder using php script? If yes then the owner of the file will be the server itself and you have no permission to change it. You can write another php script to change the file/folder permission and execute it on the server. Use chmod("setup.php","0777"); as provided in previous replies. Once you get there you can change the permission on your file manager or ftp (the file/folder is now open to all).
-
pentiumhead
- Forum Newbie
- Posts: 9
- Joined: Wed Aug 17, 2005 11:24 am