Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

Installing Yii2 using composer on xampp

1. Buka command prompt


2. cd c:\xampp\php
3. php.exe -r "readfile('https://getcomposer.org/installer');" | php.exe
4. php.exe composer.phar self-update
5. php composer.phar global require "fxp/composer-asset-plugin:~1.4.0"
6. create token in https://github.com/settings/tokens
7. copy the string
8. php.exe composer.phar config -g github-oauth.github.com
520c3352a87b029dd76b3a264b2b5a12ec71a50a
9. php.exe composer.phar create-project --prefer-dist --stability=dev
yiisoft/yii2-app-advanced ../htdocs/aplikasiq
minimum stability default = stable
10. php.exe ../htdocs/aplikasiq/init
Pilih aja 0 lalu enter,
11. Lalu ada pertanyaan lagi.. ketik yes, all Selesai..
12. Create a new database and adjust the components['db'] configuration in
common/config/main-local.php accordingly
13. Open a console terminal, apply migrations with command /path/to/php-bin/php
/path/to/yii-application/yii migrate

Set document roots of your web server:

for frontend /path/to/yii-application/frontend/web/ and using the URL


http://frontend.dev/
for backend /path/to/yii-application/backend/web/ and using the URL
http://backend.dev/

cmd run 'yii rbac/init'


cmd run 'php -S localhost:8080' in nenad folder to run temporary php web server

Testing buka browser akses ->


http://localhost/aplikasiq/frontend/web/ (untuk frontend)
http://localhost/advanced/backend/web/ (untuk backend)

For Apache it could be the following:

<VirtualHost *:80>
ServerName frontend.dev
DocumentRoot "/path/to/yii-application/frontend/web/"

<Directory "/path/to/yii-application/frontend/web/">
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php

# use index.php as index file


DirectoryIndex index.php

# ...other settings...
# Apache 2.4
Require all granted
## Apache 2.2
# Order allow,deny
# Allow from all
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName backend.dev
DocumentRoot "/path/to/yii-application/backend/web/"

<Directory "/path/to/yii-application/backend/web/">
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php

# use index.php as index file


DirectoryIndex index.php

# ...other settings...
# Apache 2.4
Require all granted

## Apache 2.2
# Order allow,deny
# Allow from all
</Directory>
</VirtualHost>

advanced Setting Proxy Bagi yang koneksi internetnya menggunakan proxy biasanya
mengalami masalah ketika menggunakan composer.. mau install Yii2 atau install yang
lain.

solusinya.. kalo pake windows, pada command prompt ketikkan perintah untuk set
proxy:
set http_proxy=http://USERNAME:PASSWORD@host:PORT
contoh:
set http_proxy=http://jdlines:21@google.com:8080

You might also like