0

I am getting this error when running cron.php on a Magento 1.9 site that I recently migrated to a new server. Everything was working correctly on the old one, now I get the error below:

Call to undefined function simplexml_load_file() in var/www/app/Mage.php:767

Line 767 on that file is as follows:

$localConfig = simplexml_load_file($localConfigFile);

I used function_exists('simplexml_load_file') right above that line and that came out true. I also checked that I have have all the required libraries in place. I also tried to run the cron.php file using a terminal (I am on a Plesk server) and it worked just fine.

Current environment:

  • Plesk 18.0.64 on AlmaLinux 8.10
  • PHP 7.1.33
  • Apache + nginx

The setup is the same as the old server, I just migrated to a more powerful machine.

Anyone with an idea of what is going on here? What am missing?

2
  • I have the same issue. All needed functions are installed and when I execute the command manually, everything works as expected. When the script is executed by the cronjob I get the same error in my logs like @swiss_blade. Commented Oct 31, 2024 at 1:28
  • Tried cron.sh? (btw ... I'd highly recommend to update php to at least 7.4 and head over to OpenMage) Commented Dec 18, 2024 at 5:46

1 Answer 1

0

Make sure the cron command is running the same version of PHP that you use on the command line. Usually with the servers that support multiple versions of PHP by configuration, the php command is loaded dynamically when the console starts, but that not happens on the cron command.

Check the path to the PHP binary you are using on the CLI whereis php and use that to call the cron entry (something like /opt/php/bin/php71-cli or similar).

On the docs says:

A function name may exist even if the function itself is unusable due to configuration or compiling options (with the image functions being an example).

Can it be that the function is disabled within the with the disable_functions ini directive also.

4
  • Yes, the versions are the same. I also tried giving the full path to the PHP executable, just in case, but no luck... Commented Oct 7, 2024 at 20:28
  • are you invoking cron.php directly on the cron entry or using cron.sh script? Commented Oct 8, 2024 at 13:34
  • I tried both, but both exhibit the same behavior... Commented Oct 8, 2024 at 19:29
  • @swiss_blade check my edited response Commented Oct 15, 2024 at 19:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.