ok guys,
I figured out why it wasn't working. PHP's mkdir needs to have the mode paramater entered as a an octal number. once i changed my code from:
mkdir("mydirectory",755);
to
mkdir("mydirectory",0755);
it worked like a charm.
Now my only issue is regarding cron. I've read up a little and cron has default job schedules that are set for hourly, daily, weekly and monthly. Well the monthly setting works for me since the "create directories" PHP file needs to run on the first of the month before business hours and 4 am is early enough. The only problem is, I'm not sure that if I run my php script (which is located in the htdocs directory) the directories created will not be owned by the right user. I was able to test the script by running it from a browser. By doing that, the httpd runs the php script creating the directories giving ownership to the user it's running as which in my case would be webuser. But if I were to run a cron job from the default settings, I'm not sure who would be given ownership? But then again, I can run the script in crontab under the webuser so that should create the directories with the webuser as owner? If I'm wrong in any way, please point it out to me.
Which way is it best and has a higher success rate, cron or crontab? also Should i move the php script out of htdocs or can I just leave it there? how do I create a link to the script so I can place it in the cron or crontab?
thank you, pardon me if i have asked alot of questions, it's just that this is beneficial for the success of our site.