简体   繁体   中英

TYPO3 9.5: class not found with NGINX

We are currently encountering some trouble with our TYPO3 9.5 installation using NGINX .

In TYPO3 9.5 , some methods are now deprecated and some classes were moved to the Core . However, some extensions still instantiate those classes and it is supposed to work because there is some kind of mapping where the old classes just extend the new classes.

In our case, such a thing works when we run our installation with Apache . However, when we run it using NGINX , PHP blocking errors are raised. We just get things like

Error : Class OLD_CLASSNAME not found.

Our target environment uses Debian GNU/Linux 9 - PHP7.3 , but we also tried with a simple installation using Docker and a boilerplate from webdevops ( https://github.com/webdevops/TYPO3-docker-boilerplate ).

We compared our php.ini files between Apacahe and NGINX , but we did not find which parameter is the origin of our problem. In some cases, we made a workaround using TYPO3 XClasses , but in some cases it simply doesn't work.

We tried to add a file like typo3.conf and to play around with it without any success. Using the lowest level of error or disable error displaying did not work either.

We also tried to upgrade our installation to TYPO3 10.x , but the problem still occurs.

Has anyone encountered such a behaviour? Any help on this problem would be much appreciated.

Many thanks in advance.

Best regards,

SOLUTION AND CORRECTION

We just re-re-analyzed our problem (after a good night sleep) and we realized we were mistaken and our problem could not be related to Apache or NGINX . Our interpretation was wrong. So we re-checked our deployed packages in our various environments and spotted a difference in autloader files. In fact, the following lines were missing in vendor/composer/autoload_files.php and in vendor/composer/autoload_static.php :

'...' => __DIR__ . '/..' . '/helhum/console-autoload-include.php',
'...' => __DIR__ . '/..' . '/typo3/alias-loader-include.php',
'...' => __DIR__ . '/..' . '/typo3/autoload-include.php',

So, the problem is related to the autoload generation and not the environment.

Neither Apache nor Nginx execute PHP. but they provide an environment.
Information about this Environment can be found with the php function phpinfo() .
So get that output for both systems to see what differs.
Then you can try to unify the systems as you try to configure the Nginx like the Apache installation.

Keep in mind that TYPO3 has a list of classes for the autoloader either from Composer or manual.
If this is mixed up your classes can't be found well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM