I'm using Ubuntu Linux 12.04 LTS on my local machine. I've installed LAMP long ago on my machine. Now I want to enable following PHP extensions:
For it first I want to check whether these PHP extensions are enabled or not. I searched a lot about how to check the installed/enabled PHP extensions but every time I found how to install these extensions on Ubuntu Linux. So can someone please let me know how should I check the enabled/disabled PHP extensions in Ubuntu Linux 12.04 LTS? Thanks in advance.
This question is related to
php
linux
ubuntu-12.04
php-extension
To check if this extensions are enabled or not, you can create a php file i.e. info.php
and write the following code there:
<?php
echo "GD: ", extension_loaded('gd') ? 'OK' : 'MISSING', '<br>';
echo "XML: ", extension_loaded('xml') ? 'OK' : 'MISSING', '<br>';
echo "zip: ", extension_loaded('zip') ? 'OK' : 'MISSING', '<br>';
?>
That's it.
For information on php extensions
etc, on site.
Create a new file and name it info.php
(or some other name.php
)
Write this code in it:
<?php
phpinfo ();
?>
Save the file in the root
(home)of the site
example.com/info.php
All the php
information on your site will be displayed.Perhaps the easiest way to see which extensions are (compiled and) loaded (not in cli) is to have a server run the following:
<?php
$ext = get_loaded_extensions();
asort($ext);
foreach ($ext as $ref) {
echo $ref . "\n";
}
PHP cli does not necessarily have the same extensions loaded.
Search extension in
/etc/php5/apache2/php.ini
You can view which modules (compiled in) are available via terminal through php -m
Source: Stackoverflow.com