php is setup with default error reporting set to only show serious errors, not all errors. so, when some code does not work, you wont see an error, but you will have no idea of what the problem was. You can set error reporting to show all errors, which I recommend while you are writing your php scripts. But, for security concerns, it is recommended that you return back to the default error reporting level when you are running a production server.
How to enable all errors:
open your php.ini file, make sure you open it in NotePad, not WordPad or MS Word.
find this line:
error_reporting = E_ALL & ~E_NOTICE
change it to this:
error_reporting = E_ALL
save the file, restart apache, and all errors will be displayed now when you are developing your scripts.