00 Votes

PHP: Read out particular PHP settings

Question by Guest | 2016-02-24 at 10:48

I know, that it is possible to use the function phpinfo() in order to show a large list of all PHP settings available.

However, I do not need the entire list, but only some values of a few specific parameters to get some information about my configuration.

Is there any possibility to only display a specific value instead of the whole list? For example, only the values for "post_max_size", "upload_max_filesize" or another key?

ReplyPositiveNegative
0Best Answer0 Votes

Yes. PHP is providing a function for this and the function is called ini_get(). You can pass your desired parameter to this function and you will get the corresponding value from your PHP configuration:

echo ini_get('post_max_size');

$umf = ini_get('upload_max_filesize');
echo $umf;

The result could be 16M, for example. If you would like to have the value in bytes, you have to multiply by 1024 in case of a K or by 10366976 in case of M. 
2016-02-24 at 11:04

ReplyPositive Negative
Reply

Related Topics

VirtualBox: Change Date and Time

Tutorial | 10 Comments

PHP: Upload of large Files

Tutorial | 0 Comments

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own article on askingbox.com. That’s how it’s done.