
Modernizing Enterprise CMS Using Pimcore
By :

Even though we encourage the use of Docker and the book is based on Docker containers, we should not fail to explain how to perform a vanilla installation. As you will learn after following all the steps, the process of installing Pimcore the vanilla way is basically the same as what is done internally by the Docker container. The most important difference is that using Docker, you do not have to grapple with the server, dependencies, and so on. This is because Pimcore is released through Composer, the PHP package manager. This makes the installation the same in all possible scenarios. If you are inside a Docker container, a virtual machine, or your PC, Composer is the same.
So, all you need to do to install Pimcore in your local environment is to run a few commands in the terminal after you have installed all the required dependencies mentioned in the Technical requirements section:
Note
This book uses a ready-to-use Docker container for this process. We are including this section to explain how a low-level installation of Pimcore works, but if you are interested in starting Pimcore quickly, you can skip this section and go to Installing Pimcore using Docker. Moreover, unlike Docker, using Composer in your local environment has a lot of dependencies (MySQL, Composer, and others) and needs complex PHP tuning. This is well covered by the Pimcore documentation and you can follow the official guidance for that. In this section, we will cover Pimcore's installation, assuming that you already have your environment set up and you just need to install Pimcore.
my-project
. There are no restrictions from Pimcore about where you can create that folder. It depends on your local settings (that is, it has to be accessible to your web server). For example, when using Apache, a common value is /var/www/html
.COMPOSER_MEMORY_LIMIT=-1 composer create-project Pimcore/skeleton my-project
This command will install the Pimcore/skeleton
package in the my-project
folder. This will also create a new folder in your filesystem, and the final path will be /your/project/my-project
. Pimcore is available in two different releases: skeleton and demo. When starting a new project, it is recommended that you use the skeleton template, but if you want to see Pimcore's features, you can install the demo package to get a website with data that is ready to test. The process will take a moment, and you will see some console output that will display its progress.
mysql -u root -p -e "CREATE DATABASE project_database charset=utf8mb4;"
You can fine-tune the preceding command by changing the host, username, and password to fit your needs, or you can use a visual tool such as MySQL Workbench. You can also change the database name. The most important thing to remember is to use the right charset, utf8mb4
, to fully support Unicode encoding.
my-project
, so your Apache file should have the document root set as follows:DocumentRoot /my/project/my-project/public
Note that Pimcore needs to be installed outside of the document root. So, if you installed it inside my-project
, you cannot use this folder as the document root. This, besides causing functional issues, will expose you to security issues in terms of allowing access to protected content. A complete configuration for Apache can be found here: https://pimcore.com/docs/pimcore/current/Development_Documentation/Installation_and_Upgrade/System_Setup_and_Hosting/Apache_Configuration.html.
/var
and /public/var
folders. In most cases, this is done by entering the following code:chown -R www-data . chmod 764 ./var chmod 764 ./public/var
Here, chown
makes www-data
(usually the group where the user that runs the web server belongs) the group owner of the Pimcore folder, and then chmod
adds write permission to the required folders.
cd ./my-project
This will bring you to the /your/project/my-project
directory.
./vendor/bin/Pimcore-install --MySQL-host-socket=localhost --MySQL-username=yourusename --MySQL-password=yourpassword --MySQL-database=databasename
Here, MySQL-host-socket
is the hostname of the MySQL database, MySQL-username
and MySQL-password
are the database credentials, and MySQL-database
is the database name. This command will set up the Pimcore connection settings and will install Pimcore in the database. You will be prompted to choose the admin user for the Pimcore back office; we will choose admin\pimcore
as a credential, but you can use whatever you want (although the use of simple passwords in your production environment is discouraged).
In the following screenshot, we can see the console output that we receive after launching the installation command:
Figure 2.1 – Pimcore installation and admin password prompt
cron
job. Type the following:crontab -e
crontab
:*/5 * * * * /your/project/bin/console maintenance
The configuration activates the maintenance job by running the console
executable, with the maintenance
parameter, which invokes the standard Pimcore maintenance job.
In this section, we introduced the Pimcore installation process. These instructions are quite easy to follow, but you need to have the hosting environment already installed. Installing Apache, MySQL, and configuring the network part is standard for most developers, but some system engineering knowledge is required that not all developers have (and maybe do not want to learn). Moreover, with this setup, you may have to replicate most of your jobs each time you set up a new project.
In the next section, we will learn how things are so much easier with Docker, seeing how you can do the same as what we achieved here (and maybe more) in just two commands.