CloudPanel:Part 10 (PHP)

CakePHP

CakePHP

On this site, you find a guide to install CakePHP on CloudPanel.

Creating a CakePHP Site

Via CloudPanel

  1. Click on + Add Site and then click on Create a PHP Site.
  1. Select the Application CakePHP, enter Domain Name, Site User, Site User Password, and click on Create.

Via CloudPanel CLI

If you like the command line, you can create a CakePHP Site with the following command as root user.

clpctl site:add:php --domainName=www.domain.com --phpVersion=8.1 --vhostTemplate='CakePHP 4' --siteUser='john-doe' --siteUserPassword='!secretPassword!'

Creating a CakePHP Project

  1. Log in via SSH with the Site User:
ssh john-doe@server-ip-address
  1. Go to htdocs and delete the directory which CloudPanel has created:
cd htdocs && rm -rf www.domain.com
  1. Edit the crontab for the site user.
crontab -e
  1. Create a CakePHP Project via Composer:
php8.1 /usr/local/bin/composer create-project --prefer-dist cakephp/app:~4.4 www.domain.com
  1. Done! You can now open your site in your browser to see the Welcome to CakePHP 4 page.

CodeIgniter

On this site, you find a guide to install CodeIgniter on CloudPanel.

Creating a CodeIgniter Site

Via CloudPanel

  1. Click on + Add Site and then click on Create a PHP Site.
  1. Select the Application CodeIgniter 4, enter Domain Name, Site User, Site User Password, and click on Create.

Via CloudPanel CLI

If you like the command line, you can create a CodeIgniter Site with the following command as root user.

clpctl site:add:php --domainName=www.domain.com --phpVersion=8.2 --vhostTemplate='CodeIgniter 4' --siteUser='john-doe' --siteUserPassword='!secretPassword!'

Creating a CodeIgniter Project

  1. Log in via SSH with the Site User:
ssh john-doe@server-ip-address
  1. Go to htdocs and delete the directory which CloudPanel has created:
cd htdocs && rm -rf www.domain.com
  1. Create a CodeIgniter Project via Composer:
php8.1 /usr/local/bin/composer create-project codeigniter4/appstarter www.domain.com
  1. Done! You can now open your site in your browser to see the Welcome to CodeIgniter page.

Drupal

On this site, you find a guide to install Drupal on CloudPanel.

Creating a Drupal Site

Via CloudPanel

  1. Click on + Add Site and then click on Create a PHP Site.
  1. Select the Application Drupal 10, enter Domain Name, Site User, Site User Password, and click on Create.

Via CloudPanel CLI

If you like the command line, you can create a Drupal Site with the following command as root user.

clpctl site:add:php --domainName=www.domain.com --phpVersion=8.2 --vhostTemplate='Drupal 10' --siteUser='john-doe' --siteUserPassword='!secretPassword!'

Creating a Drupal Project

  1. Log in via SSH with the Site User:
ssh john-doe@server-ip-address
  1. Go to htdocs and delete the directory which CloudPanel has created:
cd htdocs && rm -rf www.domain.com
  1. Create a Drupal Project via Composer:
php8.2 /usr/local/bin/composer create-project drupal/recommended-project:^10 -n www.domain.com
  1. Create a Database, open your site in the browser, and go through the Drupal Installer.
  1. Done! Drupal has been installed.

Joomla

On this site, you find a guide to install Joomla on CloudPanel.

Creating a Joomla Site

Via CloudPanel

  1. Click on + Add Site and then click on Create a PHP Site.
  1. Select the Application Joomla 4, enter Domain Name, Site User, Site User Password, and click on Create.

Via CloudPanel CLI

If you like the command line, you can create a Joomla Site with the following command as root user.

clpctl site:add:php --domainName=www.domain.com --phpVersion=8.0 --vhostTemplate='Joomla 4' --siteUser='john-doe' --siteUserPassword='!secretPassword!'

Creating a Joomla Project

  1. Log in via SSH with the Site User:
ssh john-doe@server-ip-address
  1. Go to the tmp directory:
cd ~/tmp
  1. Download and extract the latest Joomla 4 version.
mkdir ~/tmp/joomla && curl -sL https://downloads.joomla.org/cms/joomla4/4-3-1/Joomla_4-3-1-Stable-Full_Package.tar.gz | tar xfz - -C ~/tmp/joomla/
  1. Copy files to the root directory of your site:
