Latest blog entry

Howto install a PHP FileInfo module in Linux?

July 9, 2011    |   Posted by admin   |    Category: Installations

The steps to install the PHP ‘Fileinfo’ module on a Linux server is as below:

1) Download and untar the package

# wget http://pecl.php.net/get/Fileinfo-1.0.4.tgz
# tar -zxf Fileinfo-1.0.4.tgz
# cd Fileinfo-1.0.4

2) Generate the extension for compiling

# phpize

3) Configure the module

# ./configure

4) generate the install files and install it

# make 
# make install

5) Now the extension will be available under the /usr/lib64/php/modules directory. You now need to add the extension somewhere in the php configuration file.

Edit /etc/php.ini and add the following:

extension=fileinfo.so

6) Save the file and restart the webserver

# service httpd restart

To verify fileinfo module is enabled properly, execute:

# php -i | grep fileinfo
fileinfo support => enabled

Alternate method

Just an FYI, the module can also be installed using the PECL command i.e.

# pecl install fileinfo

Once done, just follow steps 5 and 6 mentioned above to enable it. That’s it.

Comments Off on Howto install a PHP FileInfo module in Linux?

How to install PHP-Json module on a Linux Plesk server?

May 20, 2011    |   Posted by admin   |    Category: Installations, Plesk Management

To install/enable Json support for PHP on a Linux Plesk server, follow the below steps:

1. Install php-pear and gcc

# yum install php-pear gcc

2. Install json module

# pecl install json

3. Now, the json.so file is created under the php lib directory i.e. /usr/lib64/php/modules/ and needs to be called in the json.ini so PHP configuration could read it.

# cd /etc/php.d 
# echo "extension=json.so" >> json.ini

4. Once done, restart the httpd service

# /etc/init.d/httpd restart

This is it.

However, the other way is to manually install the php-json module. Follow the below steps:

1. Download the json package

# wget http://pecl.php.net/get/json-1.2.0.tgz

2. Untar and goto the newly created directory

# tar -zxf json-1.2.0.tgz 
# cd json-1.2.0

3. Create the configuration files and configure json

# phpize 
# ./configure

4. Create the installation file and install it

# make 
# make install

Once done, json.so will be created in /usr/lib64/php/modules/ directory and needs to be called by the php configuration directory

# cd /etc/php.d 
# echo “extension=json.so” >> json.ini

Restart the httpd service and check the php-json module by executing

# php -m | grep json

Note:  The manual installation method can be used on a plain Linux server as well, just the extension need to be added in the php.ini file directly.

Comments Off on How to install PHP-Json module on a Linux Plesk server?

How to install PDFlib-Lite & PDFlib on a CentOS server?

January 13, 2011    |   Posted by admin   |    Category: Installations

PDFlib is a free library used for generating and manipulating files in Portable Document Format (PDF). The primiary goal of PDFlib is to create dynamic PDF documents on a Web server OR similar systems and to allow a “save as PDF” capability.

The following steps will help you to install PDFlib-lite and PDFlib on a CentOS server OR even on a cPanel and Plesk servers.

SSH to the server as a ‘root’ user:

1) Download the PDFlib-Lite package required for PDFlib installation in a temporary directory

# cd /usr/local/src 
# wget http://www.pdflib.com/binaries/PDFlib/705/PDFlib-Lite-7.0.5.tar.gz

2) Unpack the package and goto the PDFlib-Lite directory

# tar -zxf PDFlib-Lite-7-* 
# cd PDFlib-Lite-7.0*

3) Now, configure PDFlib-Lite

# ./configure --prefix=/usr/local

4) Create the installation files and install PDFlib-Lite

# make 
# make install

5) Once PDFlib-Lite is installed, download ‘PDFlib’ using pecl.

# pecl download pdflib

6) Unpack the package and goto the PDFlib-Lite directory

# tar xvzf pdflib-*.tgz 
# cd pdflib-*

7) Create configuration files

# phpize

8 ) Now, configure PDFlib

# ./configure

9) Create the installation files and install PDFlib

# make 
# make install

