Is there an easy way of seeing PHP info? Ask Question

Is there an easy way of seeing PHP info? Ask Question

Each time I want to see the phpinfo(); I have to:

  • Create a info.php file;
  • Write phpinfo(); in it.
  • Go to the browser and type my "thisproject.dev/info.php"

I'm on Ubuntu.

Isn't there a more practical way to see phpinfo in the browser?

ベストアンサー1

From your command line you can run..

php -i

I know it's not the browser window, but you can't see the phpinfo(); contents without making the function call.

Another approach would be to have a PHP script in the root of your web server directory that calls phpinfo();, that way you have access to it at all times via http://localhost/info.php or something similar. However, this is NOT suitable for a production environment unless you ensure that you secure it.

EDIT: As mentioned by binaryLV, its quite common to have two versions of a php.ini per installation. One for the command line interface (CLI) and the other for the web server interface. If you want to see phpinfo output for your web server make sure you specify the ini file path, for example...

php -c /etc/php/apache2/php.ini -i 

おすすめ記事