zhuanzhou zhuanzhou - 5 months ago 13
Linux Question

Run PHP in Linux Command Line

I wrote a test file named

phpinfo.php
which path in CentOS is
/var/www/html/phpinfo.php
. There is no browser, is there a way to run the file and see the output?

Answer

Yes.

 - 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)

Comments