Upgrade Suitecrm 7.14.1 with Php 8.1

Hi Team ,

I was doing upgrade of suitecrm 7.13 to 7.14 with php 8.1, So, First I did same things in local. It’s working fine all page opening and I can do activities on my local. But when I do same things on Development server, I got an error " Fatal error : Access level to Sugar_Smarty::$_compile_id must be public (as in class Smarty) in /var/www/html/crm/include/Sugar_Smarty.php on line 54"

Any face this issues, please help me out. This is blocker for me.

Did you clear the smarty cache? A QR&R should do it.

That error persist when application loaded, So I cannot do it Repair & Rebuild. If any rebuild.sh file there. Please let me know.

I’ve actually wondered many times how to run Quick Repair and Rebuild from the command line.

There are two console languages you can use with SuiteCRM. There’s the legacy Robo, which I believe has a QR&R

And there’s the Symfony console which also has some SuiteCRM extensions there.

Don’t ask me for details, I don’t know them very well - but with this brief introduction I’m sure y’all can Google for it.

@pgr
So quick google returns this:

In an effort to stream line our process we added a command line utility to perform the Quick Repair and Rebuild for us.

Copy this code to /usr/bin/repair.php and give the file execute permission. When in your SugarCRM directory you can just run repair.php

The code is

#!/usr/bin/php
<?php

/*
 * Copyright 2013
 * Jeff Bickart
 * @bickart
 * jeff @ neposystems.com
 */

if(!defined('sugarEntry'))define('sugarEntry', true);

require_once('include/entryPoint.php');
require_once('modules/Administration/QuickRepairAndRebuild.php');

//Bug 27991 . Redirect to index.php if the request is not come from CLI.
$sapi_type = php_sapi_name();
if (substr($sapi_type, 0, 3) != 'cgi') {
    global $sugar_config;
  if(!empty($sugar_config['site_url'])){
		header("Location: ".$sugar_config['site_url'] . "/index.php");
	}else{
		sugar_die("Didn't find site url in your sugarcrm config file");
	}
}
//End of #27991

if(empty($current_language)) {
	$current_language = $sugar_config['default_language'];
}

$app_list_strings = return_app_list_strings_language($current_language);
$app_strings = return_application_language($current_language);

global $current_user;
$current_user = new User();
$current_user->getSystemUser();

$GLOBALS['log']->debug('--------------------------------------------> at repair.php <--------------------------------------------');
$repair = new RepairAndClear();
$repair->repairAndClearAll(array('clearAll'),array(translate('LBL_ALL_MODULES')), true,false);

$exit_on_cleanup = true;

sugar_cleanup(false);

// some jobs have annoying habit of calling sugar_cleanup(), and it can be called only once
// but job results can be written to DB after job is finished, so we have to disconnect here again
// just in case we couldn't call cleanup
if(class_exists('DBManagerFactory')) {
	$db = DBManagerFactory::getInstance();
	$db->disconnect();
}

if($exit_on_cleanup) exit;

I’m just not sure why they tell you to put the script in /usr/bin but sure.

That code can’t work from /usr/bin, the requires are based from the SuiteCRM root directory (or public/legacy if it’s v8).

But why use something from the 2013 Internet (before the birth of SuiteCRM) when there are console commands to do it? These are already deployed in your installation.

I just tried this from my v8 project root

$ vendor/bin/robo list

but it blows with all sorts of errors.

Then I changed into public/legacy and tried

$ ../../vendor/bin/robo list

and it did output something, but also failed with an error, probably related to the PHP 8.2 I’m running…

These options appear promising:

1 Like

@pgr I believe we have a mismatch

I installed directly 8.x and I don’t have “robo”

