thecrypticace

Build & Install Intl extension for PHP on an (gs) server

Jul 21st, 2012
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.57 KB | None | 0 0
  1. # Needed exports
  2. export PHPPATH=`php-latest -i | grep "Configure Command" | perl -pe "s/.*'.\/configure'\s*?'--prefix\=(.*?)'.*/\1/"`;
  3. export LIBDIR=$HOME/data/lib; export SRCDIR=$LIBDIR/src;
  4.  
  5. # Create the data/lib and data/lib/php directory if it does not exist already
  6. if [ ! -d "$LIBDIR" ]; then
  7.     mkdir $HOME/data/lib;
  8. fi
  9.  
  10. if [ ! -d "$LIBDIR/php" ]; then
  11.     mkdir $HOME/data/lib/php;
  12. fi
  13.  
  14.  
  15. # Create a source directory for ICU and PHP (for ext/intl)
  16. cd $LIBDIR && mkdir src && mkdir ICU-49.1.2 && cd src;
  17.  
  18. # Download and extract the required archives
  19. wget http://download.icu-project.org/files/icu4c/49.1.2/icu4c-49_1_2-src.tgz && tar xzvf icu4c-49_1_2-src.tgz;
  20. wget http://us3.php.net/get/php-5.3.13.tar.gz/from/this/mirror && tar xzvf mirror;
  21. rm icu4c-49_1_2-src.tgz mirror;
  22.  
  23. # Build ICU
  24. cd icu/source;
  25.  
  26.     # configure without prefix to allow make to run correctly
  27.     ./runConfigureICU Linux && make;
  28.  
  29.     # reconfigure with prefix for make install
  30.     ./configure --prefix=$SRCDIR/ICU-49.1.2;
  31.  
  32.     # Magic
  33.     make install;
  34.  
  35. cd $SRCDIR/php-5.3.13/ext/intl;
  36.  
  37. # More Magic
  38. $PHPPATH/bin/phpize;
  39.  
  40. # Run configure
  41. ./configure --with-php-config=$PHPPATH/bin/php-config --with-icu-dir=$SRCDIR/ICU-49.1.2 && make;
  42.  
  43. # Install extension
  44. cp modules/intl.so $LIBDIR/php/
  45.  
  46. # cleanup
  47. cd $LIBDIR && rm -R src;
  48.  
  49. echo "----------------------------------------------------------------"; echo "You WILL need to add the line:"; echo "    extension=$LIBDIR/php/intl.so"; echo "to your php.ini for the Intl to be available"'!'; echo "----------------------------------------------------------------";
Advertisement
Add Comment
Please, Sign In to add comment