Create folder

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
S_henry
Forum Contributor
Posts: 148
Joined: Sun Jan 25, 2004 10:25 pm
Location: M'sia

Create folder

Post by S_henry »

When somebody login into the system for the first time, I want the system create a folder automatically base on their 'login' as a folder name. Anyone has any idea?
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

Code: Select all

<?php
mkdir ("/path/to/my/dir", 0700);
?>
:: [php_man]mkdir[/php_man]
S_henry
Forum Contributor
Posts: 148
Joined: Sun Jan 25, 2004 10:25 pm
Location: M'sia

Post by S_henry »

I've tried this code to create folder and its work if i run the code on my local machine. The problem is the folder is not created if i run the code from the server, even after i change the folder setting to 777 (read, write, execute). Anybody got any idea pls?
Black Unicorn
Forum Commoner
Posts: 48
Joined: Mon Jun 16, 2003 9:19 am
Location: United Kingdom

Post by Black Unicorn »

Make sure that PhP on your webserver has the proper permissions to create folders.
I had the same problem once but solved it by changing the folder's ownership (CHOWN) to `httpd` or something.

Hope it helps.
H
Post Reply