Last active
January 1, 2016 15:59
-
-
Save junwatu/3bf254ffbe2ad2c7548c to your computer and use it in GitHub Desktop.
Langkah - langkah setup framework Phalcon dengan Nginx dan PHP-FPM.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Phalcon adalah framework PHP yang di implementasikan sebagai ekstensi C. | |
http://phalconphp.com/en/ | |
Untuk setup Phalcon dengan Nginx dan PHP-FPM ikuti langkah - langkah berikut. Setup | |
dilakukan pada OS Linux Elementary Luna. | |
PHP | |
--- | |
Download source PHP di http://www.php.net. Dalam tulisan ini digunakan versi PHP 5.5.6. | |
Ekstrak dan compile dengan konfigurasi option seperti berikut | |
# build.sh | |
./configure --prefix=/usr \ | |
--without-t1lib \ | |
--disable-short-tags \ | |
--enable-pcntl \ | |
--with-tsrm-pthreads \ | |
--with-mysqli \ | |
--with-mysql \ | |
--with-pdo-mysql \ | |
--with-zlib \ | |
--enable-sysvmsg \ | |
--enable-sysvsem \ | |
--enable-sysvshm \ | |
--enable-bcmath \ | |
--with-bz2 \ | |
--enable-calendar \ | |
--enable-exif \ | |
--enable-ftp \ | |
--with-gd \ | |
--with-jpeg-dir=/usr/lib \ | |
--with-png-dir=/usr/lib \ | |
--enable-gd-native-ttf \ | |
--enable-gd-jis-conv \ | |
--with-iconv-dir \ | |
--with-gettext \ | |
--with-imap \ | |
--with-imap-ssl \ | |
--with-openssl \ | |
--enable-mbstring \ | |
--with-mcrypt \ | |
--with-mhash \ | |
--with-pspell \ | |
--enable-soap \ | |
--enable-sockets \ | |
--with-sqlite \ | |
--enable-sqlite-utf8 \ | |
--enable-wddx \ | |
--with-xmlrpc \ | |
--with-xsl \ | |
--enable-zip \ | |
--with-kerberos \ | |
--with-tidy \ | |
--with-curl \ | |
--enable-fpm | |
Taruh di file build.sh misalnya, buat executable dan run | |
$ cd php-5.5.6 | |
$ ./build.sh | |
$ make && sudo make install | |
Testing PHP yang terinstall | |
$ php --version | |
PHP 5.5.6 (cli) (built: Dec 18 2013 19:30:28) | |
Copyright (c) 1997-2013 The PHP Group | |
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies | |
Copy php.ini ke /usr/lib | |
$ sudo cp php.ini-development /usr/lib/php.ini | |
PHP-FPM | |
------- | |
Copy file konfigurasi fpm ke /usr/etc/ | |
$ sudo cp sapi/php-fpm.conf /usr/etc/ | |
Copy file service ke /etc/init.d | |
$ sudo cp sapi/init.d.php-fpm /etc/init.d/php-fpm | |
$ sudo chmod +x /etc/init.d/php-fpm | |
Jalankan PHP-FPM | |
$ sudo /etc/init.d/php-fpm start | |
Nginx | |
----- | |
Edit file konfigurasi dari Nginx di /etc/nginx/sites-enabled/default menjadi | |
server { | |
listen 81; | |
listen [::]:81; | |
server_name localhost; | |
index index.php index.html index.htm; | |
set $root_path '/opt/www-php'; | |
root $root_path; | |
location / { | |
try_files $uri $uri/ /index.php; | |
} | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ { | |
root $root_path; | |
} | |
location ~ /\.ht { | |
deny all; | |
} | |
} | |
Perlu diingat root folder di setting pada /opt/www-php. | |
Simpan dan restart server nginx | |
$ sudo service nginx restart | |
Phalcon | |
------- | |
Download kode sumber dari Phalcon dari github | |
$ git clone --depth=1 git://github.com/phalcon/cphalcon.git | |
$ cd build | |
$ sudo ./install | |
Edit php.ini da tambahkan | |
extension=phalcon.so | |
Restart PHP-FPM | |
$ sudo /etc/init.d/php-fpm restart | |
Testing phalcon sudah ke load oleh PHP di command line | |
$ php -m | grep phalcon | |
Pastikan keluaran command diatas berisi 'phalcon'. | |
Testing phalcon di web. Buat file PHP di /opt/www-php | |
$ sudo touch index.php | |
dan isikan script PHP berikut | |
<?php print_r(get_loaded_extensions()); ?> | |
Buka web browser dan ketikkan | |
http://localhost:81 | |
Keluaran response dari browser (ctrl + shift + j) chrome | |
Array | |
( | |
[0] => Core | |
[1] => date | |
[2] => ereg | |
[3] => libxml | |
[4] => openssl | |
[5] => pcre | |
[6] => sqlite3 | |
[7] => zlib | |
[8] => bcmath | |
[9] => bz2 | |
[10] => calendar | |
[11] => ctype | |
[12] => curl | |
[13] => dom | |
[14] => hash | |
[15] => fileinfo | |
[16] => filter | |
[17] => ftp | |
[18] => gd | |
[19] => gettext | |
[20] => SPL | |
[21] => iconv | |
[22] => session | |
[23] => json | |
[24] => mbstring | |
[25] => mcrypt | |
[26] => standard | |
[27] => mysqlnd | |
[28] => pcntl | |
[29] => PDO | |
[30] => pdo_mysql | |
[31] => pdo_sqlite | |
[32] => Phar | |
[33] => posix | |
[34] => pspell | |
[35] => Reflection | |
[36] => imap | |
[37] => SimpleXML | |
[38] => soap | |
[39] => sockets | |
[40] => mysqli | |
[41] => exif | |
[42] => sysvmsg | |
[43] => sysvsem | |
[44] => sysvshm | |
[45] => tidy | |
[46] => tokenizer | |
[47] => wddx | |
[48] => xml | |
[49] => xmlreader | |
[50] => xmlrpc | |
[51] => xmlwriter | |
[52] => xsl | |
[53] => zip | |
[54] => mysql | |
[55] => cgi-fcgi | |
[56] => phalcon | |
[57] => mhash | |
) | |
> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment