Problem
I have to do the following each time I want to access the phpinfo():
I’m on Ubuntu.
Isn’t there a better method to see phpinfo on your browser?
Asked by MEM
Solution #1
You can run from the command line.
php -i
I realize it’s not the browser window, but you can’t see the contents of phpinfo(); without calling the function. Obviously, having a phpinfo script in the root of your web server directory is the best option; that way, you can access it at any time via http://localhost/info.php or something similar. (NOTE: Do not attempt this in a production setting or anywhere that is open to the public.)
EDIT: As binaryLV pointed out, it’s usual to have two php.ini files per installation. The command line interface (CLI) is one, while the web server interface is the other. Make sure to give the ini file path if you want to receive phpinfo output for your web server, for example…
php -c /etc/php/apache2/php.ini -i
Answered by JamesHalsall
Solution #2
Try the following if you have php installed on your local machine:
$ php -a
Interactive shell
php > phpinfo();
Answered by Rag
Solution #3
The best method to do this from the CLI is to use grep like this:
php -i | grep libxml
Answered by totas
Solution #4
From the CLI:
php -r 'phpinfo();'
Answered by sjas
Solution #5
Make use of the command prompt.
‘?php phpinfo();?>’ >> /var/www/project1/html/phpinfo.php && firefox —url localhost/phpinfo.php && touch /var/www/project1/html/phpinfo.php && echo ‘?php phpinfo();?>’
Something along those lines? Idk!
Answered by Chris G.
Post is based on https://stackoverflow.com/questions/7190093/is-there-an-easy-way-of-seeing-php-info