0

I have apache2 working and can run php files by navigating to localhost using chrome browser. However I'd like to be able to launch the files within the browser from the command line.

google-chrome myfile.html works but google-chrome myfile.php doesn't, even though I'm launching it from my apache root.

Any help much appreciated.

1 Answers1

0

As for any PHP file, opening the source file in the browser will show a mix of rendered HTML and non-interpreted PHP code (or depending on the PHP code even the full source or nothing): you would get the same result by opening the file from the GUI.

You need to request the page to the server, i.e. in your case localhost:

google-chrome http://localhost/path/to/myfile.php

Where path/to/myfile.php is the relative path to myfile.php from Apache's root directory.

kos
  • 35,891