Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Modernizing Enterprise CMS Using Pimcore

You're reading from   Modernizing Enterprise CMS Using Pimcore Discover techniques and best practices for creating custom websites with rich digital experiences

Arrow left icon
Product type Paperback
Published in Aug 2021
Publisher Packt
ISBN-13 9781801075404
Length 412 pages
Edition 1st Edition
Concepts
Arrow right icon
Authors (3):
Arrow left icon
Francesco Minà Francesco Minà
Author Profile Icon Francesco Minà
Francesco Minà
Marco Guiducci Marco Guiducci
Author Profile Icon Marco Guiducci
Marco Guiducci
Daniele Fontani Daniele Fontani
Author Profile Icon Daniele Fontani
Daniele Fontani
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Preface 1. Chapter 1: Introducing Pimcore 2. Chapter 2: Setting Up Your Pimcore Development Environment FREE CHAPTER 3. Chapter 3: Getting Started with Pimcore Admin UI 4. Chapter 4: Creating Documents in Pimcore 5. Chapter 5: Exploring Objects and Classes 6. Chapter 6: Using Digital Asset Management 7. Chapter 7: Administrating Pimcore Sites 8. Chapter 8: Creating Custom CMS Pages 9. Chapter 9: Configuring Entities and Rendering Data 10. Chapter 10: Creating Pimcore Bricks 11. Chapter 11: Finalizing the Website 12. Chapter 12: Implementing Product Information Management 13. Chapter 13: Implementing Master Data Management 14. Chapter 14: Data Integration 15. Other Books You May Enjoy

Installing Pimcore from Composer (without Docker)

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.

  1. Create a folder in your filesystem. We assume that this folder is named 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.
  2. Run the following command:
    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.

  3. If you do not have one yet, you will need to create a database. To do this, type the following command in your terminal:
    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.

  4. Edit your Apache virtual host. It needs to point to the web folders inside 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.

  5. Set the filesystem permissions. The Apache user (or the Nginx user, depending on which web server you are using) will need to access all the files inside the Pimcore directory and will need additional write permission for the /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.

  6. Navigate to the Pimcore directory and type the following command:
    cd ./my-project

    This will bring you to the /your/project/my-project directory.

  7. Launch the Pimcore installation by typing the following command:
    ./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

    Figure 2.1 – Pimcore installation and admin password prompt

  8. You will be prompted to enter the username and password of the Pimcore administration user, and then you will be asked to confirm the installation.
  9. The final step is to set up the maintenance job. Like many platforms, Pimcore needs to perform periodic maintenance tasks, such as log rotation and cleaning temporary or old data. Pimcore's guidelines ask us to execute this task every 5 minutes to make sure the environment is always efficient. To do this, we need to add a cron job. Type the following:
    crontab -e
  10. Then, enter the following content into 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.

You have been reading a chapter from
Modernizing Enterprise CMS Using Pimcore
Published in: Aug 2021
Publisher: Packt
ISBN-13: 9781801075404
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime