Just to experiement I modified my php file that ran an exec command from a ping command to useradd command. Here is the command I created.
useradd -g client1 web22
Also instead of running the test.sh file from shell I created a cron job to run it and it ran fine and created the user without a problem.
Any ideas at all?