Install Oro Platform 3.1.3 on Centos 7.4.1708 - Nginx 1.12 - PHP 7.1

Posted Over 4 years ago. Visible to the public.

Reference the official install guide Show snapshot .

We are using Symfony Framework v. 3.4 LTS in Oro Applications v.3.x.

Errors I Encountered and How I Fixed Them

Apache is Active

Check Port 80

[kiat@reporting /]$ sudo netstat -tulpn | grep :80
tcp        0      0    *               LISTEN      55851/httpd

Port 80 is used by Apache (as user httpd).

Disable Apache

[kiat@reporting /]$ sudo systemctl stop httpd
[kiat@reporting /]$ sudo systemctl disable httpd
[kiat@reporting /]$ sudo systemctl mask httpd
Created symlink from /etc/systemd/system/httpd.service to /dev/null.

Enable Nginx

[kiat@reporting /]$ sudo su
[root@reporting /]# systemctl start nginx
[root@reporting /]# systemctl enable nginx
Created symlink from /etc/systemd/system/ to /usr/lib/systemd/system/nginx.service.
[root@reporting /]# netstat -plntu
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 *               LISTEN      61559/sshd
tcp        0      0  *               LISTEN      29118/mysqld
tcp        0      0   *               LISTEN      1/systemd
tcp        0      0    *               LISTEN      50978/nginx: master
tcp        0      0  *               LISTEN      2453/master
tcp6       0      0 :::15722                :::*                    LISTEN      61559/sshd
tcp6       0      0 :::111                  :::*                    LISTEN      1/systemd
tcp6       0      0 :::80                   :::*                    LISTEN      50978/nginx: master
tcp6       0      0 ::1:25                  :::*                    LISTEN      2453/master
udp        0      0 *                           1401/chronyd
udp        0      0  *                           1414/avahi-daemon:
udp        0      0 *                           1414/avahi-daemon:
udp6       0      0 ::1:323                 :::*                                1401/chronyd

Install Missing PHP Extensions: mysqli & intl & zip

Sample Error Messages When Install with Composer

[kiat@reporting oroapp]$ composer install --prefer-dist --no-dev
Loading composer repositories with package information
Installing dependencies from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for oro/platform 3.1.3 -> satisfiable by oro/platform [3.1.3].
    - oro/platform 3.1.3 requires ext-zip * -> the requested PHP extension zip is missing from your system.
  Problem 2
    - oro/platform 3.1.3 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - oro/platform-serialised-fields 3.1.3 requires oro/platform ~3.1.1 -> satisfiable by oro/platform[3.1.3].
    - Installation request for oro/platform-serialised-fields 3.1.3 -> satisfiable by oro/platform-serialised-fields[3.1.3]

Note: instead of installing as user myself, kiat, it's better to install as user nginx:

$ sudo -u nginx composer install --prefer-dist --no-dev

Install PHP Extensions

$ sudo yum --enablerepo=remi-php71 install php-mysqli php-intl php-pecl-zip
$ sudo systemctl restart php-fpm nginx
$ php -m
[PHP Modules]
Zend OPcache

[Zend Modules]
Zend OPcache

Search for Extension in remi-php71 Repository

For example to search for zip extension:

[kiat@reporting oroapp]$ yum search php71 | grep zip
php71-php-pecl-zip.x86_64 : A ZIP archive management extension

The search result shows that the complete name of the extension is php71-php-pecl-zip.x86_64. To install it in server running single version of PHP, remove the prefix php71:

$ sudo yum --enablerepo=remi-php71 install php-pecl-zip #try this first for server running single PHP7.1 version
$ sudo yum --enablerepo=remi-php71 install php71-php-pecl-zip # for server running multiple PHP versions

Install Oro Platform

File Permission Error

[kiat@reporting oroapp]$ php ./bin/console oro:install --env=prod --timeout=900

In Filesystem.php line 104:

  Failed to create "/usr/share/nginx/html/oroapp/var/cache/prod": mkdir(): Permission denied.

The above would run as user kiat.

Set Permissions, Owner, and Group

devs is the developer group:

[kiat@reporting oroapp]$ cd ..
[kiat@reporting html]$ sudo chown -R nginx:devs oroapp
[kiat@reporting oroapp]$ cd oroapp
[kiat@reporting oroapp]$ sudo find . -type f -exec chmod 0664 {} \;
[kiat@reporting oroapp]$ sudo find . -type d -exec chmod 0775 {} \;

And then install as user nginx:

[kiat@reporting oroapp]$ sudo -u nginx php ./bin/console oro:install --env=prod --timeout=900 

PHP Ran Out of Memory

There are many repositories by OroInc Show snapshot . The repository of interest is OroPlatform Show snapshot - business application management system that is a backbone of the OroCRM and OroCommerce, and not this platform - Main OroPlatform package with core functionality Show snapshot .

$ sudo -u nginx composer install --prefer-dist --no-dev
Deprecation warning: require.nesbot/Carbon is invalid, it should not contain uppercase characters. Please use nesbot/carbon instead. Make sure you fix this as Composer 2.0 will error.
Loading composer repositories with package information
Updating dependencies
PHP Fatal error:  Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar:///usr/bin/composer/src/Composer/DependencyResolver/RuleSetGenerator.php on line 129

Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar:///usr/bin/composer/src/Composer/DependencyResolver/RuleSetGenerator.php on line 129

