How to install CakePHP manually
This article describes how to manually install the CakePHP web application framework on your A2 Hosting account.
Information in this article about unmanaged dedicated servers is only for customers who purchased those plans before May 27, 2024. As of that date, unmanaged dedicated servers are no longer available. Our new managed dedicated server plans feature more powerful hardware to meet your hosting needs. To view available dedicated hosting options, please visit
https://www.a2hosting.com/dedicated-server-hosting/.
Installing CakePHP
CakePHP is compatible with all A2 Hosting accounts.
Although A2 Hosting servers are compatible with a wide variety of software applications, we cannot provide troubleshooting assistance for application-specific issues.
To install CakePHP manually, follow these steps:
- Download the CakePHP installation .zip file at http://cakephp.org to your local computer.
- Extract the .zip file on your computer.
- Use FTP to upload the contents of the extracted cakephp-cakephp-3d0ed9b directory to the public_html directory of your A2 Hosting account. (The exact name of the extracted directory differs based on the CakePHP version you download.)
- This step assumes that you want to install CakePHP in your account's document root directory. If you want to install CakePHP in a subdirectory instead, upload the files to the subdirectory instead.
- If you have an unmanaged product (such as an unmanaged VPS or an unmanaged dedicated server), your document root directory may be in a different directory, such as /var/www/html. Consult your Linux distribution's documentation for the document root directory location.
Create a MySQL database and database user for CakePHP. You will need this information during the configuration process.
- If your account includes cPanel, please see this article for information about how to create a MySQL database and user.
- If your account does not include cPanel, you can create a MySQL database and user from the command line. For information about how to do this, please see this article.
- Using the cPanel File Manager or the SSH command prompt, from the document root directory rename the app/Config/database.php.default file to app/Config/database.php.
- Using the cPanel File Manager or the SSH command prompt, open the app/Config/database.php file in your preferred text editor.
Locate the following lines in the database.php file:
public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'user',
'password' => 'password',
'database' => 'database_name',
'prefix' => '',
//'encoding' => 'utf8',
);
Modify the lines as follows:
- In the 'login' => 'user' line, replace user with the name of the database user you created in step 4.
- In the 'password' => 'password' line, replace the second instance of password with the password of the database user you created in step 4.
- In the 'database' => 'database_name' line, replace database_name with the name of the database you created in step 4.
- If you want to use a table prefix in the database, specify a value in the 'prefix' => '' line.
You can also configure an optional test database. To do this, modify the $test array with the values for your test database.
- Save your changes to the database.php file and exit the text editor.
- Using the cPanel File Manager or the SSH command prompt, open the app/Config/core.php file in your preferred text editor.
Locate the following lines in the core.php file:
/**
* A random string used in security hashing methods.
*/
Configure::write('Security.salt', 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi');
/**
* A random numeric string (digits only) used to encrypt/decrypt strings.
*/
Configure::write('Security.cipherSeed', '76859309657453542496749683645');
Modify the lines as follows:
- In the Configure::write('Security.salt' line, modify or completely replace the salt value. The salt value can be anything you want.
- In the Configure::write('Security.cipherSeed' line, modify or completely replace the cipher seed value. The cipher seed value can be anything you want, but it must contain only digits.
- Save your changes to the core.php file and exit the text editor.
Use your web browser to go to the CakePHP URL.
If you copied the CakePHP files to the document root directory in step 3, the installation URL is your domain name (for example, http://www.example.com). If you copied the CakePHP files to a subdirectory in step 3, add the subdirectory's name to the URL.
The CakePHP default page appears. You should receive a series of green notification messages about the configuration. You should not receive any red error notification messages.
You may receive a notification message about
DebugKit. This is an optional component that you can install separately.
- CakePHP is now installed and configured.
Configuring the CakePHP console
CakePHP includes a command-line console for creating and managing applications. To configure your shell environment so you can start the console from any directory, follow these steps:
- Log in to your account using SSH.
- To make sure you are in your home directory, type the following command at the command line:
cd ~
Edit the .bash_profile file in your home directory using your preferred text editor. The .bash_profile file should contain the following configuration:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
# Set path for CakePHP console:
PATH=$PATH:$HOME/public_html/lib/Cake/Console
export PATH
# END
You may need to modify the PATH line above to match the exact path to the lib/Cake/Console directory on your own account.
- Save your changes to the .bash_profile file and exit the text editor.
To make the settings in the .bash_profile file take effect immediately, type the following command:
source ~/.bash_profile
To verify that the CakePHP console starts, type the following command:
cake
You should see the Welcome to CakePHP Console message.
For more information about CakePHP, please visit http://cakephp.org.