Activities

March 2015
M T W T F S S
« Feb   Apr »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

How do I install/uninstall External php extensions in WHM/Cpanel server

I had requested to enable FileInfo php extension in one of the production server. What I know to solve this issue was recompile the php using EasyApache. Even though I can able to enable this extension using this mechanism, it takes lot of time and may be conflict with other php packages sometimes.

After having few minutes Googling, I found WHM itself has a separate tool which will called php-extension-manager to do the same. So this will be the best hazardless approach to manage php extesnions.

1. How to list the Third party extensions available for PHP

root@web01 [~]# /scripts/phpextensionmgr list
Available Extensions:
EAccelerator
IonCubeLoader
Zendopt
Xcache
SourceGuardian
PHPSuHosin

2. How to verify a third party extension is enabled or not

root@web01 [~]# /scripts/phpextensionmgr status EAccelerator
Determining status of EAccelerator
EAccelerator extension is NOT installed
root@web01 [~]#

3. Installing Extensions

/scripts/phpextensionmgr  install Xcache

4. Uninstalling Extensions

root@web01 [~]# /scripts/phpextensionmgr  uninstall Xcache
Uninstalling Xcache
Removing xcache from /usr/local/lib/php.ini
root@web01 [~]#

4. How to list all the php extension enabled

root@web01[~]# php -m  | more
[PHP Modules]
apc
bcmath
bz2
calendar
Core
ctype
curl
date
dom
ereg
fileinfo
filter
ftp
gd
gettext
hash
iconv
imap
ionCube Loader
json
libxml
mbstring
--More--

5. How do I list a variable value configured in PHP

Eg : php -r ‘phpinfo();’ | grep “

root@web01 [~]# php -r 'phpinfo();' | grep "memory_limit"
memory_limit => 32M => 32M
root@web01 [~]#

Note : Each of PHP command line variables and Web server variables may not be same always. We can set each php.ini file for both environments.

6. How do I list all the php configuration files

[root@rc-158 ~]# php --ini
Configuration File (php.ini) Path: /etc
Loaded Configuration File:         /etc/php.ini
Scan for additional .ini files in: /etc/php.d
Additional .ini files parsed:      /etc/php.d/curl.ini,

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>