Advertisement
Guest User

Untitled

a guest
Nov 3rd, 2013
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.63 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # Package versions
  4.  
  5. # PHP version to install
  6. phpver=5.4.21
  7.  
  8. #APC extension version to install
  9. apcver=3.1.13
  10.  
  11. # Imagick extension version to install
  12. imagickver=3.1.2
  13.  
  14. # Install PHP/FPM
  15.  
  16. mkdir -p /home/${USER}/src/php
  17. cd ~/src/php
  18.  
  19. wget http://us2.php.net/get/php-${phpver}.tar.gz/from/this/mirror
  20. tar xvf php-${phpver}.tar.gz
  21. cd php-${phpver}
  22. ./configure \
  23. --enable-fpm \
  24. --enable-intl \
  25. --with-curl=/usr \
  26. --with-mysql \
  27. --with-mysqli \
  28. --with-pdo-mysql \
  29. --with-gd \
  30. --with-jpeg-dir=/usr/lib64/ \
  31. --with-png-dir=/usr/lib64/ \
  32. --with-freetype-dir=/usr/include/freetype2/ \
  33. --with-zlib-dir=/usr/include/ \
  34. --enable-mbstring \
  35. --with-libdir=lib64 \
  36. --prefix=$HOME/php5.4 \
  37. --with-config-file-scan-dir=$HOME/php5.4/etc/conf.d
  38. make && make install
  39.  
  40. # Configure PHP-FPM
  41. cp /home/${USER}/php5.4/etc/php-fpm.conf.default /home/${USER}/php5.4/etc/php-fpm.conf
  42. echo "
  43. [global]
  44. pid = /home/${USER}/php5.4/var/run/php-fpm.pid
  45. emergency_restart_threshold = 10
  46. emergency_restart_interval = 1m
  47. process_control_timeout = 10s
  48. [www]
  49. listen = /home/${USER}/php5.4/var/run/php5-fpm.sock
  50. pm = dynamic
  51. pm.max_children = 8
  52. pm.start_servers = 2
  53. pm.min_spare_servers = 1
  54. pm.max_spare_servers = 3
  55. " > /home/${USER}/php5.4/etc/php-fpm.conf
  56.  
  57. echo "
  58. date.timezone = \"UTC\"
  59. " > /home/${USER}/php5.4/lib/php.ini
  60.  
  61. mkdir -p /home/${USER}/php5.4/etc/conf.d
  62.  
  63. # Install extensions
  64. cd ~/src/php
  65. wget http://pecl.php.net/get/APC-${apcver}.tgz
  66. tar xvf APC-${apcver}.tgz
  67.  
  68. cd APC-${apcver}
  69. ~/php5.4/bin/phpize
  70. ./configure --enable-apc --with-php-config=$HOME/php5.4/bin/php-config
  71. make && make install
  72.  
  73. cp apc.php /home/${USER}/nginx/html/apc.php
  74.  
  75. echo "
  76. extension=apc.so
  77.  
  78. ;Cache size
  79. apc.shm_size = 128M
  80.  
  81. ;Total amount of estimated cachable objects on server.
  82. ;Source files and user entries respectively
  83. apc.num_files_hint = 0
  84. apc.user_entries_hint = 0
  85.  
  86. ;The number of seconds a cache entry is allowed to
  87. ;idle in a slot before APC dumps the cache
  88. apc.ttl = 0
  89. apc.user_ttl = 0
  90. apc.gc_ttl = 3600
  91.  
  92. ;MUST be set to 1 when cachable files are being updated.
  93. ;Only enable after server is stable and ready for
  94. ;long running without file system changes
  95. apc.stat = 1
  96.  
  97. ;Cache slam protection bug fix
  98. apc.write_lock = 1
  99. apc.slam_defense = 0
  100. " > /home/${USER}/php5.4/etc/conf.d/apc.ini
  101.  
  102. cd ~/src/php
  103. wget http://pecl.php.net/get/imagick-${imagickver}.tgz
  104. tar xzvf imagick-${imagickver}.tgz
  105. cd imagick-${imagickver}
  106. phpize54
  107. ./configure --with-php-config=/home/${USER}/php5.4/bin/php-config
  108. make && make install
  109.  
  110. echo "extension = imagick.so" >> /home/${USER}/php5.4/lib/php.ini
  111.  
  112. # Start server
  113. ~/php5.4/sbin/php-fpm
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement