php5.sh 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/bin/bash
  2. RETCODE=$(fw_exists ${IROOT}/php5.installed)
  3. [ ! "$RETCODE" == 0 ] || { \
  4. echo "Moving PHP config files into place";
  5. sudo cp $FWROOT/config/php.ini /usr/local/lib/php.ini
  6. sudo cp $FWROOT/config/php-fpm.conf /usr/local/lib/php-fpm.conf
  7. source $IROOT/php5.installed
  8. return 0; }
  9. VERSION="5.5.17"
  10. PHP_HOME=$IROOT/php-$VERSION
  11. # Precaution, unlikely to happen.
  12. rm -rf $IROOT/php PHP_HOME cphalcon
  13. fw_get -o php-${VERSION}.tar.gz http://php.net/distributions/php-${VERSION}.tar.gz
  14. fw_untar php-${VERSION}.tar.gz
  15. mv php-${VERSION} php5
  16. cd php5
  17. echo "Configuring PHP5 quietly..."
  18. ./configure --prefix=$PHP_HOME --with-pdo-mysql \
  19. --with-mysql --with-mcrypt --enable-intl --enable-mbstring \
  20. --enable-fpm --with-openssl --with-mysqli --with-zlib \
  21. --enable-opcache --quiet
  22. echo "Making PHP5 quietly..."
  23. make --quiet
  24. echo "Installing PHP5 quietly"
  25. make --quiet install
  26. cd ..
  27. # Disable yaf and phalcon, for most PHP frameworks
  28. # (there is a similar line to enable the frameworks in their respective setup files)
  29. sed -i 's|^extension=yaf.so|;extension=yaf.so|g' $FWROOT/config/php.ini
  30. sed -i 's|^extension=phalcon.so|;extension=phalcon.so|g' $FWROOT/config/php.ini
  31. # Enable the correct Mongo DB plugin for PHP 5
  32. sed -i 's|^extension=mongodb.so|;extension=mongodb.so|g' $FWROOT/config/php.ini
  33. sed -i 's|;extension=mongo.so|extension=mongo.so|g' $FWROOT/config/php.ini
  34. cp $FWROOT/config/php.ini $PHP_HOME/lib/php.ini
  35. cp $FWROOT/config/php-fpm.conf $PHP_HOME/lib/php-fpm.conf
  36. # =======================
  37. #
  38. # Install the PHP extensions that our tests need
  39. # Install all of them here becuase our config file references
  40. # all of these *.so
  41. # ========================
  42. echo PHP compilation finished, installing extensions
  43. $PHP_HOME/bin/pecl channel-update pecl.php.net
  44. # Apc.so
  45. $PHP_HOME/bin/pecl config-set php_ini $PHP_HOME/lib/php.ini
  46. printf "\n" | $PHP_HOME/bin/pecl -q install -f redis-2.2.5
  47. # mongo.so
  48. printf "\n" | $PHP_HOME/bin/pecl -q install -f mongo
  49. # Clean up a bit
  50. rm -rf $IROOT/php
  51. echo "export PHP_HOME=${PHP_HOME}" > $IROOT/php5.installed
  52. echo -e "export PATH=\$PHP_HOME/bin:\$PHP_HOME/sbin:\$PATH" >> $IROOT/php5.installed
  53. source $IROOT/php5.installed