I got some PHP application on Heroku. While I enable PHP, I also run this command, which I've found somewhere at Stackoverflow:
heroku config:add LD_LIBRARY_PATH=/app/php/ext:/app/apache/lib
Setting config vars and restarting zfq... done, v7
LD_LIBRARY_PATH: /app/php/ext:/app/apache/lib
This command from command line works fine:
heroku run ./php/bin/php -v
Running `./php/bin/php -v` attached to terminal... up, run.3208
PHP 5.3.10 (cli) (built: Mar 26 2012 08:15:52)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
But this code:
$nickname = $_POST['nickname'];
$filename = "1.txt";
$cmd = './php/bin/php -v > "' . $filename . '" 2>&1 &';
exec($cmd, $output);
$contents = file_get_contents($filename);
unlink($filename);
exit_ajax($contents);
returns sh: ./php/bin/php: not found
If i change ./php/bin/php to ~/php/bin/php - it returns false
To ./php - returns sh: ./php: not found