We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,498 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

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

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.

3
Contributors
2
Replies
14 Hours
Discussion Span
1 Year Ago
Last Updated
3
Views
xilix
Newbie Poster
1 post since Feb 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

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

bye.

cereal
Veteran Poster
1,146 posts since Aug 2007
Reputation Points: 344
Solved Threads: 223
Skill Endorsements: 22

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

pritaeas
Posting Prodigy
Moderator
9,316 posts since Jul 2006
Reputation Points: 1,178
Solved Threads: 1,467
Skill Endorsements: 86

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0782 seconds using 3.04MB