Halaman

Sabtu, 09 Desember 2017

Vesta Control Panel Multi PHP Version

VestaCP - MultiPHP


Mo posting ini ga sempet mulu masbro, , ,
Beberapa kali lupa terus kalo abis insttal VESTACP.
Kadang ada beberapa project yang butuh versi PHP berbeda, waktu dulu nyari caranya gimana pakai Multi PHP di masing2 domain(web) cuma ada tutor buat Centos, server kita kan Ubuntu
(Uuuuuu, BUNTU)....



so, setelah fresh install vesta cp ikutin langkah ini ya masbro....

** jangan lupa "sudo" ya, kalo ga mau ribet ya pake "sudo su"

Install Dependencies nya dulu 
apt-get install build-essential libssl-dev libxml2-dev pkg-config libssl-dev libsslcommon2-dev libbz2-dev libcurl4-openssl-dev libmysqlclient-dev libgdbm-dev libjpeg62 libjpeg62-dev libpng12-0 libpng12-dev libxml2 libxml2-dev libmcrypt4 libmcrypt-dev libmhash2 libmhash-dev libmm-dev libmm14 libtidy-dev libtidy-0.99-0 libxslt1-dev libxslt1.1 libfreetype6 libfreetype6-dev libicu-dev libreadline-dev

# Modifikasi untuk PHP 5.3/5.4 Compilation (http://stackoverflow.com/a/26342869)
mkdir /usr/include/freetype2/freetype
ln -s /usr/include/freetype2/freetype.h /usr/include/freetype2/freetype/freetype.h

Lanjut Install dan Konfigurasi   PHPBrew nya

curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew
chmod +x phpbrew
sudo mv phpbrew /usr/bin/phpbrew

