php7.sh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/bin/bash
  2. RETCODE=$(fw_exists ${IROOT}/php7.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/php7/ext/session/mod_files.sh /tmp/php_sessions 3 5
  9. source $IROOT/php7.installed
  10. return 0; }
  11. VERSION="7.2.1"
  12. PHP_HOME=$IROOT/php-$VERSION
  13. rm -rf $IROOT/php7
  14. fw_get -o php-${VERSION}.tar.gz http://php.net/distributions/php-${VERSION}.tar.gz
  15. fw_untar php-${VERSION}.tar.gz
  16. mv php-${VERSION} php7
  17. cd php7
  18. echo "Configuring PHP quietly..."
  19. ./configure --prefix=$PHP_HOME --with-pdo-mysql \
  20. --enable-intl --enable-mbstring \
  21. --enable-fpm --with-openssl --with-mysqli \
  22. --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. # Disable yaf and phalcon, for most PHP frameworks
  29. # (there is a similar line to enable the frameworks in their respective setup files)
  30. sed -i 's|^extension=yaf.so|;extension=yaf.so|g' $FWROOT/toolset/setup/linux/languages/php/php.ini
  31. sed -i 's|^extension=phalcon.so|;extension=phalcon.so|g' $FWROOT/toolset/setup/linux/languages/php/php.ini
  32. # Enable the correct Mongo DB plugin for PHP 7
  33. sed -i 's|^extension=mongo.so|;extension=mongo.so|g' $FWROOT/toolset/setup/linux/languages/php/php.ini
  34. sed -i 's|;extension=mongodb.so|extension=mongodb.so|g' $FWROOT/toolset/setup/linux/languages/php/php.ini
  35. cp $FWROOT/toolset/setup/linux/languages/php/php.ini $PHP_HOME/lib/php.ini
  36. cp $FWROOT/toolset/setup/linux/languages/php/php-fpm.conf $PHP_HOME/lib/php-fpm.conf
  37. rm -rf /tmp/php_sessions
  38. /bin/bash $IROOT/php7/ext/session/mod_files.sh /tmp/php_sessions 3 5
  39. # =======================
  40. #
  41. # Install the PHP extensions that our tests need
  42. # Install all of them here becuase our config file references
  43. # all of these *.so
  44. # ========================
  45. echo PHP7 compilation finished, installing extensions
  46. $PHP_HOME/bin/pecl channel-update pecl.php.net
  47. # Apc.so
  48. $PHP_HOME/bin/pecl config-set php_ini $PHP_HOME/lib/php.ini
  49. #printf "\n" | $PHP_HOME/bin/pecl -q install -f redis-3.0.0
  50. #removed phalcon install - separate to toolset/setup/linux/frameworks
  51. # yaf.so - get working for php7 - also separate
  52. #printf "\n" | $PHP_HOME/bin/pecl -q install -f yaf
  53. # mongodb.so - mongo.so deprecated in php7 use mongodb.so
  54. printf "\n" | $PHP_HOME/bin/pecl -q install -f mongodb
  55. echo "export PHP_HOME=${PHP_HOME}" > $IROOT/php7.installed
  56. echo -e "export PATH=\$PHP_HOME/bin:\$PHP_HOME/sbin:\$PATH" >> $IROOT/php7.installed
  57. source $IROOT/php7.installed