I have the following PHP script that isolates my issue:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$code = 0;
$output = array();
exec('"../vendor/bin/PdfGenie" code.rq', $output, $code);
echo $code . "\n";
print_r($output);
The PdfGenie
executable is reading the contents of code.rq
and tries to create a pdf document in the same directory.
When I run the code in my browser, I get this:
11
Array
(
)
And it doesn't create the file.
However if I ssh into the server and execute php tst.php
(with or without root) I get:
0
Array
(
)
And the output file is written just fine. Additionally if I execute the same command ("../vendor/bin/PdfGenie" code.rq
) directly from ssh, that works too.
I suspected that, maybe apache is running the PHP script with a different user, and have tried all the options on this page to get the user that it could be, but they all gave me the same user that I was sshing in with and it worked just fine on.
What's different (or how can I figure out what's different) about when apache executes my PHP script, that's causing this error code 11?