1,105,226 Community Members

Need to launch a daemon on a server with a JQuery Ajax call (LINUX PHP5)

Member Avatar
xilix
Newbie Poster
1 post since Feb 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I am trying to start a daemon on a server with Ajax PHP and JQuery. The following code executes without any errors an opens all the html files in separate browser windows like it's supposed to. I receive the alert message . However, the daemon never starts. Can anyone see what is wrong with the code?

Server side php file:

filename: executedp.php

<?php
$startDaemon = exec('sh ~/.devilspie/ruleset.sh $x; done');
?>

Client side JQuery Code:

if(found) {
                        //call to start daemon
			var xhr = $.ajax({ 
			url: 'executedp.php',
 			success: alert("It has begun!")  
			}); 
		
			switch($.tableCount) {
			
			case ($.tableCount = 1):
			window.open('table1.html');
			xhr;
			break;			
			
			case ($.tableCount = 2):
			window.open('table1.html');
			window.open('table2.html');
			xhr;
			break;
			
			case ($.tableCount = 3):
			window.open('table1.html');
			window.open('table2.html');
			window.open('table3.html');
			xhr;
			break;

			case ($.tableCount = 4):
			window.open('table1.html');
			window.open('table2.html');
			window.open('table3.html');
			window.open('table4.html');
			xhr;
			break;
			}
            }

I have researched for hours and to high heaven for a resolution. Any suggestions greatly appreciated.

Member Avatar
cereal
Posting Virtuoso
1,710 posts since Aug 2007
Reputation Points: 461 [?]
Q&As Helped to Solve: 345 [?]
Skill Endorsements: 44 [?]
 
0
 

Search for PHP fork examples and read here: http://php.net/manual/en/function.pcntl-fork.php

bye.

Member Avatar
pritaeas
mod_pritaeas
11,286 posts since Jul 2006
Reputation Points: 1,420 [?]
Q&As Helped to Solve: 1,831 [?]
Skill Endorsements: 154 [?]
Moderator
Featured
Sponsor
 
0
 

Are you sure that the web user (which runs PHP) has rights to start an external application ?

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: