Question

PHP script odd behaviour after server upgrade

Recently installed a completely new server on AWS with the help of one of the great guides available here, a Ubuntu 20.04 server with LAMP-stack and installed Wordpress, Woocommerce. Purpose is to replace existing server (also on AWS) which is today running on ubuntu 16.04, mysql 5.7.23, php 7.0.31.

After installation and setup we pulled our repo with some serverside PHP scripts that we run daily on the old server. These script updates values for products in the database, and one explicit script which updates stock quantity are not running as expected, resulting in wrong/random values in database. In short, the script reads two txt-files with SKU and Quantity, puts these values into array and loads into temporary mysql table before updating into table with product data.

Since the script works as expected on the old server but not completely on the new, we’ve investigated any changes between the versions of php,mysql,ubuntu that could have changed the behavior, but have so far came up empty. Version changes: Ubuntu 16.04.6 -> 20.04.3 PHP 7.0.31 -> 7.4.3 Mysql 5.7.23 -> 8.0.28

I’m at a loss as where to continue troubleshoot since I’m not very good at PHP and the original developer is nowhere to be contacted.

Grateful for any input

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

There are a couple of things that I could suggest:

  • Enable error logging and check the logs for any warnings or errors
  • Cross-check the PHP values such as memory limit and etc., to do so you can run: php -i on both servers and verify that the values on the new one are the same as the old one
  • Check the PHP modules, it is possible that there is a missing module causing the issue, you can check your PHP modules with php -m
  • If possible, enable debug mode for your application so that you could get more information when running the command

In case you see any errors, feel free to share the output here after removing any sensitive information.

Best,

Bobby