0% found this document useful (0 votes)
195 views2 pages

Install Yii2 Advanced

The document provides steps to install Yii2 using composer on XAMPP, including downloading composer, creating a Yii2 project, setting up the database connection, applying migrations, and configuring Apache virtual hosts for the frontend and backend. It also discusses setting an HTTP proxy for Composer if connecting through a proxy network.

Uploaded by

Salamun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
195 views2 pages

Install Yii2 Advanced

The document provides steps to install Yii2 using composer on XAMPP, including downloading composer, creating a Yii2 project, setting up the database connection, applying migrations, and configuring Apache virtual hosts for the frontend and backend. It also discusses setting an HTTP proxy for Composer if connecting through a proxy network.

Uploaded by

Salamun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 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:[email protected]:8080

You might also like