Preparing The cPanel Server Environment
Required Information
You will need to know your project’s PHP version for the following steps.
If you are using DDEV, you can see the PHP version you are running locally
in .ddev/config.yaml
InMotion’s Linux servers are configured out of the box with the majority of the software requirements met. There are still a few changes we’ll need to make, and for those you will need to access Root WHM — NOT WHM — for the server you wish to use.
Once these steps are done, you shouldn't need to repeat them for this server again until you need to add a new PHP version or extension.
Install PHP & Extensions
- Type
easyapache
into the search bar in the left panel and then click on the EasyApache 4 link. - Next to Currently Installed Packages, click on the Customize button.
- Click on PHP Versions and toggle on the version of your project if it isn’t already.
- Click on PHP Extensions and search for
sodium
. Enable php-sodium for the version of PHP that you will be using. Be sure you are selecting php-sodium and not php-libsodium. - Click on Review, and then scroll down and click the Provision button.
Adjust PHP Settings
- Type
multiphp
into the search bar in the left panel and then click on the MultiPHP Manager link. - Look for PHP Version near the top, and ensure that this version is set to equal or greater than the version your project requires.
- Now click on MultiPHP INI Editor in the left panel.
- Select the version of PHP you will be using, and set memory_limit to at least
256M
. - Click apply.
Configure Supervisor for Scheduled Tasks
- Using Root WHM, install Supervisor if it isn't already installed.
-
Using Root WHM, create the configuration file (replacing
<YourProjectName>
,<LinuxUsername>
, and<PathToSymfonyProjectFolder>
with the appropriate values and removing the angle brackets) in/etc/supervisord.d/
:# /etc/supervisord.d/<YourProjectName>.ini [program:<YourProjectName>-symfony-messages-mailer] command=php /home/<LinuxUsername>/<PathToSymfonyProjectFolder>/bin/console messenger:consume mailer --time-limit=3600 user=<LinuxUsername> numprocs=1 autostart=true autorestart=true startretries=10 process_name=%(program_name)s_%(process_num)02d [program:<YourProjectName>-symfony-messages-scheduled] command=php /home/<LinuxUsername>/<PathToSymfonyProjectFolder>/bin/console messenger:consume scheduler_default scheduled --time-limit=3600 user=<LinuxUsername> numprocs=1 autostart=true autorestart=true startretries=10 process_name=%(program_name)s_%(process_num)02d [program:<YourProjectName>-symfony-messages-async] command=php /home/<LinuxUsername>/<PathToSymfonyProjectFolder>/bin/console messenger:consume async --time-limit=3600 user=<LinuxUsername> numprocs=1 autostart=true autorestart=true startretries=10 process_name=%(program_name)s_%(process_num)02d
Enable SSH Access (Optional)
These steps are only needed if you intend to automate deployment through Github Workflows. We highly recommend this when possible to speed up future deployments.
- Type
firewall
into the search bar in the left panel and then click on the ConfigServer Security & Firewall link. - Click on the csf tab, and then click the button Firewall Configuration.
- Search the page for
TCP_IN
, and ensure that22
is included in the ordered list. Add it if it is not already there. - If you changed
TCP_IN
, scroll to the bottom of the page and click the Change button. On the next screen, you should click the Restart csf+lfd button to apply the new rules immediately.