php.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/bin/bash
  2. RETCODE=$(fw_exists ${IROOT}/php.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/php.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} php
  16. cd php
  17. echo "Configuring PHP quietly..."
  18. ./configure --prefix=$PHP_HOME --with-pdo-mysql \
  19. --with-mysql --with-mcrypt --enable-intl --enable-mbstring \
  20. --enable-fpm --with-fpm-user=testrunner --with-fpm-group=testrunner \
  21. --with-openssl --with-mysqli --with-zlib --enable-opcache --quiet
  22. echo "Making PHP quietly..."
  23. make --quiet
  24. echo "Installing PHP 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. cp $FWROOT/config/php.ini $PHP_HOME/lib/php.ini
  32. cp $FWROOT/config/php-fpm.conf $PHP_HOME/lib/php-fpm.conf
  33. # =======================
  34. #
  35. # Install the PHP extensions that our tests need
  36. # Install all of them here becuase our config file references
  37. # all of these *.so
  38. # ========================
  39. echo PHP compilation finished, installing extensions
  40. $PHP_HOME/bin/pecl channel-update pecl.php.net
  41. # Apc.so
  42. $PHP_HOME/bin/pecl config-set php_ini $PHP_HOME/lib/php.ini
  43. printf "\n" | $PHP_HOME/bin/pecl -q install -f redis-2.2.5
  44. # mongo.so
  45. printf "\n" | $PHP_HOME/bin/pecl -q install -f mongo
  46. # Clean up a bit
  47. rm -rf $IROOT/php
  48. echo "export PHP_HOME=${PHP_HOME}" > $IROOT/php.installed
  49. echo -e "export PATH=\$PHP_HOME/bin:\$PHP_HOME/sbin:\$PATH" >> $IROOT/php.installed
  50. source $IROOT/php.installed