please don't advice people to chmod 777. Its a massive security hole
here is why the problem exists and how to fix it without making a massive security hole in your website.
the problem is because the php scripts are in the 99 group but all the directories under publichtml are in a group of your user name.
You can to write a php script to create a directory to to this you will have to temporarily change the publichtml directory permissions to 777, do not leave them like this. After the new directory is created change your publichtml back to 775. Once you have created the directory your php scripts can chown and chmod it as much as you like.
Any file's you create through cpanel will be of limits for php to chmod and chown but any files or directories php creates can be modified with chmod and chown from php scripts.
It’s all to do with the permissions and the groups.
Note: some people will say just leave the publichtml as 777 but this means anyone on the server can create a script to delete all your files or run malicious code from your site.