php5.sh 2.5 KB

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