We have a website with php 8.1. It’s supposed to use exec to run highcharts-export-server to generate an svg file, but the file does not get generated:
$cmd = '/var/www/mysite/node/node_modules/lib/node_modules/highcharts-export-server/bin/cli.js --infile /tmp/node_files/nso_2024-07-10__12.50.00_77003733f89002aca7337718298f07df.json --outfile /tmp/node_files/nso_2024-07-10__12.50.00_77003733f89002aca7337718298f07df.svg';
exec($cmd, $out, $retval);
**When I run this command directly on the command line it works perfectly and the svg is created. **
$retval output:
retval: [1]
This is the output from $out:
out: [Array
(
[0] => __ ___ __ __ __
[1] => / / / (_)___ _/ /_ _____/ /_ ____ ______/ /______
[2] => / /_/ / / __ `/ __ / ___/ __ / __ `/ ___/ __/ ___/
[3] => / __ / / /_/ / / / / /__/ / / / /_/ / / / /_(__ )
[4] => /_/ /_/_/__, /_/ /_/___/_/ /_/__,_/_/ __/____/
[5] => ____//___/ __ _____
[6] => / ____/ ______ ____ _____/ /_ / ___/___ ______ _____ _____
[7] => / __/ | |/_/ __ / __ / ___/ __/ __ / _ / ___/ | / / _ / ___/
[8] => / /____> </ /_/ / /_/ / / / /_ ___/ / __/ / | |/ / __/ /
[9] => /_____/_/|_/ .___/____/_/ __/ /____/___/_/ |___/___/_/
[10] => /_/
[11] => v3.1.1
)
]
It doesn’t go any farther than that. When I run it from the command line, I get:
__ ___ __ __ __
/ / / (_)___ _/ /_ _____/ /_ ____ ______/ /______
/ /_/ / / __ `/ __ / ___/ __ / __ `/ ___/ __/ ___/
/ __ / / /_/ / / / / /__/ / / / /_/ / / / /_(__ )
/_/ /_/_/__, /_/ /_/___/_/ /_/__,_/_/ __/____/
____//___/ __ _____
/ ____/ ______ ____ _____/ /_ / ___/___ ______ _____ _____
/ __/ | |/_/ __ / __ / ___/ __/ __ / _ / ___/ | / / _ / ___/
/ /____> </ /_/ / /_/ / / / /_ ___/ / __/ / | |/ / __/ /
/_____/_/|_/ .___/____/_/ __/ /____/___/_/ |___/___/_/
/_/
v3.1.1
Wed Jul 10 2024 12:46:43 GMT-0400 [notice] - [cache] Dependency cache is up to date, proceeding.
Wed Jul 10 2024 12:46:43 GMT-0400 [verbose] - [cache] writing new manifest
Wed Jul 10 2024 12:46:43 GMT-0400 [notice] - [browser] attempting to get a browser instance (try 0)
Wed Jul 10 2024 12:46:43 GMT-0400 [notice] - [pool] Initializing pool: min 1, max 1.
Wed Jul 10 2024 12:46:43 GMT-0400 [verbose] - [pool] Attaching exit listeners to the process.
Wed Jul 10 2024 12:46:44 GMT-0400 [notice] - [pool] Successfully created a worker e4cb0f2c-6d16-4afa-a54c-62f841a17a47 - took 229 ms.
Wed Jul 10 2024 12:46:44 GMT-0400 [notice] - [pool] The pool is ready with 1 initial resources waiting.
Wed Jul 10 2024 12:46:44 GMT-0400 [verbose] - [chart] Starting exporting process.
Wed Jul 10 2024 12:46:44 GMT-0400 [verbose] - [chart] Attempting to export from an input file.
Wed Jul 10 2024 12:46:44 GMT-0400 [verbose] - [pool] Work received, starting to process.
Wed Jul 10 2024 12:46:44 GMT-0400 [verbose] - [pool] Acquiring worker
Wed Jul 10 2024 12:46:44 GMT-0400 [notice] - [browser] Could not clear page
Wed Jul 10 2024 12:46:44 GMT-0400 [verbose] - [pool] Releasing a worker of an id e4cb0f2c-6d16-4afa-a54c-62f841a17a47
Wed Jul 10 2024 12:46:44 GMT-0400 [verbose] - [pool] Acquired worker handle
Wed Jul 10 2024 12:46:44 GMT-0400 [verbose] - [pool] Starting work on pool entry e4cb0f2c-6d16-4afa-a54c-62f841a17a47.
Wed Jul 10 2024 12:46:44 GMT-0400 [verbose] - [export] Determining export path.
Wed Jul 10 2024 12:46:44 GMT-0400 [verbose] - [export] Treating as config.
Wed Jul 10 2024 12:46:44 GMT-0400 [verbose] - [pool] Work completed in 134 ms.
Wed Jul 10 2024 12:46:44 GMT-0400 [notice] - [pool] Killing all workers.
Wed Jul 10 2024 12:46:44 GMT-0400 [notice] - [pool] Destroying pool entry e4cb0f2c-6d16-4afa-a54c-62f841a17a47.
Wed Jul 10 2024 12:46:44 GMT-0400 [verbose] - [pool] Destroyed a worker of an id e4cb0f2c-6d16-4afa-a54c-62f841a17a47
Wed Jul 10 2024 12:46:44 GMT-0400 [notice] - [browser] Could not clear page
Wed Jul 10 2024 12:46:44 GMT-0400 [verbose] - [pool] Releasing a worker of an id e4cb0f2c-6d16-4afa-a54c-62f841a17a47
Wed Jul 10 2024 12:46:44 GMT-0400 [notice] - [pool] Killing all workers.
I suspected it might be a permissions issue, and I changed everything in the node folder to use www-data for the user and group, but I still get the output above. There are no php (nginx) errors. Because I don’t see any errors in the node output or on the php side, I’m not sure how to proceed. I’m also not sure what the retval of 1 indicates.