SuiteCRM 8.7.1 Breaks API V4_1

I had a working 8.6 version using for API V4_1 and it worked great.

Upgraded to 8.7.1 and now getting a 500 error on login request.

To test, I installed a fresh 8.7.1 (well actually it was 8.6 from installatron which did work and then I upgraded to 8.7.1) Same issue, 500 error on the /service/v4_1/rest.php

The error is:

[22-Jan-2025 16:49:13 UTC] PHP Fatal error:  Cannot declare class LanguageManager, because the name is already in use in /home/xxxxxxxxxx/public_html/xxxxxxxxxxxxxxxx.com/public/legacy/include/SugarObjects/LanguageManager.php on line 50

I tried wrapping it in a “if not already loaded” which got me by this error, then another error similar with another class in the same directory, did the same got by that error, then another the same… etc.

There must be a root to this problem somewhere.

Anyone else on 8.7.1 can you test by going to:

/service/v4_1/rest.php

and see if you get a 500 error?

Strange…

Is that all the text that the error gives you? I would expect information about the two places where the repeated declaration occurs…

Let me know how can I test it?

@rsp just navigate to the URL:

yourdomainname.com/service/v4_1/rest.php

Let me know if you get a 500 error or not. If it’s working it should resolve to an instruction page about the 4_1 API, if not you’ll get 500.

I got File not found.

Failed to load resource: the server responded with a status of 404 (Not Found)

That’s a different problem. You likely don’t have your .htaccess setup properly to redirect. This should either resolve or in my case get an error.

You are not authorized to view this page. Please contact your system administrator.

When I run this yourdomainname.com/#/service/v4_1/rest.php

@pgr that’s all it gives me. It would be wonderful I got where it was originally declared! It would make problem resolution so much easier! I tried to look for in the code wherever the class was declared. In most cases every time it’s declared its wrapped in an “if ! already declared” statement. I was trying to see if any files changed recently that called the class. I just struggle navigating around Github to find that answer.

You should try /legacy/service/v4_1/rest.php
It works for us on 8.7.1 instances

1 Like

True, it is showing me rest.php code

Ok then it’s working for you. It must be a “me” problem. Hmmm. I stumped!

Maybe check server root and RewriteBase

YES!!! This resolves!!!

So it has to be a rewrite issue. Weird 8.6 worked fine without the /legacy/ but 8.7 does not. Maybe a re-write .htaccess missing.

@pstevens I’m glad the problem is solved.

Anyway for future reference here is my advice to investigate the redeclaration errors: just before the line where you get the FATAL, add a bit of code using PHP reflection and ask PHP to tell you about it:

1 Like

Does anyone know how to redirect this properly. There are apps that depend on the URL (mautic). I’ve tried adding to .htaccess in the root and the /public/

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^service/v4_1/rest\.php$ /legacy/service/v4_1/rest.php [L,QSA]
</IfModule>

But it just doesn’t seem to work. Am I missing something?

That’s wrong.

I usually edit .htaccess file which located at: /public/legacy/


In Linux, web server root to:

root /var/www/Folder/SuiteCRM/public


You need to restart Apache2/Nginx.

1 Like

Thanks @rsp the server restart did the trick!

It is related to v4_1 API. Where do you guys create a custom file for data fetching code?

  1. Can API be use to modify/write data in the SuiteCRM?
  2. Can we use API to read data from another system and store in SuiteCRM? Can we automate task by setting up workflow or cron jobs?

Yes to all but you have to code it or use a third party like make.com or something. Almost anything is possible with API.

For instance I push all my form data in from WordPress and then that triggers and automated follow up campaign.

I’m also usining to build the WordPress portal. I don’t have to store any info inWP, just API and get it from SuiteCRM. Then case updates in the portal update SuiteCRM.