cp -R ~/tmp/joomla/* ~/htdocs/www.domain.com/
  1. Clean up the tmp directory.
rm -rf ~/tmp/*
  1. Create a Database, open your site in the browser, and go through the Joomla Installer.
  1. Done! Joomla is now installed.

Laravel

On this site, you find a guide to install Laravel on CloudPanel.

Creating a Laravel Site

Via CloudPanel

  1. Click on + Add Site and then click on Create a PHP Site.
  1. Select the Application Laravel 10, enter Domain Name, Site User, Site User Password, and click on Create.

Via CloudPanel CLI

If you like the command line, you can create a Laravel Site with the following command as root user.

clpctl site:add:php --domainName=www.domain.com --phpVersion=8.2 --vhostTemplate='Laravel 10' --siteUser='john-doe' --siteUserPassword='!secretPassword!'

Creating a Laravel Project

  1. Log in via SSH with the Site User:
ssh john-doe@server-ip-address
  1. Go to htdocs and delete the directory which CloudPanel has created:
cd htdocs && rm -rf www.domain.com
  1. Create a Laravel Project via Composer:
php8.2 /usr/local/bin/composer create-project --prefer-dist laravel/laravel:^10 -n www.domain.com
  1. Done! You can now open your site in your browser to see the welcome page.

WooCommerce

On this site, you find a guide to install WooCommerce on CloudPanel.

Creating a WordPress Site

Click on + Add Site and then click on Create a WordPress Site.

  1. Enter the Domain Name, Site Title, Admin User Name, Admin Password, and Admin E-Mail and click on Create.
  1. Login to the admin area of WordPress and click on Plugins –> Add New in the left menu and search for WooCommerce.
  1. Click on Install Now, Activate the Plugin, and go through the WooCommerce Installer.
  1. Done! WooCommerce has been installed.

Building a PHP Extension

On this site, you find a step-by-step guide on how to build a PHP Extension for a specific PHP Version.

  1. Make a backup of your instance.
  2. Install the dev package for the PHP Version.
apt update && apt -y install php8.1-dev
  1. Go to https://pecl.php.net/ and search for the extension like ssh2:
  1. Download the tgz via cURL:
curl -O https://pecl.php.net/get/ssh2-1.3.1.tgz
  1. Extract the tgz:
tar xf ssh2-1.3.1.tgz
  1. phpize the extension:
cd ssh2-1.3.1
phpize8.1
  1. Compile and build the extension:
./configure
make
make install
  1. Register the extension for CLI and FPM in the php.ini:
CLI
nano /etc/php/8.1/cli/php.ini
Add the following line at the end:
extension=ssh2.so
FPM
nano /etc/php/8.1/fpm/php.ini
Add the following line at the end:
extension=ssh2.so
  1. Restart the PHP-FPM service:
systemctl restart php8.1-fpm

Testing

After registering the PHP Extension, you can check if the extension is loaded for CLI and FPM correctly.

CLI

You can use grep to check if the extension is loaded:

php8.1 -m |grep 'ssh2'

If you don’t get an output, then the extension is NOT loaded.

FPM

To check if the extension is loaded for FPM, you can check the phpinfo.

  1. Create the file t.php in the root directory.

  2. Put the following content in the file:

<?php
phpinfo();
  1. Open t.php in your browser and search for the extension.

If you don’t find information about the extension, then it’s NOT loaded.

ionCube Loader

Attention

There is currently no ionCube Loader for PHP 8.0 available.

Using ionCube encoded and secured PHP files requires a file called the ionCube Loader to be installed on the web server and made available to PHP.

Enable Loader

The ionCube Loader extension is being shipped by default for all PHP Versions but disabled for performance reasons.

To enable ionCube Loader for a specific PHP Version, you need to enable it for CLI and FPM:

  1. Open the php.ini for the CLI and FPM:
nano /etc/php/8.1/cli/php.ini
nano /etc/php/8.1/fpm/php.ini
  1. Go to the end of the file and remove the semicolon in the beginning.
;zend_extension=ioncube_loader.so
  1. Restart the PHP-FPM service:
systemctl restart php8.1-fpm

Node.js for PHP Sites

On this site, you will find a guide on installing Node.js via the nvm (Node Version Manager) for your site.
  1. Log in via SSH with the Site User:
ssh john-doe@server-ip-address
  1. Install nvm with the following command:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
  1. Update the current shell environment:
source ~/.bashrc
  1. Install your required Node.js version e.g. 16:
nvm install 16
  1. Activate the installed Node.js version:
nvm use 16
  1. Done! Check the Node.js version:
node -v