Install suitecrm with composer / plesk / class not found

Hi there,
I am trying to install suitecrm with the php composer extension integrated in the plesk web hosting control panel.
I ran into a problem and want to make sure whether it is with suitecrm or with a vendor package or with plesk.

Problem: the installations fail with the error:

Symfony\Component\ErrorHandler\Error\ClassNotFoundError {#86

The autoloader expected class "ApiPlatform\Core\Bridge\Symfony\Bundle\DependencyInjection\ApiPlatformExtension" to be defined in 
file "<webroot>/suitecrm/vendor/composer/../api-platform/core/src/Core/Bridge/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php". 
The file was found but the class was not in it, the class name or namespace probably has a typo.

In the file …api-platform/core/src/Core/Bridge/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php,

declare(strict_types=1);

namespace ApiPlatform\Core\Bridge\Symfony\Bundle\DependencyInjection;

class_exists(\ApiPlatform\Symfony\Bundle\DependencyInjection\ApiPlatformExtension::class);

if (false) {
    final class ApiPlatformExtension extends \ApiPlatform\Symfony\Bundle\DependencyInjection\ApiPlatformExtension
    {
    }
}

Here is a similar problem: OpenApi export command does not work · Issue #5567 · api-platform/core · GitHub of the vendor package

What I did before: git clone the folder, set permissions:

cd mywebroot/
find . -type d -not -perm 2755 -exec chmod 2755 {} ;
find . -type f -not -perm 0644 -exec chmod 0644 {} ;
cd suitecrm/
chmod +x bin/console

It seems to me that the apiplatform package is used only for require-dev development purposes; however, the plesk extension makes sure that all dependencies are resolvable and so will complain that classes are not found if the development packages are not installed. So I assume that by necessity I will need to make sure that everything resolves correctly.

Any suggestion where the problem might lie?
Thank you
Julia

I don’t know about how Plesk interacts with composer, but…

Do you really need to run composer? The vendor directory is already “cooked up” for you in the installation package.

Hi @pgr, thanks for your reply. I would prefer git to pull future changes automatically. And in this case I need to run composer to populate the vendors.

1 Like

Composer shouldn’t be too hard to run. It basically

  • has to be installed
  • permissions and ownerships must allow it to write to the vendor dir

I am suspicious of your error saying <web root>/suitecrm/vendor

vendor should be directly in your web root. maybe check our web root settings before running composer.

Hi @pgr,

thanks for the hint,
I fixed the webroot to suitecrm/public/ before running composer.

However I still receive a symfony exception: Symfony\Component\ErrorHandler\Error\ ClassNotFoundError
Attempted to load class “DoctrineFixturesBundle” from namespace “Doctrine\Bundle\FixturesBundle”.
Did you forget a “use” statement for another namespace?

In core/backend/Kernel.php

I then tried uploading the suitecrm .zip with vendors included, it works without problems. Moreover, composer in plesk works, updates, installs without the above problems.

Switching then to Plesk’s composer “development mode” installs all dev packages successfully, but then the site ends in 500 response because of “less variables given than expected” errors in the api-platform package files.

I have worked with suitecrm quite a while and now am trying to find out what would be the best hosting modality for me, especially with the view to automation and management of multiple instances.

I am running out of ideas… but here are a couple more things you could check:

  • which is your exact composer command?

  • are your PHP and Mysql versions inside the compatibility matrix, both for CLI and for web server?