473,382 Members | 1,329 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

PHP5 permissions

zorgi
431 Expert 256MB
Hi guys

I have a bit of a problem. Have application that allows user to upload images. Images are organized into directories created dynamically. I always thought that mkdir() function creates directories with 777 by the default. I checked documentation and that is what it says there: http://hr.php.net/function.mkdir. However all my directories created using mkdir() function have permissions 0755. Even when I force permissions to 777 like
Expand|Select|Wrap|Line Numbers
  1. mkdir("/path/to/my/dir", 0700);
I still get directories 0755.

Now that is not so much of the problem but I am not allowed to touch this files. I can not delete them or change permissions using ftp or file manager provided through cpanel, I contacted my service provider and they told me its PHP5 issue. We changed php to PHP4 and bingo. I was allowed to change permissions and delete files. The only problem now is in need php to be PHP5. Is this a bug or ? Anyone came across this issue before and what was your workaround?
Sep 18 '09 #1
5 2991
Dormilich
8,658 Expert Mod 8TB
@zorgi
these statements are preclusive. 700 for permission would be quite troublesome.

note: as of the manual, the standard permission is 777.
Sep 18 '09 #2
zorgi
431 Expert 256MB
@Dormilich
Sorry I just copy pasted that from manual i did use actual 0777

This is the actual code:
Expand|Select|Wrap|Line Numbers
  1. mkdir($dir, 0777);
  2. mkdir($dir."/squares", 0777);
  3. mkdir($dir."/full", 0777);
  4. mkdir($dir."/thumbs", 0777);
  5.  
However I always get 0755 no matter what I do. And anyway why can I not modify it using ftp?
Sep 18 '09 #3
TheServant
1,168 Expert 1GB
I have never had a problem like this, but I do know that some programs put limits on what can be changed. Do you have FULL access? You're not using something which someone could have blocked you access of changing chmod to >755?

Can you change files to 777?
Sep 18 '09 #4
zorgi
431 Expert 256MB
@TheServant
I only have access via ftp or cpanel. Once i create directory using mkdir i can not change it or delete it until php is set back to PHP4.
Sep 18 '09 #5
zorgi
431 Expert 256MB
Ok got it

Problem was not in mkdir() (eve though I dont know why created directories are 755) but in file uploaded to the directory. I used move_uploaded_file() function and this is the function that sets permissions very low so when deleting/renaming/changing permissions for directories with this files within them I was denied. Solution is in using chmod() strait after move_uploaded_file().

Thanks you guys. Help is always appreciated.
Sep 18 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: neur0maniak | last post by:
Hi, I've been eager to try out PHP5, so I've dumped it on my little dev machine. It's running WinXP with IIS5. I've put the php-cgi.exe in the "mappings" page as I'm used to doing with PHP4....
22
by: Matthias Braun | last post by:
Help! I am using SuSE 9.3, php5 and Apache2 on Linux. I try to write files to the hard drive using the following command: $filename = "test.txt"; if (!file_exists($filename))...
2
by: Mike | last post by:
Hello, Im doing this in php5, apache Im not sure where the problem lies but I have a file <?php Class CreateXML{ public function xmlDeclaration(){ return $varxmlDec = "<?xml version='1.0'> ";...
2
by: awebguynow | last post by:
latest PEAR on W32, refers to PHP5 inaccurately. I've seen posts regarding path's that get messed up, by lost ini's or registry settings. I don't think that's my case, because I can't find PHP5 in...
19
by: McKirahan | last post by:
I am working in two environments neither configuration of which I can change; one's my Web host the other a client. My Web host requires the use of the ".php5" extension to use PHP v5.1.4; where...
3
by: IamtheEvster | last post by:
Hi there, I'm using fopen for the first time and I know I'm running into a permissions problem, but I can't seem to resolve it and any help would be greatly appreciated. I'm running PHP5 and...
4
by: kjsphoto | last post by:
I jsut installed a new PHP 5 server as I wanted to keep the php4 version server running until I change over all the code to work with 5. Here is the problem and for the life of me I cannot...
1
by: kev | last post by:
Ok, I am really stuck and I need help badly. If I create any file or folder on the server and run the php file it works with no problem. As soon as I copy a website from another server onto...
5
by: DustinP | last post by:
I have installed PHP5 as ISAPI several times per every single guide I could find in the first 50 pages of results on google.. Server is Windows 2008 runing IIS7, phpinfo works and tells me the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.