Introduction:
CakePHP is a popular PHP framework that simplifies web application development. With Plesk and the PHP Composer extension, customers can easily install and manage CakePHP projects without needing to use the command line. This guide will walk you through the steps to set up CakePHP on your Plesk hosting environment.
Step 1: Log In to Plesk
- Access your Plesk control panel using your login credentials.
Step 2: Set Up a Domain or Subdomain
- Navigate to Websites & Domains.
- If you don’t already have a domain or subdomain set up where you want to install CakePHP, click Add Domain or Add Subdomain.
- Follow the prompts to create the domain or subdomain where you wish to install CakePHP.
Step 3: Access the PHP Composer Extension
- In Plesk, under Websites & Domains, select the domain where you want to install CakePHP.
- Click on PHP Composer from the available tools. If you don’t see it, make sure the PHP Composer extension is installed and activated.
Step 4: Install CakePHP Using Composer
-
Create a New Project:
- In the PHP Composer extension, click Install under Install Composer dependencies if prompted.
- Choose Create a new Composer project.
- In the Package name field, enter
cakephp/app
to install the latest version of the CakePHP application skeleton.
-
Specify the Installation Directory:
- Choose the appropriate directory where the project should be installed, such as
/httpdocs
or a subfolder.
- Choose the appropriate directory where the project should be installed, such as
-
Run the Installation:
- Click Install. Plesk will automatically execute the Composer command to download and install CakePHP in the specified directory.
Step 5: Configure the Database
-
Create a Database:
- Go to Databases in Plesk and add a new database for your CakePHP project.
- Note down the database name, username, and password for later use.
-
Edit the CakePHP Configuration:
- Use the File Manager in Plesk to navigate to your CakePHP project directory.
- Open the
config/app_local.php
file. - Update the database configuration in the file to match the database details you created:
Step 6: Set Folder Permissions
- Ensure the
logs
andtmp
directories are writable by the web server. - You can change the permissions using Plesk's File Manager:
- Navigate to the
logs
andtmp
directories. - Set the permissions to Writable for the web server user (usually
www-data
orapache
).
- Navigate to the
Step 7: Test Your CakePHP Installation
- Open a web browser and navigate to the domain or subdomain where CakePHP was installed.
- If everything is set up correctly, you should see the default CakePHP welcome page.
Step 8: Manage CakePHP Using the PHP Composer Extension
- The PHP Composer extension in Plesk allows you to manage your CakePHP project with ease.
- You can run Composer commands such as install, update, or require directly from the Plesk GUI.
- This approach helps to avoid using the command line, making it easier for beginners.
Troubleshooting
-
Composer Error:
PHP is not found
Ensure that PHP is installed and configured correctly on your server. You can verify the PHP installation in Plesk by navigating to Tools & Settings > PHP Settings. -
Cannot Access PHP Composer Extension
Make sure the PHP Composer extension is installed in Plesk. If not, you may need to install it through Plesk's Extensions Catalog. -
CakePHP Welcome Page Not Showing
Verify that your domain is pointed correctly to the Plesk server and that the folder permissions forlogs
andtmp
are set to writable.
Conclusion
Installing and managing CakePHP projects is straightforward with Plesk's PHP Composer extension.
This guide provides the steps needed to help you get started with your CakePHP project in just a few minutes.