php7.sh 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 --disable-debug \
  20. --with-zlib --with-pdo-mysql=mysqlnd \
  21. --enable-intl --enable-mbstring \
  22. --enable-fpm --with-openssl \
  23. --with-mysqli=mysqlnd --enable-huge-code-pages \
  24. --quiet
  25. echo "Making PHP quietly..."
  26. make -j2 --quiet
  27. echo "Installing PHP 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 7
  35. sed -i 's|^extension=mongo.so|;extension=mongo.so|g' $FWROOT/toolset/setup/linux/languages/php/php.ini
  36. sed -i 's|;extension=mongodb.so|extension=mongodb.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/php7/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 PHP7 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-3.0.0
  52. #removed phalcon install - separate to toolset/setup/linux/frameworks
  53. # yaf.so - get working for php7 - also separate
  54. #printf "\n" | $PHP_HOME/bin/pecl -q install -f yaf
  55. # mongodb.so - mongo.so deprecated in php7 use mongodb.so
  56. printf "\n" | $PHP_HOME/bin/pecl -q install -f mongodb
  57. echo "export PHP_HOME=${PHP_HOME}" > $IROOT/php7.installed
  58. echo -e "export PATH=\$PHP_HOME/bin:\$PHP_HOME/sbin:\$PATH" >> $IROOT/php7.installed
  59. source $IROOT/php7.installed