Hi guys, i want to to know the follownig status in my php.ini file


1 zip is enabled or not
2 openssl is enabled or not

i treied using ini_get('zip') but its not working
pls help me out.


Thanks in advance

Recommended Answers

All 4 Replies

A quick way too check your setup is normally called phpinfo.php and looks like this. You will be pleasantly supprised at the amount of data it provides:

<?php
phpinfo();
?>

Thank you rch1231, but my problem is. I am creating a setup script for my application, where it has to show max_upload_filesize and something stuff like that, I am retrieving it using ini_get(' '),is there anything that I can get its value using ini_get(' ')

phpinfo gives you the data and more but you need something to show it in php...

<?php
/*
Our php.ini contains the following settings:

display_errors = On
register_globals = Off
post_max_size = 8M
*/

echo 'display_errors = ' . ini_get('display_errors') . "\n";
echo 'register_globals = ' . ini_get('register_globals') . "\n";
echo 'post_max_size = ' . ini_get('post_max_size') . "\n";
echo 'post_max_size+1 = ' . (ini_get('post_max_size')+1) . "\n";
echo 'post_max_size in bytes = ' . return_bytes(ini_get('post_max_size'));

function return_bytes($val) {
    $val = trim($val);
    $last = strtolower($val[strlen($val)-1]);
    switch($last) {
        // The 'G' modifier is available since PHP 5.1.0
        case 'g':
            $val *= 1024;
        case 'm':
            $val *= 1024;
        case 'k':
            $val *= 1024;
    }

    return $val;
}

?>

You can't get information on installed extentions that way (as far as I know). You could check for FUNCTIONS; for example, to check for OPENSSL, you could do >

if (function_exists('openssl_open')) {
echo "OPENSSL functions are available";
} else {
echo "OPENSSL functions are not available, thus, OPENSSL isn't installed!";
}

For zip, just check for zip_open.
Good luck.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.