I use the exec command as shown below in PHP:
exec
exec("/usr/bin/php /path/to/Notification.php >> /path/to/log_file.log 2>&1 &");
In my local environment (MAMP), I know the installation path for PHP, so I can replace /usr/bin/php with /Applications/MAMP/bin/php/php5.4.10/bin/php . But I do not know where the PHP installation (PHP binary) is located on the production server.
/usr/bin/php
/Applications/MAMP/bin/php/php5.4.10/bin/php
Usually /usr/bin/php , but you can try to capture and whereis php output of the command " whereis php " or " which php' ".
whereis php
which php'
Or better yet, use the PHP_BINARY constant, if available. Take a look here .
PHP_BINARY
In most cases, the job execution should be performed by a PHP_BINARY predefined constant .
If you need something more advanced, you can use the Symfony component of the process using the PhpExecutableFinder class:
// composer require symfony/process use Symfony\Component\Process\PhpExecutableFinder; (new PhpExecutableFinder)->find();
Source: https://habr.com/ru/post/1500912/More articles:Access data from a view model - requirejsjBOSS + ESAPI java.lang.ClassCastException: org.jboss.logmanager.log4j.BridgeLogger could not be passed to org.owasp.esapi.Logger - javaExecute javascript function on page sent using AJAX response - javascriptJQuery Autocomplete works in Chrome, but not in android, using telephone interchange - javascriptAlternatives to SQL Agent for Azure SQL Database - sqlLaTeX math in citations BibTeX not working with pandoc - pdfSync Sqlite Database with iCloud? - iosResolution of manifest and abstract type - compiler-constructionWhy does the GET method replicate the first answer one by one? - getBoolean Qt serialization with QDataStream - c ++All Articles