mkdir -p /usr/local/php
phpbrew init --root=/usr/local/php
export PHPBREW_ROOT=/usr/local/php
[[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc

phpbrew update
phpbrew update --old

**Ubuntu 16.04 / PHP 5.3 only! **
Kalo pake Ubuntu 16.04  OpenSSL Libary yang lama harus diinstal, kalo ga pake OpenSSL lama, kompilasi php jadi error.
cd /usr/src
wget https://www.openssl.org/source/openssl-0.9.8zb.tar.gz
tar xfvz openssl-0.9.8zb.tar.gz
cd openssl-0.9.8zb
mkdir /usr/local/sslold
./config --prefix=/usr/local --openssldir=/usr/local/sslold
make
make install

Compile PHP dan Modul yg dibutuhkan
Ga perlu semua versi di install, cukup yang dibutuhkan aja. (Ane sering nya pake 5.5.9, 5.5.6 sama 7.1) tapi kalo mo install semua versi ya monggooo.....
# PHP 5.3
phpbrew install 5.3 +default +openssl=shared -- --with-openssl-dir=/usr/include/openssl --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-mysql=mysqlnd --with-mysqli=mysqlnd --enable-pdo --with-pdo-mysql=mysqlnd --enable-exif --with-jpeg-dir=/usr --with-png-dir=/usr --with-freetype-dir=/usr --with-zlib-dir=/usr --with-mcrypt=/usr --with-mhash --with-xsl=/usr --enable-zip --enable-cgi --with-curl --with-gd --enable-pcntl --enable-mbregex --enable-gd-native-ttf --with-libdir=lib64 --enable-dba=shared --enable-intl --with-readline=/usr --enable-simplexml \--enable-soap --enable-zip --with-mhash=yes --enable-shmop --enable-sockets --enable-wddx --enable-calendar --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-bcmath --with-bz2 --enable-ctype --with-cdb --with-iconv --enable-exif --enable-ftp --with-gettext --with-pic

# PHP 5.4
phpbrew install 5.4 +default +openssl=shared -- --with-openssl-dir=/usr/include/openssl --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-mysql=mysqlnd --with-mysqli=mysqlnd --enable-pdo --with-pdo-mysql=mysqlnd --enable-exif --with-jpeg-dir=/usr --with-png-dir=/usr --with-freetype-dir=/usr --with-zlib-dir=/usr --with-mcrypt=/usr --with-mhash --with-xsl=/usr --enable-zip --enable-cgi --with-curl --with-gd --enable-pcntl --enable-mbregex --enable-gd-native-ttf --with-libdir=lib64 --enable-dba=shared --enable-intl --with-readline=/usr --enable-simplexml \--enable-soap --enable-zip --with-mhash=yes --enable-shmop --enable-sockets --enable-wddx --enable-calendar --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-bcmath --with-bz2 --enable-ctype --with-cdb --with-iconv --enable-exif --enable-ftp --with-gettext --with-pic

# PHP 5.5
phpbrew install 5.5 +default +openssl=shared -- --with-openssl-dir=/usr/include/openssl --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-mysql=mysqlnd --with-mysqli=mysqlnd --enable-pdo --with-pdo-mysql=mysqlnd --enable-exif --with-jpeg-dir=/usr --with-png-dir=/usr --with-freetype-dir=/usr --with-zlib-dir=/usr --with-mcrypt=/usr --with-mhash --with-xsl=/usr --enable-zip --enable-cgi --with-curl --with-gd --enable-pcntl --enable-mbregex --enable-gd-native-ttf --with-libdir=lib64 --enable-dba=shared --enable-intl --with-readline=/usr --enable-simplexml \--enable-soap --enable-zip --with-mhash=yes --enable-shmop --enable-sockets --enable-wddx --enable-calendar --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-bcmath --with-bz2 --enable-ctype --with-cdb --with-iconv --enable-exif --enable-ftp --with-gettext --with-pic

# PHP 5.6
phpbrew install 5.6 +default +openssl=shared -- --with-openssl-dir=/usr/include/openssl --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-mysql=mysqlnd --with-mysqli=mysqlnd --enable-pdo --with-pdo-mysql=mysqlnd --enable-exif --with-jpeg-dir=/usr --with-png-dir=/usr --with-freetype-dir=/usr --with-zlib-dir=/usr --with-mcrypt=/usr --with-mhash --with-xsl=/usr --enable-zip --enable-cgi --with-curl --with-gd --enable-pcntl --enable-mbregex --enable-gd-native-ttf --with-libdir=lib64 --enable-dba=shared --enable-intl --with-readline=/usr --enable-simplexml \--enable-soap --enable-zip --with-mhash=yes --enable-shmop --enable-sockets --enable-wddx --enable-calendar --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-bcmath --with-bz2 --enable-ctype --with-cdb --with-iconv --enable-exif --enable-ftp --with-gettext --with-pic

# PHP 7.0
phpbrew install 7.0 +default +openssl=shared -- --with-openssl-dir=/usr/include/openssl --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-mysql=mysqlnd --with-mysqli=mysqlnd --enable-pdo --with-pdo-mysql=mysqlnd --enable-exif --with-jpeg-dir=/usr --with-png-dir=/usr --with-freetype-dir=/usr --with-zlib-dir=/usr --with-mcrypt=/usr --with-mhash --with-xsl=/usr --enable-zip --enable-cgi --with-curl --with-gd --enable-pcntl --enable-mbregex --enable-gd-native-ttf --with-libdir=lib64 --enable-dba=shared --enable-intl --with-readline=/usr --enable-simplexml \--enable-soap --enable-zip --with-mhash=yes --enable-shmop --enable-sockets --enable-wddx --enable-calendar --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-bcmath --with-bz2 --enable-ctype --with-cdb --with-iconv --enable-exif --enable-ftp --with-gettext --with-pic

# PHP 7.1
phpbrew install 7.1 +default +openssl=shared -- --with-openssl-dir=/usr/include/openssl --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-mysql=mysqlnd --with-mysqli=mysqlnd --enable-pdo --with-pdo-mysql=mysqlnd --enable-exif --with-jpeg-dir=/usr --with-png-dir=/usr --with-freetype-dir=/usr --with-zlib-dir=/usr --with-mcrypt=/usr --with-mhash --with-xsl=/usr --enable-zip --enable-cgi --with-curl --with-gd --enable-pcntl --enable-mbregex --enable-gd-native-ttf --with-libdir=lib64 --enable-dba=shared --enable-intl --with-readline=/usr --enable-simplexml \--enable-soap --enable-zip --with-mhash=yes --enable-shmop --enable-sockets --enable-wddx --enable-calendar --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-bcmath --with-bz2 --enable-ctype --with-cdb --with-iconv --enable-exif --enable-ftp --with-gettext --with-pic

** INGAT!!!! kalo pake ubuntu 16.04 atau untuk PHP5.3 harus pake openssl yang OLD  jadi ganti syntax "--with-openssl-dir=/usr/include/openssl" menjadi "--with-openssl-dir=/usr/local/sslold" baru di compile

Terus Bikin Shortcut/Symlink nya
sesuaikan kebutuhan, gunakan hanya untuk php yg ter install aja. Hati-hati..!!!! Versi PHP  mungkin berbeda (php-x.x.xx) jangan malas untuk melihat log nya.
# PHP 5.3
ln -s /usr/local/php/php/php-5.3.29 /usr/local/php/php53

# PHP 5.4
ln -s /usr/local/php/php/php-5.4.45 /usr/local/php/php54

# PHP 5.5
ln -s /usr/local/php/php/php-5.5.38 /usr/local/php/php55

# PHP 5.6
ln -s /usr/local/php/php/php-5.6.28 /usr/local/php/php56

# PHP 7.0
ln -s /usr/local/php/php/php-7.0.14 /usr/local/php/php70

# PHP 7.1
ln -s /usr/local/php/php/php-7.1.6 /usr/local/php/php71

Enable Apache Modules
a2enmod actions cgi
service apache2 restart

Lanjut .... Buat Template Vesta nya
 Secara manual bisa copy file "/usr/local/vesta/data/templates/web/apache2/phpcgi.stpl", "/usr/local/vesta/data/templates/web/apache2/phpcgi.tpl" dan "/usr/local/vesta/data/templates/web/apache2/phpcgi.sh" dari template vesta terus tinggal disesuaikan aja
misal:
cp /usr/local/vesta/data/templates/web/apache2/phpcgi.stpl  /usr/local/vesta/data/templates/web/apache2/php56.stpl
cp /usr/local/vesta/data/templates/web/apache2/php56.tpl /usr/local/vesta/data/templates/web/apache2/php56.tpl
cp /usr/local/vesta/data/templates/web/apache2/phpcgi.sh /usr/local/vesta/data/templates/web/apache2/php56.sh

edit dan sesuaikan menggunakan editor favorit ente
kalo ribet langsung donglod aja dari sumber artikel ini
# PHP 5.3
wget http://git.scit.ch/rs/VestaCP-MultiPHP/raw/master/php53.sh -O /usr/local/vesta/data/templates/web/apache2/php53.sh
wget http://git.scit.ch/rs/VestaCP-MultiPHP/raw/master/php.tpl -O /usr/local/vesta/data/templates/web/apache2/php53.tpl
wget http://git.scit.ch/rs/VestaCP-MultiPHP/raw/master/php.stpl -O /usr/local/vesta/data/templates/web/apache2/php53.stpl

# PHP 5.4
wget http://git.scit.ch/rs/VestaCP-MultiPHP/raw/master/php54.sh -O /usr/local/vesta/data/templates/web/apache2/php54.sh
wget http://git.scit.ch/rs/VestaCP-MultiPHP/raw/master/php.tpl -O /usr/local/vesta/data/templates/web/apache2/php54.tpl
wget http://git.scit.ch/rs/VestaCP-MultiPHP/raw/master/php.stpl -O /usr/local/vesta/data/templates/web/apache2/php54.stpl

# PHP 5.5
wget http://git.scit.ch/rs/VestaCP-MultiPHP/raw/master/php55.sh -O /usr/local/vesta/data/templates/web/apache2/php55.sh
wget http://git.scit.ch/rs/VestaCP-MultiPHP/raw/master/php.tpl -O /usr/local/vesta/data/templates/web/apache2/php55.tpl
wget http://git.scit.ch/rs/VestaCP-MultiPHP/raw/master/php.stpl -O /usr/local/vesta/data/templates/web/apache2/php55.stpl

# PHP 5.6
wget http://git.scit.ch/rs/VestaCP-MultiPHP/raw/master/php56.sh -O /usr/local/vesta/data/templates/web/apache2/php56.sh
wget http://git.scit.ch/rs/VestaCP-MultiPHP/raw/master/php.tpl -O /usr/local/vesta/data/templates/web/apache2/php56.tpl
wget http://git.scit.ch/rs/VestaCP-MultiPHP/raw/master/php.stpl -O /usr/local/vesta/data/templates/web/apache2/php56.stpl

# PHP 7.0
wget http://git.scit.ch/rs/VestaCP-MultiPHP/raw/master/php70.sh -O /usr/local/vesta/data/templates/web/apache2/php70.sh
wget http://git.scit.ch/rs/VestaCP-MultiPHP/raw/master/php.tpl -O /usr/local/vesta/data/templates/web/apache2/php70.tpl
wget http://git.scit.ch/rs/VestaCP-MultiPHP/raw/master/php.stpl -O /usr/local/vesta/data/templates/web/apache2/php70.stpl

# PHP 7.1
wget http://git.scit.ch/rs/VestaCP-MultiPHP/raw/master/php71.sh -O /usr/local/vesta/data/templates/web/apache2/php71.sh
wget http://git.scit.ch/rs/VestaCP-MultiPHP/raw/master/php.tpl -O /usr/local/vesta/data/templates/web/apache2/php71.tpl
wget http://git.scit.ch/rs/VestaCP-MultiPHP/raw/master/php.stpl -O /usr/local/vesta/data/templates/web/apache2/php71.stpl

# Update Owner and Permissions
chmod 755 /usr/local/vesta/data/templates/web/apache2/*

Selesai....
coba buka VestaCP nya di menu domain, edit, nanti ada pilihan PHP version, di dropdown WebTemplate
Kodingbro vestacp-multi-php

Selesai...
Kalo mau tes berubah atai tidak versi nya, buat file untuk nampilin phpinfo di domain web folder.
Ganti versi lalu refresh halaman phpinfo nya.,.....

Sumber :
https://git.scit.ch/rs/VestaCP-MultiPHP/tree/master

Tidak ada komentar:

Posting Komentar