ToughPal
ToughPal

Reputation: 2247

Apache & PHP folder permissions

Our PHP scripts create dynamic folders and files and we are having a permission issue. The folders were initially create using our ftpuser. EG: Album (created by ftpuser) all subfolders and files in them have to be dynamically created. The apache user is the user when a new folder is created and then it cannot write anything to that folder for some reason.

The server is running with PHP safe mode OFF.

Whenever a folder is created by php script the user is apache and the permission for some reason shows as dr----x--t

Thanks.

Upvotes: 0

Views: 4260

Answers (1)

system PAUSE
system PAUSE

Reputation: 38500

Find the place in the PHP where the folder is created. Typically, this will be:

mkdir( folderName );

Change the line to:

mkdir( folderName, 1755 );

Or, instead, add this line after the mkdir:

chmod( folderName, 1755 );

For more information, here's the PHP mkdir documentation.

Upvotes: 3

Related Questions