473,442 Members | 1,797 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 2994
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.