[root@dev-web sales]# ls -l vendor/bin/
total 40
-rw-r--r--. 1 apache apache 3333 Oct  4 15:41 carbon
-rw-r--r--. 1 apache apache 3336 Oct  4 15:41 doctrine
-rw-r--r--. 1 apache apache 3354 Oct  4 15:41 doctrine-dbal
-rw-r--r--. 1 apache apache 3390 Oct  4 15:41 doctrine-migrations
-rw-r--r--. 1 apache apache 3396 Oct  4 15:41 generate-defuse-key
-rw-r--r--. 1 apache apache 3438 Oct  4 15:41 patch-type-declarations
-rw-r--r--. 1 apache apache 3381 Oct  4 15:41 sql-formatter
-rw-r--r--. 1 apache apache 3390 Oct  4 15:41 validate-json
-rw-r--r--. 1 apache apache 3405 Oct  4 15:41 var-dump-server
-rw-r--r--. 1 apache apache 3369 Oct  4 15:41 yaml-lint

Are you on 7.x?

edit: ran find found no robo on the whole server
edit2: this topic is about SuiteCRM 7.14 I was hoping the command line repair was major agnostic as the admin option is there for both :smiley:

I have it in both v7 and v8.

Where did you get your vendor directory from? Is it from the installation package, or did you run composer to install stuff?

EDIT: any way it should really be there

1 Like

I do my installation manually.

Just confirmed the ZIP up for download on SuiteCRM website does not have the same contents.

You can download it and see for yourself but my check:

[rmendes@admin ~]$ curl -OL https://suitecrm.com/download/142/suite84/563421/suitecrm-8-4-1.zip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    14    0    14    0     0     14      0 --:--:-- --:--:-- --:--:--    14
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
100 78.9M  100 78.9M    0     0  15.6M      0  0:00:05  0:00:05 --:--:-- 23.7M
[rmendes@admin ~]$ unzip suitecrm-8-4-1.zip -d suitecrm-8.4.1/
Archive:  suitecrm-8-4-1.zip
  inflating: suitecrm-8.4.1/.editorconfig  
  inflating: suitecrm-8.4.1/.env     
  inflating: suitecrm-8.4.1/.eslintrc.js  
  inflating: suitecrm-8.4.1/LICENSE.txt  
  inflating: suitecrm-8.4.1/README.md  
 extracting: suitecrm-8.4.1/VERSION  
  inflating: suitecrm-8.4.1/angular.json  
(...)
  inflating: suitecrm-8.4.1/vendor/zf1/zend-locale/library/Zend/Locale/Math/Exception.php  
  inflating: suitecrm-8.4.1/vendor/zf1/zend-locale/library/Zend/Locale/Math/PhpMath.php  
   creating: suitecrm-8.4.1/vendor/bin/
  inflating: suitecrm-8.4.1/vendor/bin/var-dump-server  
  inflating: suitecrm-8.4.1/vendor/bin/patch-type-declarations  
  inflating: suitecrm-8.4.1/vendor/bin/yaml-lint  
  inflating: suitecrm-8.4.1/vendor/bin/validate-json  
  inflating: suitecrm-8.4.1/vendor/bin/sql-formatter  
  inflating: suitecrm-8.4.1/vendor/bin/doctrine-dbal  
  inflating: suitecrm-8.4.1/vendor/bin/doctrine-migrations  
  inflating: suitecrm-8.4.1/vendor/bin/doctrine  
  inflating: suitecrm-8.4.1/vendor/bin/generate-defuse-key  
  inflating: suitecrm-8.4.1/vendor/bin/carbon  
  inflating: suitecrm-8.4.1/vendor/autoload.php  
   creating: suitecrm-8.4.1/cache/
   creating: suitecrm-8.4.1/cache/prod/
