ini_get to collect settings from php.ini file

Read a PHP setting with ini_get()

ini_get() returns the current value of a configuration option. Not every directive is available or meaningful in every environment, so check the returned value before using it.

<?php
$limit = ini_get('memory_limit');
echo $limit;

Getting & setting PHP values of php.ini and getting server, operating system & PHP details to Manage


PHP installation details and configuration settings are kept in php.ini file which is kept at server root or in PHP directory ( or in Windows dir ) . In a shared hosting these data can be views by using phpinfo function. Set value of each data can be identified by using ini_get function. Here are some examples. The outputs given here will change based on your php.ini settings at your server.

echo ini_get('upload_max_filesize');       // Output is by default 2M
echo ini_get('mysql.max_links'); // OUTPUT -1
echo ini_get('mysql.connect_timeout'); // OUTPUT 60
Please note that the output are not numeric, the output of upload_max_filesize can't be used directly as numeric value.

Some of the data we can change at script level by using ini_set function.

If we want to get all the setting data we can use ini_get_all function. Here is the code.

print_r(ini_get_all());
A full list will be displayed.
Change some of php.ini settings by using ini_set()
php_uname() PHP Version Introduction to PHP Guide to installation and How to write our first PHP Script



Subscribe to our YouTube Channel here



plus2net.com











PHP video Tutorials
✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer