{"id":17424,"date":"2015-10-05T14:02:13","date_gmt":"2015-10-05T19:02:13","guid":{"rendered":"https:\/\/secure.rosehosting.com\/blog\/?p=17424"},"modified":"2022-11-29T07:40:12","modified_gmt":"2022-11-29T13:40:12","slug":"install-cakephp-3-0-on-a-centos-vps","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/install-cakephp-3-0-on-a-centos-vps\/","title":{"rendered":"Install CakePHP 3.0 on CentOS"},"content":{"rendered":"
Today we are going to show you how to install CakePHP 3.0 on your Linux VPS<\/a>. CakePHP is a rapid development PHP framework. It allows you to build web applications quickly without complex configurations. It is secure and licensed under the MIT license which makes it a very suitable framework for web developers.<\/p>\n <\/p>\n In order to install CakePHP you need to make sure that your CentOS VPS<\/a> meets the following requirements:<\/p>\n * LAMP is installed First, log in to your VPS via SSH<\/a> and update your system software to the latest version with the following command:<\/p>\n Install PHP mbstring and intl extensions using the command:<\/p>\n Now, to manage the CakePHP dependencies you need to download and install composer. You can accomplish this by executing the following commands:<\/p>\n Also, you need to create a database, a database user and set up a password for your first CakePHP project. Log in to\u00a0your MySQL as root:<\/p>\n and execute the following commands:<\/p>\n You can replace ‘app_db’, ‘app_user’ and ‘YoUrPaS$w0rD’ to match your needs. To create your first CakePHP project you need to execute the following command:<\/p>\n You can replace ‘CakePHPApp’ to match the name of your first CakePHP project. You should wait no longer than one minute for your project to be ready. Then, change the ownership of the files and make Apache to be the owner using the following command:<\/p>\n Now, edit the ‘app.php’ configuration file:<\/p>\n Find the datasources section and change the ‘host’, ‘username’, ‘password’ and ‘database’ to match yours.<\/p>\n It is time to configure Apache. Edit your Apache configuration file:<\/p>\n Add the following lines at the end of the file:<\/p>\n Restart Apache:<\/p>\n That’s it. You have successfully installed CakePHP 3.0 on your CentOS VPS<\/a>. Open your favorite web browser and navigate to:<\/p>\n The official CakePHP documentation is available at:<\/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 CakePHP for you. They are available 24\u00d77 and will take care of your request immediately.<\/p>\n PS. 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. And don’t forget to check out our CakePHP hosting<\/a> plans. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":" Today we are going to show you how to install CakePHP 3.0 on your Linux VPS. CakePHP is a rapid … <\/p>\n
\n* PHP 5.4.16 or higher is installed.
\n* PHP mbstring extension is loaded.
\n* PHP intl extension is loaded.<\/p>\nyum update<\/pre>\n
yum install php-mbstring php-intl<\/pre>\n
curl -sS https:\/\/getcomposer.org\/installer | php\r\nmv composer.phar \/usr\/local\/bin\/composer\r\nchmod +x \/usr\/local\/bin\/composer<\/pre>\n
mysql -u root -p<\/pre>\n
mysql> CREATE DATABASE app_db;\r\nmysql> GRANT ALL PRIVILEGES on app_db.* to 'app_user'@'localhost' identified by 'YoUrPaS$w0rD';\r\nmysql> FLUSH PRIVILEGES;\r\nmysql> exit\r\n<\/pre>\n
\nNext, navigate to \/var\/www\/html and create your first CakePHP project.<\/p>\ncd \/var\/www\/html<\/pre>\n
composer create-project --prefer-dist cakephp\/app CakePHPApp<\/pre>\n
chown apache: -R CakePHPApp\/<\/pre>\n
nano CakePHPApp\/config\/app.php<\/pre>\n
'Datasources' => [\r\n 'default' => [\r\n 'className' => 'Cake\\Database\\Connection',\r\n 'driver' => 'Cake\\Database\\Driver\\Mysql',\r\n 'persistent' => false,\r\n 'host' => 'localhost',\r\n 'username' => 'app_user',\r\n 'password' => 'YoUrPaS$w0rD',\r\n 'database' => 'app_db',\r\n 'encoding' => 'utf8',\r\n 'timezone' => 'UTC',\r\n 'cacheMetadata' => true,\r\n<\/pre>\n
nano \/etc\/httpd\/conf\/httpd.conf<\/pre>\n
<VirtualHost *:80>\r\n ServerAdmin admin@yourdomain.com\r\n DocumentRoot \/var\/www\/html\/CakePHPApp\/\r\n ServerName yourdomain.com\r\n ServerAlias www.yourdomain.com\r\n <Directory \/var\/www\/html\/CakePHPApp\/>\r\n Options FollowSymLinks\r\n AllowOverride All\r\n <\/Directory>\r\n ErrorLog \/var\/log\/httpd\/yourdomain.com-error_log\r\n CustomLog \/var\/log\/httpd\/yourdomain.com-access_log common\r\n<\/VirtualHost>\r\n<\/pre>\n
\/etc\/init.d\/httpd restart<\/pre>\n
http:\/\/yourdomain.com\/<\/pre>\n
http:\/\/book.cakephp.org\/3.0\/en\/index.html<\/a><\/pre>\n