I think that a function called phpinfo is a function displaying environment of PHP, but results of phpinfo which I carried out from a command-line as a result of phpinfo that I displayed it on a Web server are different.
Why will these be different?
I want to become the same result.
I think that a function called phpinfo is a function displaying environment of PHP,
Share
PHP called from your webserver can be configured very differently from your command line PHP.
It depends on your webserver setup. If you have your webserver simply call your
/usr/local/bin/php(or similar) binary then you will have mostly identical output(except without any of the CGI environment variables such as HTTP_HOST, REFERRER, etc.On the other hand, if you are using
mod_phpwith apache or php through fast-cgi, your phpinfo will return different values, asmod_phpis a separately compiled module for php. It does not call the standardphpcommand that you access through the command line.Another possible reason for the differences are that your webserver is using a different
php.inifile. Thephp.inifile tells php what extensions to load, and basically can set most of the parameters that are found on aphpinfo()page.It will be hard to make these the same result, unless you can configure your webserver to not send any HTTP headers through to your PHP script, and make sure your php setup for your webserver matches(or directly calls) your command line php build. You can ensure that the php.ini files are the same–
phpinfo()contains the name of the currently loaded configuration file.I don’t think you’ll be able to get them identical regardless, and I don’t understand why you want the output to be identical. If you want the settings to be similar, you will want to edit the respective
php.inifile to change the settings to what you would like them to be. Also, if you don’t have access to thephp.inifile, you can use the php functionini_set()to set some configuration varibles at run time.