问题描述
每次我要查看phpinfo();
时,我都必须:
Each time I want to see the phpinfo();
I have to:
- 创建一个info.php文件;
- 在其中写入
phpinfo();
. - 转到浏览器并输入我的"thisproject.dev/info.php"
我在Ubuntu上.
没有更实用的方法在浏览器中查看phpinfo吗?
Isn't there a more practical way to see phpinfo in the browser?
推荐答案
在命令行中,您可以运行..
From your command line you can run..
php -i
我知道这不是浏览器窗口,但是如果不进行函数调用,您将看不到phpinfo();
内容.显然,最好的方法是在Web服务器目录的根目录中有一个phpinfo脚本,这样您就可以随时通过http://localhost/info.php
或类似的方式访问它(注意:不要在生产环境中执行此操作或可公开访问的地方)
I know it's not the browser window, but you can't see the phpinfo();
contents without making the function call. Obviously, the best approach would be to have a phpinfo script in the root of your web server directory, that way you have access to it at all times via http://localhost/info.php
or something similar (NOTE: don't do this in a production environment or somewhere that is publicly accessible)
正如binaryLV所提到的,每次安装都有两个版本的php.ini是相当普遍的.一个用于命令行界面(CLI),另一个用于Web服务器界面.如果要查看Web服务器的phpinfo输出,请确保指定ini文件路径,例如...
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
这篇关于phpinfo()-有简单的方法查看它吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!