A pdf.so file will be created in the PHPs extension directory which you can locate using the following command. If the file is not created there, copy it from the current location to the extension directory.

# php -i | grep extension_dir

The final step is to add the PDFLib extension in the php.ini file and restart the Web Server.

extension="pdf.so"

Note: Using the above instructions, PDFlib can be installed on the cPanel and Plesk servers as well. Though the location of extension_dir and php.ini are different, they can easily be located using the commands above.

How to install and configure APC Cache on a CentOS server?

December 18, 2010    |   Posted by admin   |    Category: Installations

APC cache is a PHP caching solution which stands for Alternative PHP Cache. It serves PHP pages from a cache thus helping to reduce server load. APC is an open source software and is updated from time to time.

The following are the steps to install APC cache on a cPanel / Plesk OR even on a plan CentOS server:

1) SSH to your server and go to a temporary directory

# cd /usr/local/src

2) Download the latest APC version

# wget http://pecl.php.net/get/APC-3.1.6.tgz

3) Unpack the version and change to the APC directory

# tar -zxf APC-3.1.6.tgz 
# cd APC-*

4) Create configuration files

# phpize

5) Search for the “php-config” file since you need to configure APC with it

# which php-config

6) Now, configure APC

# ./configure --enable-apc --enable-apc-mmap --with-apxs\
 --with-php-config=/usr/local/bin/php-config

7) Create the installation files and install APC

# make 
# make install

Now that the APC cache is installed on your server, the final step is to activate the APC extension in the php.ini file.

Locate the working php.ini file of your server

# php -i | grep php.ini

edit the file and search for “extension_dir” and place the following code below it (tweak the values as per your requirement):

extension="apc.so" 
apc.enabled=1 
apc.shm_segments=1 
apc.shm_size=256 
apc.ttl=3600 
apc.user_ttl=7200 
apc.num_files_hint=1024 
apc.mmap_file_mask=/tmp/apc.XXX 
apc.enable_cli=1

Restart the Apache web server  for changes to take affect. To confirm if APC is activated, execute

# php -i | grep apc

Note: once APC is installed, make sure the ‘apc.so’ file is created under the directory specified at the “extension_dir” in php.ini. If not, look for the exact path of the file and create a symlink under it.

Howto: Enable/Install T1Lib PHP support in cPanel

February 11, 2010    |   Posted by admin   |    Category: Installations

How to enable/install the T1Lib module on a cPanel server?

T1Lib is mainly required with GD module but there is no option to enable T1Lib via easyapache OR to install it using yum. You will either have to compile PHP manually with the T1lib option i.e. –with-t1lib OR by including the module in the rawopts file.

Easyapache mostly offers all the modules that is basically required but some unique modules like T1lib is not offered in which case, you can add it to rawopts file.

EasyApache during the compilation process, look for this file and compile any module mention in there along with the modules it offers. But before executing easyapache, install T1Lib manually.

SSH to your server as root user and goto a temporary directory

# cd /usr/local/src

Download T1Lib

# wget ftp://sunsite.unc.edu/pub/linux/libs/graphics/t1lib-5.1.2.tar.gz

Unpack the package and enter the directory

# tar -zxf t1lib-5.1.2.tar.gz
# cd t1lib-*

Configure T1Lib

# ./configure

Create the installation files and install

# make
# make install

Now, once T1Lib is installed, create a “all_php5” file under the ‘rawopts’ directory

# touch /var/cpanel/easy/apache/rawopts/all_php5

Add the following line to it

# echo --with-t1lib=/usr >> /var/cpanel/easy/apache/rawopts/all_php5

Make sure to add other custom modules one per line if you need them. Now, the next step is to rebuild Apache + PHP via the usual method

# /scripts/easyapache

Just go through the options you normally do and the custom module will be picked up automatically.

Once Apache + PHP is compiled, you can either verify it from the command prompt

# php -i | grep t1lib

Or by creating a phpinfo.php file under the default directory of the server and access it via the web i.e.

http://yourserverip/phpinfo.php

You should see the “T1Lib” module under the GD section of that file.

Comments Off on Howto: Enable/Install T1Lib PHP support in cPanel