Make directory/folder on server

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
constance.kan
Forum Newbie
Posts: 2
Joined: Tue Feb 26, 2008 4:00 am

Make directory/folder on server

Post by constance.kan »

Mod | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.


Scenario: I have 2 servers here....SERVER M (hosting the script) and SERVER S (where I want to create new folder).

I want to create a folder on a SERVER S by running the following script that's hosted on SERVER M. Folder home$ already exists in SERVER S, hence it only needs to create a PPan folder.

Code: Select all

 
if (mkdir('\\\\s/home$/PPan',0777))
{
    echo ("made directory");    
}
else
{
    echo ("cannot make directory");
}
 
However, if I run the script from my PC (which is not the SERVER M), it doesn't work. But if I login as me on SERVER M and run the script there, it works fine.

If I make a copy of the script and host it locally on my localhost, running the same script, it works - it creates PPan folder on server S. I know it's a security issue but I don't know what it is.

I've also tried below but same result:

Code: Select all

 
$folderPath = '\\\\sal/home$/PPan';
$oldumask = umask(0) ;
mkdir( $folderPath, 0777 ) ;
umask( $oldumask ) ;
Could anyone nice people help me please?


Mod | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.
Post Reply