Jump to content

[SOLVED] Permissions and PHP


ksduded

Recommended Posts

I can't seem to use the mkdir() function without having 777 access to the folder the new folder is supposed to be placed.

 

Is it some sort of settings that have to be changed by my Host to allow mkdir() fuction?

 

my php file is stored in the www.hanna1.ca directory

 

my code is

 

PHP Code:

<?php

chmod('/home/highfid/public_html/www.hanna1.ca', 0777);

mkdir('/home/highfid/public_html/www.hanna1.ca/joseph', 0777, true);

?>

 

Additionally, I CHMODed the directory to 777 and for some reason, the index file in that directory dosen't opening up through the browser. I changed it back to 755 and it starts working again.

 

what am i doing wrong?

Link to comment
https://forums.phpfreaks.com/topic/123804-solved-permissions-and-php/
Share on other sites

You can try using system function in PHP, after you create the directory in a temp folder with the correct permissions...though it's common shared hosting companies disable the system() function...I'll assume it's Linux based

 

<?php

  system("mv /home/user/public_html/temp/folder /home/user/public_html/folder");

?>

You can try using system function in PHP, after you create the directory in a temp folder with the correct permissions...though it's common shared hosting companies disable the system() function...I'll assume it's Linux based

 

<?php

  system("mv /home/user/public_html/temp/folder /home/user/public_html/folder");

?>

 

apparently system() function works at my end... and your trick worked. Great. Many thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.