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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.