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…!.
How to check whether mod_rewrite is installed?
Create a text file named check.php in the www folder and insert the following code to it.
<?php phpinfo(); ?>
Then go to the web page in your browser using the url “localhost/check.php”. Then you’ll see information about the php version of the system. Under the “Configuration” title there’s another title called “apache2handler”. In that table there’ll be a entry named “Loaded Modules”. Check to see if it contains the name “mod_rewrite “.If you can see that name then mod_rewrite is installed to apache.
If mod_rewrite is not installed?
mod_rewrite can be installed using the “sudo a2enmod rewrite” command in the terminal.
How to check whether mod_rewrite is working properly?
A good tutorial on this can be found in http://www.webune.com/forums/how-to-test-check-if-mod-rewrite-is-enabled-t40.html.
mod_rewrite is not working even though it is installed?
Navigate to /etc/apache2/sites-enabled as root and open the text file “000-default”. Then replace all the “AllowOverride None” with “AllowOverride All”( There’ll be 3 entries ). Then restart apache using sudo /etc/init.d/apache2 restart .
This should solve the problems.
As we know, when we connect to a web server, if some error occurs, the server will show us some error message. As an example if the web page we are requesting is not available in the server it will generate a 404-page not found error. But as you have noticed, in most cases this error page is just a simple page which most probably has a white background with some simple text formatting. But do you know that you can customize those error pages as you like? Give it a theme( as an example, the theme of the webs site it self)? In this article I’m going to show you how to customize these error pages in a web server where you have access to cPanel. There are two methods to do this.
Log in to cPanel. Then go to Advanced → Error pages . There you will find a list of various error pages that cPanel currently has. Click on any one of them and you will be directed to a page where you can customize the page using usual html syntaxes .
If you want to replace the error page with a page that you have already designed, the easiest way to do so is to upload it to the server and replace the relevant file. The relevant files for the error pages can be found in the public_html folder. These files have the .shtml extension. So make sure that you rename the .html file that you are uploading to the .shtml extension. Here are some names of the error pages.
- 400.shtml : Bad request
- 401.shtml : Authentication required
- 403.shtml : Forbidden
- 404.shtml : Page not found
- 500.shtml : Internal server error
You will be able to find an example customized 404 page in http://ishans.info/wrongURL