{"id":4057,"date":"2014-09-09T13:51:45","date_gmt":"2014-09-09T18:51:45","guid":{"rendered":"https:\/\/secure.rosehosting.com\/blog\/?p=4057"},"modified":"2022-12-13T14:34:36","modified_gmt":"2022-12-13T20:34:36","slug":"how-to-install-yii-framework-on-a-debian-vps-with-nginx","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-install-yii-framework-on-a-debian-vps-with-nginx\/","title":{"rendered":"How to Install Yii Framework on a Debian VPS with Nginx"},"content":{"rendered":"
Yii is an open source, high performance PHP framework used for developing web 2.0\u00a0 applications. <\/p>\n <\/p>\n At the time of writing this tutorial, the latest stable version is Yii 1.1.15 and it requires:<\/p>\n If you have Apache installed on your server, stop the Apache service and remove Apache packages:<\/p>\n Make sure your Debian VPS<\/a> is fully up to date by using the following commands:<\/p>\n In order to install Nginx, PHP-FPM and MySQL on your server, execute the following command:<\/p>\n Download the latest version of YII framework available at https:\/\/github.com\/yiisoft\/yii\/releases\/latest to the server:<\/p>\n Extract the tar archive, rename ‘yii-1.1.15.022a51’ directory to ‘yii’ and move it to the ‘\/var\/www\/your-domain.com’ directory using the following commands:<\/p>\n Locate the PHP configuration file using the following command:<\/p>\n Edit the \/etc\/php5\/fpm\/php.ini configuration file using the following command:<\/p>\n and add\/modify the following lines:<\/p>\n Execute the following command to restart the php5-fpm service:<\/p>\n For performance reasons, our recommendation is to run php5-fpm in SOCKET mode, instead of accessing via <IP_address>:PORT.<\/p>\n Create a new Nginx configuration file:<\/p>\n and add the following lines:<\/p>\n Create a symbolic link using the following command:<\/p>\n and restart the Nginx web server for the changes to take effect:<\/p>\n Create a directory named ‘example’ inside the ‘yii’ directory:<\/p>\n and execute the following command:<\/p>\n Now test the new project by navigating to http:\/\/your-domain.com\/example using a web browser.<\/p>\n Yii framework has been installed now.<\/p>\n Of course you don\u2019t have to do any of this if you use one of our Linux VPS Hosting<\/a> services, in which case you can simply ask our expert Linux admins to install Yii PHP Framework for you. They are available 24×7 and will take care of your request immediately.<\/p>\n PS<\/span>.<\/strong> If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n <\/p>\n","protected":false},"excerpt":{"rendered":" Yii is an open source, high performance PHP framework used for developing web 2.0\u00a0 applications. In this step-by-step tutorial, we … <\/p>\n
\nIn this step-by-step tutorial, we will show you how to easily install Yii framework on your Debian based virtual server<\/a>.<\/p>\n\n
\/etc\/init.d\/apache2 stop\r\napt-get remove apache2*<\/pre>\n
apt-get update\r\napt-get upgrade<\/pre>\n
apt-get install nginx php5-fpm php5-cli php5-mcrypt php5-gd mysql-client-5.5 mysql-server-5.5 mysql-server-core-5.5<\/pre>\n
cd \/root\r\nwget https:\/\/github.com\/yiisoft\/yii\/releases\/download\/1.1.15\/yii-1.1.15.022a51.tar.gz\r\nmkdir -p \/var\/www\/{your-domain.com,your-domain.com\/yii}<\/pre>\n
tar -xvf yii-1.1.15.022a51.tar.gz -C \/var\/www\/your-domain.com\/\r\nmv \/var\/www\/your-domain.com\/yii-1.1.15.022a51 \/var\/www\/your-domain.com\/yii\r\nchown www-data:www-data -R \/var\/www\/your-domain.com\/yii\r\n<\/pre>\n
php5-fpm -i | grep php.ini\r\nConfiguration File (php.ini) Path => \/etc\/php5\/fpm\r\nLoaded Configuration File => \/etc\/php5\/fpm\/php.ini<\/pre>\n
vi \/etc\/php5\/fpm\/php.ini<\/pre>\n
memory_limit = 128M\r\ncgi.fix_pathinfo = 0\r\nsafe_mode = Off\r\nmax_execution_time = 60\r\nmax_input_time = 60\r\n<\/pre>\n
\/etc\/init.d\/php5-fpm restart<\/pre>\n
vi \/etc\/nginx\/sites-available\/your-domain.com<\/pre>\n
server {\r\n\tlisten 80;\r\n\tserver_name your-domain.com;\r\n\troot \/var\/www\/your-domain.com\/yii\/;\r\n\tindex index.php index.html;\r\n\taccess_log \/var\/log\/nginx\/your-domain.com-access.log;\r\n\terror_log \/var\/log\/nginx\/your-domain.com-error.log;\r\n\tset $yii_bootstrap \"index.php\";\r\n\tcharset utf-8;\r\n\r\nlocation \/ {\r\n index index.html $yii_bootstrap;\r\n try_files $uri $uri\/ \/$yii_bootstrap?$args;\r\n \t}\r\n\r\nlocation ~ ^\/(protected|framework|themes\/\\w+\/views) {\r\n deny all;\r\n \t}\r\n\r\nlocation ~ \\.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {\r\n try_files $uri =404;\r\n \t}\r\n\r\nlocation ~ \\.php {\r\n\tfastcgi_index index.php;\r\n\tfastcgi_split_path_info ^(.+\\.php)(.*)$;\r\n\tset $fsn \/$yii_bootstrap;\r\n if (-f $document_root$fastcgi_script_name){\r\n set $fsn $fastcgi_script_name;\r\n }\r\n\tinclude \/etc\/nginx\/fastcgi_params;\r\n\tfastcgi_pass unix:\/var\/run\/php5-fpm.sock;\r\n\tfastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\r\n\t}\r\n\r\nlocation ~ \/\\. {\r\n deny all;\r\n access_log off;\r\n log_not_found off;\r\n \t}\r\n}<\/pre>\n
ln -s \/etc\/nginx\/sites-available\/your-domain.com \/etc\/nginx\/sites-enabled\/your-domain.com<\/pre>\n
\/etc\/init.d\/nginx restart<\/pre>\n
mkdir -p \/var\/www\/your-domain.com\/yii\/example\r\nchown www-data:www-data \/var\/www\/your-domain.com\/yii\/example<\/pre>\n
php \/var\/www\/your-domain.com\/yii\/framework\/yiic.php webapp \/var\/www\/your-domain.com\/yii\/example\r\nCreate a Web application under '\/var\/www\/your-domain.com\/yii\/example'? (yes|no) [no]:yes<\/pre>\n