php.sh 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #!/bin/bash
  2. # TODO double check this, it's logically different from original php code.
  3. # Two path checks would both always run in php. In this code the check
  4. # for apc.so only happens if the check for php fails. Is that ok?
  5. RETCODE=$(fw_exists ${IROOT}/php.installed)
  6. [ ! "$RETCODE" == 0 ] || { \
  7. echo "Moving PHP config files into place";
  8. sudo cp $FWROOT/config/php.ini /usr/local/lib/php.ini
  9. sudo cp $FWROOT/config/php-fpm.conf /usr/local/lib/php-fpm.conf
  10. source $IROOT/php.installed
  11. return 0; }
  12. VERSION="5.5.17"
  13. PHP_HOME=$IROOT/php-$VERSION
  14. fw_get http://php.net/distributions/php-${VERSION}.tar.gz -O php-${VERSION}.tar.gz
  15. fw_untar php-${VERSION}.tar.gz
  16. mv php-${VERSION} php
  17. cd php
  18. echo "Configuring PHP quietly..."
  19. ./configure --prefix=$IROOT/php-${VERSION} --with-pdo-mysql \
  20. --with-mysql --with-mcrypt --enable-intl --enable-mbstring \
  21. --enable-fpm --with-fpm-user=testrunner --with-fpm-group=testrunner \
  22. --with-openssl --with-mysqli --with-zlib --enable-opcache --quiet
  23. echo "Making PHP quietly..."
  24. make --quiet
  25. echo "Installing PHP quietly"
  26. make --quiet install
  27. cd ..
  28. cp $FWROOT/config/php.ini $IROOT/php-${VERSION}/lib/php.ini
  29. cp $FWROOT/config/php-fpm.conf $IROOT/php-${VERSION}/lib/php-fpm.conf
  30. # =======================
  31. #
  32. # Install the PHP extensions that our tests need
  33. # Install all of them here becuase our config file references
  34. # all of these *.so
  35. # ========================
  36. echo PHP compilation finished, installing extensions
  37. $IROOT/php-${VERSION}/bin/pecl channel-update pecl.php.net
  38. # Apc.so
  39. $IROOT/php-${VERSION}/bin/pecl config-set php_ini $IROOT/php-${VERSION}/lib/php.ini
  40. printf "\n" | $IROOT/php-${VERSION}/bin/pecl -q install -f redis
  41. # yaf.so
  42. printf "\n" | $IROOT/php-${VERSION}/bin/pecl -q install -f yaf
  43. # phalcon.so
  44. # The configure seems broken, does not respect prefix. If you
  45. # update the value of PATH then it finds the prefix from `which php`
  46. git clone --depth=1 --branch=phalcon-v1.3.2 --single-branch \
  47. --quiet git://github.com/phalcon/cphalcon.git
  48. cd cphalcon/build/64bits
  49. $PHP_HOME/bin/phpize
  50. # For some reason we have to point to php-config
  51. # explicitly, it's not found by the prefix settings
  52. ./configure --prefix=$PHP_HOME --exec-prefix=$PHP_HOME \
  53. --with-php-config=$PHP_HOME/bin/php-config \
  54. --enable-phalcon --quiet
  55. make --quiet
  56. make install
  57. # mongo.so
  58. printf "\n" | $IROOT/php-${VERSION}/bin/pecl -q install -f mongo
  59. # Clean up a bit
  60. rm -rf $IROOT/php
  61. echo "export PHP_HOME=${IROOT}/php-5.5.17" > $IROOT/php.installed
  62. echo -e "export PATH=${PHP_HOME}/bin:$PHP_HOME/sbin:\$PATH" >> $IROOT/php.installed
  63. source $IROOT/php.installed