file_get_contents(lang/english.xml): failed to open stream

Hi all,We are trying to upgrade a program from phpmaker 10 to version 2021. The server is ubuntu 18.04. We have upgraded it from php 7.2 to php 7.4.11 and from mysql 5.7 to mysql 8. When we tried to open the page web page, there is an error:
{“statusCode”:0,“error”:{“class”:“text-danger”,“type”:“Error”,“description”:“ServerError”}}We checked the php logs, it said:
PHP Warning: file_get_contents(lang/english.xml): failed to open stream: No such file or directory in /var/www/src/Language.php on line 56Then we tried to set RewriteBase to /
it had the same error.Any ideas are welcome. Thanks.

Make sure you have set up URL Rewrite, see https://discourse.hkvstore.com/t/migrating-to-v2022/655/1 (the last post).

URL Rewrite was set up. We checked phpinfo(), search for ‘mod_rewrite’, We can see it as ‘Loaded Modules’.

No such file or directory in /var/www/src/Language.php on line 56

Double check this generated file: “lang/english.xml” (it is located in the generated “lang” sub folder). Make sure the file exists.

“lang/english.xml” does exist.

What is the code in line 56 of “/var/www/src/Language.php” file? Please copy it in here for more discussion.

skymark wrote:

Then we tried to set RewriteBase to /

Make sure it is correct. If your web application is with a base path, e.g. //yoursite/basepath/, then you may need to set the RewriteBase to /basepath/.

Our site doesn’t have a base path.

The code in line 56 of “/var/www/src/Language.php” file:

    $ar = Xml2Array(substr(file_get_contents($file), 0, 512)); // Just read the first part

The code in line 56 of “/var/www/src/Language.php” file:


  1. If the Language.php is at /var/www/src/Language.php, then the english.xml should be at /var/www/lang/english.xml, you may check your server and make sure the file is correctly uploaded.
  2. Make sure you have /var/www/src/.htaccess and the .htaccess is generated by PHPMaker.
  3. Make sure you always run your site at //mysite/, do not try to run any other .php file directly (e.g. //mysite/xxx/xxx.php).

Thanks. We followed your 3 points.Here are some more errors from php logs:PHP Warning: Use of undefined constant DATATYPE_NUMBER - assumed ‘DATATYPE_NUMBER’ (this will throw an Error in a future version of PHP) in /var/www/src/config.php on line 276
PHP Warning: Use of undefined constant DATATYPE_DATE - assumed ‘DATATYPE_DATE’ (this will throw an Error in a future version of PHP) in /var/www/src/config.php on line 276
PHP Warning: Use of undefined constant DATATYPE_STRING - assumed ‘DATATYPE_STRING’ (this will throw an Error in a future version of PHP) in /var/www/src/config.php on line 276
PHP Warning: Use of undefined constant DATATYPE_BOOLEAN - assumed ‘DATATYPE_BOOLEAN’ (this will throw an Error in a future version of PHP) in /var/www/src/config.php on line 276
PHP Warning: Use of undefined constant DATATYPE_TIME - assumed ‘DATATYPE_TIME’ (this will throw an Error in a future version of PHP) in /var/www/src/config.php on line 276
PHP Warning: Use of undefined constant SESSION_STATUS - assumed ‘SESSION_STATUS’ (this will throw an Error in a future version of PHP) in /var/www/src/config.php on line 390
PHP Warning: file_get_contents(lang/english.xml): failed to open stream: No such file or directory in /var/www/src/Language.php on line 56
PHP Warning: file_get_contents(lang/english.xml): failed to open stream: No such file or directory in /var/www/src/Language.php on line 78
PHP Warning: file_get_contents(locale/en.json): failed to open stream: No such file or directory in /var/www/src/phpfn.php on line 5937
PHP Notice: Trying to access array offset on value of type null in /var/www/src/phpfn.php on line 5938
PHP Warning: file_get_contents(lang/english.xml): failed to open stream: No such file or directory in /var/www/src/Language.php on line 56
PHP Warning: file_get_contents(lang/english.xml): failed to open stream: No such file or directory in /var/www/src/Language.php on line 78
PHP Warning: file_get_contents(locale/en.json): failed to open stream: No such file or directory in /var/www/src/phpfn.php on line 5937
PHP Notice: Trying to access array offset on value of type null in /var/www/src/phpfn.php on line 5938

Are you sure you have generated and uploaded all files? The constants are defined in src\constants.php.

We have fixed that issue. Now when we go to our_ip/login, there is a loading icon and then it shows a blank page. If we view page source, we can see something like:

Sign in to start your session

Please enter username
But the page is blank.If we remove this part from layout.php like this: /* loadjs.ready(ew.bundleIds, function() { if (!loadjs.isDefined("foot")) loadjs.done("foot"); }); */then we can see the page with a loading icon. What do we need to do for this?Any ideas? Thanks.

You may press F12 in Chrome, and go to the Console panel to check for JavaScript errors.You probably have errors in the global client side Client Script or Startup Script, you may check your code in them, do not mix server side PHP code in those events.

It works. Thanks.