Can you run the script on the machine running bitcoind to isolate the allowip setting? Maybe this is not the issue if you can connect from Chrome...
I would add a try catch around the block and check out any details of an exception.
try {
...
} catch (Exception $e){
echo $e;
}
Be careful though this might print your connection details...