Question

I currently 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 I have 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 write wrong code?

Was it helpful?

Solution

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

OTHER TIPS

.. 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

Why do you invoke a PHP file and 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 mysql_insert_id() returns the id 132.

This might be a problem because content.php132 might not be existant.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top