Configure PHP to Support OpenSSL PHP Extensions

What is openssl php extension ?

Php module that  uses the functions of » OpenSSL for generation and verification of signatures and for sealing (encrypting) and opening (decrypting) data.

System requirement
*   - Apache2
*   - Php
*   - OpenSSL

Preparing and Download all Packages

In this tutorial i have already installed Apache2 and Php 5.2.5 . I just need to add OpenSSL module on my php i also decided to upgrade my php from 5.2.5 to 5.2.9. First you need to download the Php ( and Openssl sourcode (


Extract and compile the openssl

#cd /root
#tar -zxvf openssl-0.9.8k.tar.gz
#cd openssl-0.9.8k
#./config && make && make install

Extract, configure and installed the php

Before you configure the php sourcecode you must remember the previous php configuration right ? if not you can use php -i |grep configure to see the previous configuration

#php -i |grep configure
Configure Command =>  './configure'  '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-mysql=/usr/local/mysql' '--with-gd=/usr/local' '--with-jpeg-dir=/usr/local/lib' '--with-zlib-dir=/usr/local' '--with-ftp' '--with-gif' '--enable-ftp' '--with-png-dir=/usr/local/lib' '--with-freetype-dir=/usr/local' '--with-curl=/usr/local'

Now you have the config list, start the php installation

#cd /root
#tar -zxvf php-5.2.9.tar.gz
#cd php-5.2.9
./configure --with-openssl=/usr/local/ssl  --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-gd=/usr/local --with-jpeg-dir=/usr/local/lib --with-zlib-dir=/usr/local --with-ftp --with-gif --enable-ftp --with-png-dir=/usr/local/lib --with-freetype-dir=/usr/local --with-curl=/usr/local

#make install

And the last thing don't forget to restart your apache2

#/usr/local/apache2/bin/apachectl stop
#/usr/local/apache2/bin/apachectl start

Now check your openssl module

#php -m | grep openssl
Or you verify openssl from phpinfo
Create phpinfo.php file

#pico phpinfo.php

<? phpinfo(); ?>

and open phpinfo through your browser
if you see openssl it means you did it


Facebook Fans