How to recompile PHP to upgrade or add new extensions in VPS Print

  • 24

If you want to upgrade PHP or install a new extension in your VPS, follow these steps:

  1. Go to /usr/src/
  2. If the source of PHP is already here go into the directory (ie. php-5.3.9), otherwise download the tarball and uncompress it here
  3. grab the current configure command by executing php -i | grep configure
  4. run the configure command. If you need to add a new extension, add the new extension to the end of the configure line with the existing extensions: 

    './configure'  '--with-apxs2=/usr/sbin/apxs' '--with-gd' '--with-pdo-mysql' '--with-curl' '--with-mysql' '--with-freetype-dir=/usr' '--with-jpeg-dir=/usr' '--with-mcrypt' '--with-zlib' '--enable-mbstring' '--enable-ftp' '--with-openssl'

  5. run make
  6. run make install
  7. restart apache by running service httpd restart

Was this answer helpful?

« Back