Creating recursive folders in linux server through php script
while creating directory inside your root folder or in any folder through php script you should take care of the following steps.
which may gives you problem by not creating folder under any root folder
In some linux server if your warrings are off then it won’t give warring msg if any following error raise
this type of problem you may get when you’re trying to create folder recursively
Here I am giving the list of problem
1)permission
2)owner permission
3)group permission
4)most important safe mode ON in linux server
– If your having problem of not creating folder under any root folder or under any other folder (permission problem)
-pls check the root permission for the folder under which your trying to create dir through php
Or through php itself you can able to change the permission for the folder like this
$chmod_value = chmod(“/root/folder/”,0755);
-don’t giv full permission for the source folder where your trying to create max 755 is enough.
-if your not able to create due to owner permission then
-pls check under which owner your trying to create the folder and you can change the owner of the folder to the current logged in
chown (“root/folder/”,"owner_name");//giv the proper owner name
--if your not able to create due to group permission then
-pls check under which group your trying to create the folder and you can change the group of the folder to the current logged in
chgrp (“root/folder/”,"group_name");//giv the proper group name
- if you’re not able to create due to safe mode on
-if your trying to create recursive folders in linux server then u must take care of safemode setting inside your config file
-if your server safemode is ON then your unable to create recursive folders
It wont alow you to change the permission through php script by default it vl take its own apache as user and group as apache
-to overcome this prblem you can try this by changing the safemode off through php like this
ini_set("safe_mode",0);
-if your using .htaccess file at ur root level then you can try the by setting
Default safe_mode off ;
-in worst condition if the above 2 way don’t work then you have to switch of the safe mode directly inside your apache server configure so by this your php should be able to create folder inside linux server
No comments:
Post a Comment