PHP Classes

First of all, there's no documentation/instructions/example! ...

Recommend this page to a friend!

      PHP Background Process  >  All threads  >  First of all, there's no...  >  (Un) Subscribe thread alerts  
Subject:First of all, there's no...
Summary:Package rating comment
Messages:3
Author:Alekos Psimikakis
Date:2017-10-27 16:48:32
 

Alekos Psimikakis rated this package as follows:

Utility: Bad
Consistency: Bad

  1. First of all, there's no...   Reply   Report abuse  
Picture of Alekos Psimikakis Alekos Psimikakis - 2017-10-27 16:48:32
First of all, there's no documentation/instructions/example! How do you expect from someone to run this stuff?

Anyway, since the class sounded interesting, I tried to run it anyway ...

I immediately got the following errors:
1) Notice: Undefined variable: php_path in background_process.php on line 193
b) Notice: Undefined variable: path in background_process.php on line 193
Of course, since neither of these variables have been defined

I then implemented the '$cmd' variable manually and got the following error from the browser:
"Loading failed for the <script> with source “http://localhost/work/jquery-1.11.1.min.js”." Of course, since 'jquery-1.11.1.min.js' was not located in localhost! OK, I fixed this too, using the JS from https://code.jquery.com.

Then I got the following weird error from Windows system: "Windows cannot find 'wmic' ... !!
I never receive such Windows system errors! I was even afraid that this code might do some harm to the system!




  2. Re: First of all, there's no...   Reply   Report abuse  
Picture of Joshy Francis Joshy Francis - 2017-10-30 06:49:55 - In reply to message 1 from Alekos Psimikakis
Example, Procedural style.

$cmd='';
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {//'This is a server using Windows!';
$cmd= $php_path.'\php.exe '.$path.'\long_process.php' ;
}else{
$cmd='/usr/bin/php -f /var/www/example.com/public/long_process.php';
}
$pid=run_process($cmd);
if(is_process_running($pid)){
echo 'Process running';
stop_process($pid);
}else{
echo 'Process not running';
}

  3. Re: First of all, there's no...   Reply   Report abuse  
Picture of Joshy Francis Joshy Francis - 2017-10-30 07:38:41 - In reply to message 2 from Joshy Francis
Sorry for the trouble and confusion made by me.You have to provide the php path with the command. WMI error caused because it lacked the php path in windows. WMI is used to get the process id in windows. Please try again. I have successfully used this class to send emails in background. worked both in Windows and Linux.