Monica can be configured in shared hosting environments with a little differences that we can remedy easily. In this scenerio, Monica depends on the following:
Git: Git should come pre-installed with your server. If it doesn't - use the installation instructions in the link.
PHP: Install php7.2 minimum. Generally cPanel will have a PHP 7 version installed, verify unser the 'PHP Version' section from the cPanel section. Make sure these extensions are enabled:
- bcmath
- curl
- dom
- gd
- gmp
- iconv
- intl
- json
- mbstring
- mysqli
- opcache
- pdo_mysql
- redis
- sodium
- xml
- zip
- imagick
In most cases, this will be under the section called 'PHP Version' in cPanel where you can enable and disable modules.
Composer: After you're done installing PHP, you'll need the Composer dependency manager. Generally on most capable shared hosts, this is already installed. If it is not, please reference the below:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php --install-dir=/usr/local/bin/ --filename=composer
php -r "unlink('composer-setup.php');"
MySQL: Almost every cPanel environment includes this by default, and this will be our desired DB
Once the softwares above are installed:
You may install Monica by simply downloading the repository. You can download it by using the download button at the main repo page for Monica. Some people may want to use Git, and when you have properly logged into the cPanel server, issue the following commands:
cd /public_html/[subdomain you wish to install monica on]
git clone https://github.com/monicahq/monica.git
You should check out a tagged version of Monica since master
branch may not always be stable. Find the latest official version on the release page.
cd /var/www/monica
git checkout tags/v2.18.0
Use the cPanel database wizard to create a new database.
- Search for 'Database Wizard' in the cPanel GUI. Click on that item.
- Create a database name and click next.
- Create a user name and password for the user to access the database. Click Next
- Assign All Permissions to the user account.
- Save the password to be referenced later
- Duplicate
.env.example
to a file called.env
to create your own version of all the environment variables needed for the project to work. - Update
.env
to your specific needs- set
DB_USERNAME
andDB_PASSWORD
with the settings used above. - DO NOT set a database prefix, as you will overrun the limit of table and constraint names.
- configure a mailserver for registration & reminders to work correctly. Generally you can configure a SMTP account within cPanel and be fine.
- set the
APP_ENV
variable toproduction
,local
is only used for the development version. Beware: settingAPP_ENV
toproduction
will force HTTPS. Skip this if you're running Monica locally.
- set
- Log into the cPanel server via SSH and navigate to the directory in which you want to install Monica.
- Run
composer install --no-interaction --no-dev --ignore-platform-reqs
to install all packages. - Run
php artisan key:generate
to generate an application key. This will setAPP_KEY
with the right value automatically. - Run
php artisan setup:production -v
to run the migrations, seed the database and symlink folders. -
Navigate to 'Cron Jobs' in the cPanel GUI:
-
On that screen add the following:
-
Navigat to the 'Subdomain' section in the cPanel GUI:
-
Update the path of the domain you wish to assign to Monica to the following:
Open the cPanel file manager and navigate to the directory in which you want to install Monica. Then run these steps:
The setup:production
command will run migrations scripts for database, and flush all cache for config, route, and view, as an optimization process.
As the configuration of the application is cached, any update on the .env
file will not be detected after that. You may have to run php artisan config:cache
manually after every update of .env
file.
Monica requires some background processes to continuously run. The list of things Monica does in the background is described here.
Basically those crons are needed to send reminder emails and check if a new version is available.
To do this, setup a cron that runs every minute that triggers the following command php artisan schedule:run
.
Under common settings, select 'Once Per Minute'
Paste the following in the 'Command' section
php /var/www/monica/artisan schedule:run >> /dev/null 2>&1
/public_html/[subdomain you installed the monica folders on]/public
The final step is to have fun with your newly created instance, which should be up and running to http://[domain you installed Monica on]
.
From there you will be able to create an account and use the platform as normal.