Install Codeigniter di Linux

Bagaimana cara install ci di linux ?


Download codeigniter dari github
#wget -c https://github.com/bcit-ci/CodeIgniter/archive/3.1.7.zip -O CodeIgniter-3.1.7.zip

Kemudian unzip
#unzip CodeIgniter-3.1.7.zip

Copy folder CodeIgniter-3.1.7 ke folder web root /var/www/html
#sudo cp -r CodeIgniter-3.1.7 /var/www/html/ci

Akses melalui browser http://localhost/ci atau http://alamat_IP/ci


Membuat Virtualhost

Berikut ini adalah cara mengubah http://localhost/ci menjadi http://web.dev dengan konfigurasi VirtualHost di Apache.

#nano /etc/apache2/sites-available/ci.conf

Kemudian isi dengan
<VirtualHost *:80>
    ServerAdmin admin@ci.local
    ServerName ci.local
    DocumentRoot /var/www/html/ci
    ErrorLog /var/log/codeigniter_error.log
    CustomLog /var/log/codeigniter_access.log combined
</VirtualHost>

Kemudian aktifkan virtualhost yang baru dibuat dengan perintah
#a2ensite ci.conf

Edit hosts
#nano /etc/hosts

Tambahkan
127.0.0.1 ci.local

Kemudian tinggal edit file config.php bagian base_url ganti seperti pada gambar


buka browser ketikan http://ci.local

Bagaimana menghapus index.php ?

Untuk menghapus file index.php tinggal buat file .htaccess di dalam folder ci
isi file .htaccess adalah
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php?/$0 [PT,L]

Kemudian masuk ke file apache.conf
#nano /etc/apache2/apache.conf
kemudian AllowOverride ganti menjadi All


Setelah di save kemudian ketik perintah ini untuk mengaktifkan mod apache rewrite
#a2enmode rewrite

Restart apache
#service apache2 restart

Ubah Hak Akses
#chmod -R 775 /var/www/html/ci

Referensi :
https://musaamin.web.id/cara-install-codeigniter-di-ubuntu/
https://ayyaz.io/remove-index-php-codeigniter-ubuntu/

Comments

Popular posts from this blog

Mengenal Mikrokomputer dan Mikroprosesor