[rmendes@admin ~]$ ls -la suitecrm-8.4.1/vendor/bin/
total 48
drwxrwxr-x.  2 rmendes rmendes 4096 Oct  2 13:39 .
drwxrwxr-x. 58 rmendes rmendes 4096 Oct  2 13:39 ..
-rwxrwxr-x.  1 rmendes rmendes 3333 Oct  2 13:21 carbon
-rwxrwxr-x.  1 rmendes rmendes 3336 Oct  2 13:21 doctrine
-rwxrwxr-x.  1 rmendes rmendes 3354 Oct  2 13:21 doctrine-dbal
-rwxrwxr-x.  1 rmendes rmendes 3390 Oct  2 13:21 doctrine-migrations
-rwxrwxr-x.  1 rmendes rmendes 3396 Oct  2 13:21 generate-defuse-key
-rwxrwxr-x.  1 rmendes rmendes 3438 Oct  2 13:21 patch-type-declarations
-rwxrwxr-x.  1 rmendes rmendes 3381 Oct  2 13:21 sql-formatter
-rwxrwxr-x.  1 rmendes rmendes 3390 Oct  2 13:21 validate-json
-rwxrwxr-x.  1 rmendes rmendes 3405 Oct  2 13:21 var-dump-server
-rwxrwxr-x.  1 rmendes rmendes 3369 Oct  2 13:21 yaml-lint

The vendor/bin is actually one of the last things to be decompressed just noticed during copy.

EDIT:
As described in SuiteCRM install not seeing references to composer there.

Also I was looking into some docs regarding updating, older seem to mention robo

Newer reference console

I just remembered, there are two sections in the composer.json, one for the standard installation, one for the “dev” installation.

The packages on the downloads site are built with

composer install --no-dev

If you simply run

composer install

then Robo will get installed.

I think the plan is to slowly move all Robo commands to Symfony console, but it’s not there yet.

@pgr ok that’s nice to understand why the different contents on packages for the same version.

So that actually gave me an idea … figuring the console command also provides helpers

[root@develop-web sales]# runuser -uapache -- bin/console list
PHP Deprecated:  Return type of Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/develop/public_html/sales/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php on line 134
PHP Deprecated:  Return type of Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/develop/public_html/sales/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php on line 144
PHP Deprecated:  Return type of Symfony\Component\HttpFoundation\Session\Session::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/develop/public_html/sales/vendor/symfony/http-foundation/Session/Session.php on line 131
PHP Deprecated:  Return type of Symfony\Component\HttpFoundation\Session\Session::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/develop/public_html/sales/vendor/symfony/http-foundation/Session/Session.php on line 141
Symfony 5.2.14 (env: prod, debug: false)

Usage:
  command [options] [arguments]

Options:
  -h, --help            Display help for the given command. When no command is given display help for the list command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -e, --env=ENV         The Environment name. [default: "prod"]
      --no-debug        Switch off debug mode.
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  about                                      Display information about the current project
  help                                       Display help for a command
  list                                       List commands
 api
  api:graphql:export                         Export the GraphQL schema in Schema Definition Language (SDL)
  api:json-schema:generate                   Generates the JSON Schema for a resource operation.
  api:openapi:export                         Dump the Open API documentation
  api:swagger:export                         Dump the Swagger v2 documentation
  api:upgrade-resource                       The "api:upgrade-resource" command upgrades your API Platform metadata from versions below 2.6 to the new metadata from versions above 2.7.
