[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Chmod not working

Posted on 2009-04-22
9
Medium Priority
?
383 Views
Last Modified: 2012-05-06
I am trying to CHMOD a directory in my html folder (/var/www/html) but it consistently fails to change it.

Are there some kind of permissions I need to change somewhere to allow this.
chmod("/var/www/html/thunder", 0777);

Open in new window

0
Comment
Question by:albyh
  • 4
  • 3
  • 2
9 Comments
 

Expert Comment

by:reza81
ID: 24204274
try 777, not 0777
0
 

Author Comment

by:albyh
ID: 24204309
Im afraid that doesnt work and is the incorrect way of listing the function according to php.net

"To ensure the expected operation, you need to prefix mode  with a zero (0): "
0
 

Expert Comment

by:reza81
ID: 24204348
Ok, can you make the directory you want to chmod with php and than try to change it if needed.

I think that would do the trick
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:reza81
ID: 24204370
$tid = "namedir";

if (chmod(mkdir("thunder/" . $tid), 0777)) echo "Dir creation and chmod ok!";

or something like this... my php isn't that good :-)
0
 

Author Comment

by:albyh
ID: 24213146
I cant create a directory with PHP in the public_html root folder as the permissions wont let me
0
 
LVL 13

Expert Comment

by:Onthrax
ID: 24483327
Open up your FTP program, login to your account and use that to change the permissions. FTP usually has a little more rights than directly from PHP files.
0
 

Author Comment

by:albyh
ID: 24483382
Hi Onthrax,

That method works but unfortunately is no good for me in this situation as the chmod is part of a PHP script.
Basically the script creates a directory and then "should" change the permissions of it so that pictures can be uploaded into it.
0
 
LVL 13

Accepted Solution

by:
Onthrax earned 250 total points
ID: 24483475
In that case.. please check the first note on this page:

http://nl.php.net/chmod

Note: The current user is the user under which PHP runs. It is probably not the same user you use for normal shell or FTP access. The mode can be changed only by user who owns the file on most systems. 

Open in new window

0
 

Author Closing Comment

by:albyh
ID: 31573235
Question not fully solved
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to implement server side field validation and display customized error messages to the client.
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month17 days, 21 hours left to enroll

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question