views:

44

answers:

3

Atmoment i use this code:

if(isset($_POST['url']) && isset($_POST['trefwoorden']) )
{
  mysql_connect('localhost', 'crawler', 'whathasbeenseencannotbeunseen');
  mysql_select_db("crawler");
  mysql_query("INSERT INTO jobs (jobID, url, trefwoorden) VALUES ('', '".$_POST['url']."', '".$_POST['trefwoorden']."')");
  $output = shell_exec("./content.php " .mysql_insert_id());
  echo $output;

}

In my content.php the following code:

#!/usr/bin/php
<?php
echo 'HET WERKT';
?>

Now i want to see if my shell_exec actually works by filling in the form and submitting it... but it doesn't echo anything at all. Did i wrote some wrong code?

A: 

.. Maybe this will work for you:

shell_exec('php -l content.php'. mysql_insert_id())

Or;

  1. PHP is running in safe_mode
  2. Apache does not have the permissions to execute the script
Bas van Dorst
Doesn't give my echo back, returns: no errors detected in content.php
Jordy
A: 

Hello,

Try this. This may help you.

shell_exec('usr/local/bin/php -l content.php'. mysql_insert_id())

or

shell_exec('usr/local/bin/php -content.php'. mysql_insert_id())

All the best.

Thanks,

Kanji

Kanji
Also not working for me, got some random tests working but my actual code won't start.Will reply if any of your code work :)!
Jordy
Hello,Try the new code i have mention in my answer.
Kanji
A: 

Why do you invoke a php file?

Why not including it?

Besides, i agree with Chouchenos because this line of code:

shell_exec('php -l content.php'. mysql_insert_id())

will execute like this "php -l content.php132" if myslq_insert_id() returns the id 132. this might be a problem because content.php132 might not be existant.

ITroubs
Because i need to get a process on the background to speed up my process of crawling webpage.
Jordy
hmm try this mysql_query("INSERT INTO jobs (jobID, url, trefwoorden,used) VALUES ('', '".$_POST['url']."', '".$_POST['trefwoorden']."',0)"); and add a line in that takes the lowes jobID that is not used to the content.php and lat it work on that job.
ITroubs