I am trying to pass variables from php to bash and im not sure how to get this to work. this is what i am trying:
PHP:
Code:
<?php
echo '<pre>';
$var1="hello";
$var2="joe";
putenv("VAR1=$var1");
$last_line = system('/home/www/public_html/domain.com/script/ls $var1 $var2', $retval);
echo '
</pre>
<hr />Last line of the output: ' . $last_line . '
<hr />Return value: ' . $retval;
?>
BASH:
Code:
#!/bin/bash
ls
sudo mkdir test
sudo chown -R www-data:www-data /home/www/public_html/domain.com/script/test
echo -e "var1: $1, var2: $1"
but nothing seems to get passed to bash. I want to be able to do this to create new folders, give ownership and permission changes to those folders, and later create new virtualhosts with a php interface.
Cheers
Bookmarks