PHP not running in the browser, works fine from the command line

apache-2.2PHPweb

I've installed Apache, PHP and MySQL with no errors and I can run the PHP program from the command prompt.

But, I can't get a PHP page to display in the browser.

When I try to view a PHP page in Google Chrome, I get this error:

Oops! This link appears to be broken

Whereas a blank webpage appears in Mozilla Firefox.

Can you please suggest a solution to this?

Please don't just say that I should check the Apache/PHP configuration. If that is your answer, please also suggest what exactly should I be checking there.

Best Answer

  • Check the access log recorded by the web server (to make sure the request is being received)
  • Check the error log recorded by the web server (to see what the server said went wrong)
  • Use something like Charles or Firebug to examine the HTTP request and response in detail (so you know exactly what is being requested (and can match it to what you expect) and what the response is)

They should give you enough information to identify the problem.