zhuanzhou zhuanzhou - 1 year ago 45
Linux Question

Run PHP in Linux Command Line

I wrote a test file named

which path in CentOS is
. There is no browser, is there a way to run the file and see the output?

Answer Source


 - php /var/www/html/phpinfo.php
 - curl http://localhost/phpinfo.php

The first runs the script from commandline, the second fetches it from the webserver (this assumes you've configured it correctly)