Yii is professional PHP framework best for developing Web 2.0 applications. This guide elaborates on how to set up the Yii framework in XAMPP under a Linux environment.
First you need to download and install XAMPP as indicated in the XAMPP guide in http://www.apachefriends.org/en/xampp-linux.html. Then you need to get write permissions to the /opt/lampp/htdocs folder (where all the websites will be stored). First look at who is owning /opt/lampp/htdocs .
ls -ld /opt/lampp/htdocs
This should return something like
drwxr-xr-x. 5 root root 4096 Dec 22 22:55 /opt/lampp/htdocs
drwxr-xr-x. denotes the file permissions of the folder. The part root root specifies the owner of the directory and the owning group of the directory. Let’s first change the owning group of the folder. Let’s create a group called www and change the group ownership of the folder to www.
sudo groupadd www
sudo chgrp -R www /opt/lampp/htdocs
Now a ls -ld should return something like the following
drwxr-xr-x. 5 root www 4096 Dec 22 22:55 /opt/lampp/htdocs
Now the XAMPP server should be configured to run using the group www. Open the /opt/lampp/etc/httpd.conf file.
sudo vim /opt/lampp/etc/httpd.conf
Then find the entry,
(yours might be slightly different). Change the User entry to your user name and Group entry to www. Now you need to set the permissions of the /opt/lampp/htdocs folder.
sudo chmod 2775 /opt/lampp/htdocs
usermod -aG www <username>
You’ll need to logout and log in to the system since group memberships are read at login time. But before doing that, let’s carry out another task that will require a logout. We need to add PHP to our PATH. So open your .bashrc as follows.
Then add the following lines to the end of that file.
##Adds XAMPP bin to PATH
Now logout and login. Then extract the Yii framework to a folder named yii in the /opt/lampp/htdocs folder, start the XAMPP server and go to the address http://localhost/yii/requirements/index.php to check whether Yii is working. Then to create a Yii application, follow the following commands. I have used the test name blog.
php ./yii/framework/yiic webapp blog
After completing the creation, visit http://localhost/blog/ to verify the functionality of the created Yii application…!.