php.sh 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. cp $FWROOT/config/php.ini $PHP_HOME/lib/php.ini
  28. cp $FWROOT/config/php-fpm.conf $PHP_HOME/lib/php-fpm.conf
  29. # =======================
  30. #
  31. # Install the PHP extensions that our tests need
  32. # Install all of them here becuase our config file references
  33. # all of these *.so
  34. # ========================
  35. echo PHP compilation finished, installing extensions
  36. $PHP_HOME/bin/pecl channel-update pecl.php.net
  37. # Apc.so
  38. $PHP_HOME/bin/pecl config-set php_ini $PHP_HOME/lib/php.ini
  39. printf "\n" | $PHP_HOME/bin/pecl -q install -f redis
  40. # yaf.so
  41. printf "\n" | $PHP_HOME/bin/pecl -q install -f yaf
  42. # phalcon.so
  43. # The configure seems broken, does not respect prefix. If you
  44. # update the value of PATH then it finds the prefix from `which php`
  45. git clone --depth=1 --branch=phalcon-v1.3.2 --single-branch \
  46. --quiet git://github.com/phalcon/cphalcon.git
  47. cd cphalcon/build/64bits
  48. $PHP_HOME/bin/phpize
  49. # For some reason we have to point to php-config
  50. # explicitly, it's not found by the prefix settings
  51. ./configure --prefix=$PHP_HOME --exec-prefix=$PHP_HOME \
  52. --with-php-config=$PHP_HOME/bin/php-config \
  53. --enable-phalcon --quiet
  54. make --quiet
  55. make install
  56. # mongo.so
  57. printf "\n" | $PHP_HOME/bin/pecl -q install -f mongo
  58. # Clean up a bit
  59. rm -rf $IROOT/php
  60. echo "export PHP_HOME=${PHP_HOME}" > $IROOT/php.installed
  61. echo -e "export PATH=\$PHP_HOME/bin:\$PHP_HOME/sbin:\$PATH" >> $IROOT/php.installed
  62. source $IROOT/php.installed