Background of the issue:
I am trying to address an issue with string translation files under WordPress 6.7.1 and PHP 8.3. I noticed lines like this in the error log: [Tue Nov 26 22:16:16.906964 2024] [proxy_fcgi:error] [pid 917641:tid 140596165412608] [client 4.227.36.112:0] AH01071: Got error 'PHP message: PHP Warning: is_dir(): open_basedir restriction in effect. File(/plugins) is not within the allowed path(s): (/home/admin/.composer:/home/admin/web/vud-design.com/public_html:/home/admin/web/vud-design.com/private:/home/admin/web/vud-design.com/public_shtml:/home/admin/tmp:/tmp:/var/www/html:/bin:/usr/bin:/usr/local/bin:/usr/share:/opt) in /home/admin/web/vud-design.com/public_html/wp-content/plugins/wpml-string-translation/classes/MO/LoadedMODictionary.php on line 103'. It seems that the function maybeAdjustPathToStandardLanguageFolders() is not looking for the right folder because WP_LANG_DIR is not defined. There is also a check which is probably outdated: // The WP RC version is `6.7-RC1` which is an improper format for comparison (we'd need `6.7.0-RC1`). if ( WordPress::versionCompare('>', '6.6.999') ) { $mofile = $this->maybeAdjustPathToStandardLanguageFolders($mofile, $domain); } The log entry disappears if I raise that WP version number.
Symptoms:
I am seeing a PHP warning related to open_basedir restriction and an issue with the function maybeAdjustPathToStandardLanguageFolders() not finding the correct folder due to WP_LANG_DIR not being defined.
Questions:
How can I resolve the open_basedir restriction warning?
Is there a way to correctly define WP_LANG_DIR to avoid this issue?
Looks like the issue may not be related to WPML but with some restriction in your server. I'll recommend checking with your hosting/service provider for more details.
Additionally, I'll recommend to try the following as well, to ensure if issue is being caused by another plugin or theme:
1) Take a full backup of your site and database before proceeding. It is highly advised to try these on a dev or staging site first, so your live site isn't compromised.
2) Deactivate all plugins except WPML and String Translation.
3) Switch to a standard theme like 2024 or 2021.
4) Check for the issue if it still happens.
5) Then start activating plugins one by one while keep checking for the issue. This way you 'll be able to pinpoint a conflict when & where it starts creating the problem.
6) If after activating all plugins you see that it still works fine, then switch to your theme and see if that's causing it.
Please let me know your findings and I'll try my best to help you further on the matter.
Hey, thank you for the standard answer i already read in this forum.
As i said.. in latest stable wpml string translation there is a check on wp version if WP version is higher than 6.6.999 that is apparently calling a function where WP_LANG_DIR constant (not defined in my environment) is used.
if ( WordPress::versionCompare( '>', '6.6.999' ) ) {
File is LoadedMODictionary.php line 63.
This is calling a method that is not considering the fact that WP_LANG_DIR is not defined so results empty and then the code looks for path /plugins which is from system root so not accessible by the php code, generating the warning.
So IT LOOKS LIKE a WPML string translation related problem. And i fixed it by editing that version number. Please fix in next release (the actual beta have no changes related to that, i checked).
I'm trying to reproduce the issue in a sandbox site but without any luck. Can you please tell me any steps or changes you did recently and which can be helpful in reproducing the issue? So I can then retry and escalate the issue accordingly.
The topic ‘[Closed] Warning opening string translation files under wp 6.7.1 / php 8.3’ is closed to new replies.