简体   繁体   English

TYPO3 9.5:在 NGINX 中找不到 class

[英]TYPO3 9.5: class not found with NGINX

We are currently encountering some trouble with our TYPO3 9.5 installation using NGINX .我们目前在使用NGINX安装TYPO3 9.5时遇到了一些问题。

In TYPO3 9.5 , some methods are now deprecated and some classes were moved to the Core .TYPO3 9.5中,一些方法现已弃用,一些类已移至核心 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 .在我们的例子中,当我们使用Apache运行我们的安装时,这样的事情是有效的。 However, when we run it using NGINX , PHP blocking errors are raised.但是,当我们使用NGINX运行它时,会引发PHP阻塞错误。 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 ). 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.我们比较了ApacaheNGINX之间的php.ini文件,但我们没有发现哪个参数是问题的根源。 In some cases, we made a workaround using TYPO3 XClasses , but in some cases it simply doesn't work.在某些情况下,我们使用TYPO3 XClasses进行了解决,但在某些情况下它根本不起作用。

We tried to add a file like typo3.conf and to play around with it without any success.我们尝试添加一个像typo3.conf这样的文件并尝试使用它,但没有成功。 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.我们还尝试将我们的安装升级到TYPO3 10.x ,但问题仍然存在。

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 .我们只是重新分析了我们的问题(在睡个好觉之后),我们意识到我们错了,我们的问题与ApacheNGINX 无关 Our interpretation was wrong.我们的解释是错误的。 So we re-checked our deployed packages in our various environments and spotted a difference in autloader files.因此,我们重新检查了我们在各种环境中部署的包,并发现了 autloader 文件中的差异。 In fact, the following lines were missing in vendor/composer/autoload_files.php and in vendor/composer/autoload_static.php :实际上,在vendor/composer/autoload_files.phpvendor/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. Apache 和 Nginx 都不执行 PHP。 but they provide an environment.但他们提供了一个环境。
Information about this Environment can be found with the php function phpinfo() .可以通过 php function phpinfo()找到有关此环境的信息。
So get that output for both systems to see what differs.因此,为两个系统获取 output 看看有什么不同。
Then you can try to unify the systems as you try to configure the Nginx like the Apache installation.然后,您可以在尝试配置 Nginx 时尝试统一系统,如 Apache 安装。

Keep in mind that TYPO3 has a list of classes for the autoloader either from Composer or manual.请记住,TYPO3 有一个来自Composer或手册的autoloader类列表。
If this is mixed up your classes can't be found well.如果这混在一起,你的课程就找不到了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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