WebFaction
Community site: login faq
1
1

I need to install and use my own PHP with a custom cURl and OpenSSL which can also be used later if I want custom extensions.

asked 10 Mar '12, 22:19

neeravk
1.5k3412
accept rate: 41%


You can do the above by the following commands:

The steps to install your own OpenSSL/cURL/PHP

Install OpenSSL

mkdir ~/src
cd ~/src
wget http://www.openssl.org/source/openssl-1.0.0g.tar.gz
tar -xzf openssl-1.0.0g.tar.gz 
cd openssl-1.0.0g
./Configure --prefix=$HOME linux-x86_64
make
make install

Install Curl

cd ~/src
wget http://curl.haxx.se/download/curl-7.24.0.tar.gz
tar -xzf curl-7.24.0.tar.gz 
cd curl-7.24.0
./configure --prefix=$HOME --with-ssl=$HOME/lib
make
make install

Build PHP 5.4 against the cURL/OpenSSL installed above

cd ~/src
wget http://in2.php.net/get/php-5.4.0.tar.bz2/from/sg2.php.net/mirror
tar -xjf php-5.4.0.tar.bz2 
cd php-5.4.0
./configure --prefix=$HOME --with-pdo-mysql --with-pdo-pgsql=/usr/pgsql-9.1 --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-mbstring --enable-soap --enable-zip --with-curl=$HOME --with-freetype-dir --with-gd --with-gettext --with-gmp --with-iconv --with-jpeg-dir --with-kerberos --with-mhash --with-mysql --with-mysqli --with-openssl=$HOME --with-pgsql=/usr/pgsql-9.1 --with-png-dir --with-regex --with-xmlrpc --with-xsl --with-zlib-dir --with-config-file-path=$HOME/lib --without-pear --enable-sockets --enable-intl --with-mysql-sock=/var/lib/mysql/mysql.sock
make
make install

Convert your app to use your own PHP installation

cd ~/webapps/example_app
cp $HOME/bin/php-cgi my_php.cgi
echo "
Action php_custom /my_php.cgi
<FilesMatch .php$>
    SetHandler php_custom
</FilesMatch>
">>.htaccess

If you want to use FastCGI

cd ~/webapps/example_app
cp $HOME/bin/php-cgi my_php.fcgi
echo "
Action php_custom /my_php.fcgi
<FilesMatch .php$>
    SetHandler php_custom
</FilesMatch>
">>.htaccess

permanent link

answered 10 Mar '12, 22:24

neeravk
1.5k3412
accept rate: 41%

edited 11 Mar '12, 20:22

Hi, I followed your steps above to install curl into my Red Hat Server. But when i run "make", the command line responded me an error " ../lib/.libs/libcurl.so: undefined reference to ERR_remove_thread_state' collect2: ld returned 1 exit status make[2]: *** [curl] Error 1 make[2]: Leaving directory/root/src/curl-7.26.0/src' make[1]: [all] Error 2 make[1]: Leaving directory `/root/src/curl-7.26.0/src' make: [all-recursive] Error 1 ". What am i missing? I followed all your steps above but i got stock on step 2. I have installed " openssl-1.0.1c " and going to install curl " curl-7.26.0 "

(27 May '12, 05:23) littlelorly

Those instructions are for our CentOS servers, there could be a number of differences with RedHat. I'd suggest posting this question on StackOverflow or another generic community site - this one is just for Webfaction's customers.

(27 May '12, 05:52) todork

I followed your instructions and made a php.ini file in the root folder of my application and it seems to work. How do I run php on the command line so it uses this new php.ini file as well?

(03 Aug '12, 09:01) intrepion

The -c flag,

  -c <path>|<file> Look for php.ini file in this directory
(03 Aug '12, 18:35) johns

When I try to follow the instructions (but downloading php 5.3 instead of 5.4) I'm getting this error:

$ ./configure --prefix=$HOME --with-pdo-mysql --with-pdo-pgsql=/usr/pgsql-9.1 --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-mbstring --enable-soap --enable-zip --with-curl=$HOME --with-freetype-dir --with-gd --with-gettext --with-gmp --with-iconv --with-jpeg-dir --with-kerberos --with-mhash --with-mysql --with-mysqli --with-openssl=$HOME --with-pgsql=/usr/pgsql-9.1 --with-png-dir --with-regex --with-xmlrpc --with-xsl --with-zlib-dir --with-config-file-path=$HOME/lib --without-pear --enable-sockets --enable-intl --with-mysql-sock=/var/lib/mysql/mysql.sock
creating cache ./config.cache
checking for Cygwin environment... no
checking for mingw32 environment... no
...

configure: error: Cannot find libmysqlclient under /usr.
Note that the MySQL client library is not bundled anymore!

Are the instructions any different for php 5.3? (note, I'm also using OpenSSL 0.9.8 instead of 1.0.0)

permanent link

answered 13 Mar '12, 14:05

yoav_aner
113
accept rate: 0%

edited 13 Mar '12, 14:17

Try adding this flag to the configure command,

--with-libdir=lib64
(13 Mar '12, 18:35) johns

I did, but then it fails with

... checking for X509_free in -lcrypto... yes checking for pkg-config... /usr/bin/pkg-config configure: error: Cannot find OpenSSL's libraries

(14 Mar '12, 02:10) yoav_aner

Was OpenSSL correctly installed before? If yes, please file a support ticket, so we can take a better look.

(14 Mar '12, 02:16) neeravk

The problem was that when the libdir was changed to lib64 above, the install also looked for OpenSSL in ~/lib64 instead of ~/lib hence

ln -s ~/lib ~/lib64

was needed

(04 Apr '12, 05:38) neeravk
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×262
×8

question asked: 10 Mar '12, 22:19

question was seen: 83,095 times

last updated: 03 Aug '12, 18:35

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM