Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save benedict-erwin/3d54c20e52fc420d941ef52fc30f06d6 to your computer and use it in GitHub Desktop.

Select an option

Save benedict-erwin/3d54c20e52fc420d941ef52fc30f06d6 to your computer and use it in GitHub Desktop.

Revisions

  1. @ianmustafa ianmustafa created this gist Oct 28, 2018.
    3 changes: 3 additions & 0 deletions instal-php-di-ubuntu.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    # Instal PHP di Ubuntu dan Keluarganya? Tak perlu bingung lagi!

    Thanks to [Ondřej Surý](httpd://deb.sury.org), semua jadi lebih mudah. Instal berbagai versi PHP secara bersamaan pun bisa.
    28 changes: 28 additions & 0 deletions snippets.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    # Lakukan sekali untuk menambahkan PPA. Thanks to Ondřej Surý!
    $ LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php

    # Untuk pertama kali instal PHP. Versi yang akan terinstal adalah
    # versi stabil terkini (7.2 untuk November 2018)
    $ apt install -y php php-bcmath php-curl php-dev php-fpm php-gd php-intl \
    php-mbstring php-mysql php-sqlite3 php-xml php-zip php-pear

    # Untuk instal versi PHP tertentu. Perhatikan, tidak ada php-pear karena
    # package ini (PEAR Base System) hanya perlu diinstal sekali
    $ apt install -y php7.0 php7.0-bcmath php7.0-curl php7.0-dev php7.0-fpm \
    php7.0-gd php7.0-intl php7.0-mbstring php7.0-mysql php7.0-sqlite3 \
    php7.0-xml php7.0-zip

    # Snippet diatas dipakai untuk pengguna Nginx web-server. Untuk pengguna
    # Apache, ganti php-fpm (atau phpX.Y-fpm) dengan libapache2-mod-php
    # atau (libapache2-mod-phpX.Y)

    # Untuk instal ekstensi PHP baru. Ekstensi yang tidak perlu menyertakan
    # versi PHP adalah alias dari ekstensi yang tersedia dalam PECL
    # (PHP Extension Community Library) dan tidak terikat dengan versi PHP
    $ apt install -y php7.0-mcrypt php-imagick php-geoip php-yaml

    # Dengan adanya PEAR, ekstensi dari PECL juga bisa diinstal seperti ini
    $ pecl install imap swoole tidy

    # Bonus: beberapa ekstensi yang bisa berguna:
    # php-gmagick php-mongodb php-phalcon php-redis php-yaml