Sunday, November 28, 2010

How to load a php extension in LINUX/UBUNTU

PHP has a lot of extension. It may be possible that PHP has not compiled with all extensions. If some extension is missing and it is required for our application then PHP need to enable that.
Enable an extension in Window environment is easy. Open php.ini file and remove the ; before the module and restart the server. But, to enable an extension in LINUX, it is not so easy. Steps are below:
1. open synaptic with admin controls...    
        sudo synaptic
2. Search your extension which you want to load using search tool
3. Select extension(s) from the list.
4. Click on apply. Selected extension(s) will be installed


   

5. Now open php.ini file (/etc/php5/apache2/php.ini) and add following line
;for windows environment, use .dll
extension=newextension.dll

;for LINUX environment, use .so

extension=newextension.so
For example, to install curl,ffmpeg and json
extension=php_curl.dll
extension=ffmpeg.so
extension=json.so

6. Save the file and restart the apache by writing following line in terminal window.
sudo /etc/init.d/apache2 restart

The most easiest way to install an extension in ubuntu flavor is below:
Open Applications > Accessories > terminal
write sudo apt-get install extension1 extension2 extension3.
For example, to install curl extension, command should be like this
sudo apt-get install curl libcurl3 libcurl3-dev php-curl

No comments:

Post a Comment

Thanks for your valuable comments.

Important queries based formulas to watch performance of a MySQL based application

(1) Session Vs global status variables value select G.variable_name,G.variable_value GlobalValue,S.variable_value SessionValue from (selec...