Check for more info on how to handle out of memory errors.

Set 5GB Memory

Contrary to the memory_limit setting in the guide Show snapshot , which is 1024M, I needed to set it to 5120M:

$ sudo vim /etc/php.ini
$ # type "?memory_limit" to go to the param
$ # press Insert button on keyboard 
$ # change the value from 1024M to 5120M
$ # press Esc and type ":wq" to quit
$ sudo systemctl restart php-fpm
$ sudo -u nginx composer install --prefer-dist --no-dev

Deprecated Composer Package

The following are known issues:

Package phpoffice/phpexcel is abandoned, you should avoid using it. Use phpoffice/phpspreadsheet instead.
Package guzzle/guzzle is abandoned, you should avoid using it. Use guzzlehttp/guzzle instead.

See issue #821 Show snapshot and #20 Show snapshot .

Fatal Error: ClassNotFoundException: Attempted to load classOroTwigInspectorBundle

This is due to missing oro/twig-inspector package, which is only installed in dev environment. To fix this, just use composer to install without the option --no-dev:

[kiat@reporting misoro]$ sudo -u nginx composer install --prefer-dist
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 52 installs, 0 updates, 0 removals

var/cache/prod is not writable

After complete installation and warming the cache with $ sudo -u nginx php ./bin/console oro:api:doc:cache:clear, and firing up the browser, the URL returned a blank page, but I expected the login page.

Error log in /var/log/nginx/oro.mis.sc_error.log

2019/03/08 18:34:24 [error] 41641#0: *13 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught InvalidArgumentException: The directory "/usr/share/nginx/html/misoro/var/cache/prod" is not writable. in /usr/share/nginx/html/misoro/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php:86
Stack trace:
#0 /usr/share/nginx/html/misoro/vendor/doctrine/cache/lib/Doctrine/Common/Cache/PhpFileCache.php(33): Doctrine\Common\Cache\FileCache->__construct('/usr/share/ngin...', '.pubSubRouter.p...', 2)
#1 /usr/share/nginx/html/misoro/vendor/gos/pubsub-router-bundle/Cache/PhpFileCacheDecorator.php(23): Doctrine\Common\Cache\PhpFileCache->__construct('/usr/share/ngin...', '.pubSubRouter.p...')
#2 /usr/share/nginx/html/misoro/var/cache/prod/ContainerGiavsid/getGosPubsubRouter_Loader_WebsocketService.php(17): Gos\Bundle\PubSubRouterBundle\Cache\PhpFileCacheDecorator->__construct('/usr/share/ngin...', false)
#3 /usr/share/nginx/html/misoro/var/cache/prod/ContainerGiavsid/srcProdProjectContainer.php(7007): require('/usr/share/ngin...')
#4 /usr/share/nginx/html/misoro/ven" while reading response header from upstream, client:, server:, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://", host: ""

The issue was SELinux: verified and fixed temporary:

[kiat@reporting misoro]$ sudo setenforce 0 # turn off SELinux, then I refresh browser, I see login page
[kiat@reporting misoro]$ sudo setenforce 1 # turn on SELinux
[kiat@reporting misoro]$ sudo semanage permissive -a httpd_t # allow nginx to run in permissive mode temporary

Reference SELinux guide Show snapshot .

error: could not lock config file .git/config: Permission denied

Set Owner and File Permissions

devs is a group for developers. At the application root:

[kiat@reporting misoro]$ sudo chown -R root:devs .git
[kiat@reporting misoro]$ sudo find .git -type f -exec chmod 664 {} \;
[kiat@reporting misoro]$ sudo find .git -type d -exec chmod 775 {} \;

Create an upstream Branch and Set origin to My Remote Repo

[kiat@reporting misoro]$ git remote add upstream
[kiat@reporting misoro]$ git remote -v
origin (fetch)
origin (push)
upstream (fetch)
upstream (push)
[kiat@reporting misoro]$ git remote set-url origin
[kiat@reporting misoro]$ git remote -v
origin (fetch)
origin (push)
upstream (fetch)
upstream (push)

Git Operations

Push to origin

[kiat@reporting misoro]$ git push -u origin --all
Warning: Permanently added the RSA host key for IP address '' to the list of known hosts.

Update Local Master From Upstream

Reference How to Upgrade to a New Version Show snapshot

I created a new local branch upstream_master for synching with upstream remote repo.

[kiat@reporting misoro]$ git checkout upstream_master
M       bin/console
M       bin/dist
M       var/import_export/.gitignore
Switched to branch 'upstream_master'
[kiat@reporting misoro]$ git pull upstream master
 * branch            master     -> FETCH_HEAD
Already up-to-date.
[kiat@reporting misoro]$ git push origin upstream_master
Counting objects: 290, done.
Delta compression using up to 64 threads.
Compressing objects: 100% (181/181), done.
Writing objects: 100% (244/244), 134.57 KiB | 0 bytes/s, done.
Total 244 (delta 98), reused 190 (delta 63)
remote: Resolving deltas: 100% (98/98), completed with 11 local objects.
remote: Create pull request for upstream_master:
 * [new branch]      upstream_master -> upstream_master

Then use TortoiseGit to merge and push.

Last edit
Over 3 years ago
Posted by kiatng to Oro (2019-03-07 04:12)