I had a bit of the same problem:
On my web server (hosted by someone else) PHP_SELF wasn't returning '/' but 'home/sites/12345/www.webser.er/', so I had to modify this line also. Now, it's running fine.
There are quite some differences between servers, which is very frustrating. So by print_r()-ing the $_SERVER variable, you can see all the variables and try to pick a good one or modify one to get the correct value for url.base.