Once you executed this script, make sure that the "metadata_backward_compatibility_layer" flag is set to "false" in the API Platform configuration.
This will remove "ApiPlatform\Core\Annotation\ApiResource" annotation/attribute and use the "ApiPlatform\Metadata\ApiResource" attribute instead.
 app
  app:version:bump                           Manually bump the application version
  app:version:list-providers                 List all registered version providers
  app:version:status                         Show current application version status
 assets
  assets:install                             Install bundle's web assets under a public directory
 cache
  cache:clear                                Clear the cache
  cache:pool:clear                           Clear cache pools
  cache:pool:delete                          Delete an item from a cache pool
  cache:pool:list                            List available cache pools
  cache:pool:prune                           Prune cache pools
  cache:warmup                               Warm up an empty cache
 config
  config:dump-reference                      Dump the default configuration for an extension
 dbal
  dbal:run-sql                               Executes arbitrary SQL directly from the command line.
 debug
  debug:autowiring                           List classes/interfaces you can use for autowiring
  debug:config                               Dump the current configuration for an extension
  debug:container                            Display current services for an application
  debug:event-dispatcher                     Display configured listeners for an application
  debug:router                               Display current routes for an application
  debug:translation                          Display translation messages information
  debug:twig                                 Show a list of twig functions, filters, globals and tests
  debug:validator                            Display validation constraints for classes
 doctrine
  doctrine:cache:clear-collection-region     Clear a second-level cache collection region
  doctrine:cache:clear-entity-region         Clear a second-level cache entity region
  doctrine:cache:clear-metadata              Clears all metadata cache for an entity manager
  doctrine:cache:clear-query                 Clears all query cache for an entity manager
  doctrine:cache:clear-query-region          Clear a second-level cache query region
  doctrine:cache:clear-result                Clears result cache for an entity manager
  doctrine:database:create                   Creates the configured database
  doctrine:database:drop                     Drops the configured database
  doctrine:database:import                   Import SQL file(s) directly to Database.
  doctrine:ensure-production-settings        Verify that Doctrine is properly configured for a production environment
  doctrine:mapping:convert                   [orm:convert:mapping] Convert mapping information between supported formats
  doctrine:mapping:import                    Imports mapping information from an existing database
  doctrine:mapping:info                      
  doctrine:migrations:current                [current] Outputs the current version
  doctrine:migrations:diff                   [diff] Generate a migration by comparing your current database to your mapping information.
  doctrine:migrations:dump-schema            [dump-schema] Dump the schema for your database to a migration.
  doctrine:migrations:execute                [execute] Execute one or more migration versions up or down manually.
  doctrine:migrations:generate               [generate] Generate a blank migration class.
  doctrine:migrations:latest                 [latest] Outputs the latest version
  doctrine:migrations:list                   [list-migrations] Display a list of all available migrations and their status.
  doctrine:migrations:migrate                [migrate] Execute a migration to a specified version or the latest available version.
  doctrine:migrations:rollup                 [rollup] Rollup migrations by deleting all tracked versions and insert the one version that exists.
  doctrine:migrations:status                 [status] View the status of a set of migrations.
  doctrine:migrations:sync-metadata-storage  [sync-metadata-storage] Ensures that the metadata storage is at the latest version.
  doctrine:migrations:up-to-date             [up-to-date] Tells you if your schema is up-to-date.
  doctrine:migrations:version                [version] Manually add and delete migration versions from the version table.
  doctrine:query:dql                         Executes arbitrary DQL directly from the command line
  doctrine:query:sql                         Executes arbitrary SQL directly from the command line.
  doctrine:schema:create                     Executes (or dumps) the SQL needed to generate the database schema
  doctrine:schema:drop                       Executes (or dumps) the SQL needed to drop the current database schema
  doctrine:schema:update                     Executes (or dumps) the SQL needed to update the database schema to match the current mapping metadata
  doctrine:schema:validate                   Validate the mapping files
 lint
  lint:container                             Ensure that arguments injected into services match type declarations
  lint:twig                                  Lint a template and outputs encountered errors
  lint:xliff                                 Lint an XLIFF file and outputs encountered errors
  lint:yaml                                  Lint a file and outputs encountered errors
 router
  router:match                               Help debug routes by simulating a path info match
 scrm
  scrm:copy-legacy-assets                    Copy legacy assets
  scrm:extension-asset-install               
 secrets
  secrets:decrypt-to-local                   Decrypt all secrets and stores them in the local vault
  secrets:encrypt-from-local                 Encrypt all local secrets to the vault
  secrets:generate-keys                      Generate new encryption keys
  secrets:list                               List all secrets
  secrets:remove                             Remove a secret from the vault
  secrets:set                                Set a secret in the vault
 security
  security:encode-password                   Encode a password
 suitecrm
  suitecrm:app:install                       Install the application
  suitecrm:app:setup-legacy-migration        Setup for migrating from a SuiteCRM 7.12.x instance
  suitecrm:app:upgrade                       Upgrade the application
  suitecrm:app:upgrade-finalize              Finalize the application upgrade
 translation
  translation:update                         Update the translation file

So we get 4 deprecations and no repair command (as of yet ofc). But seems it has plenty capabilities already.