Make a PHP script start at raspberry boot - Raspberry Pi Forums


hi ! hope y'all ok ? u can see in title it's pretty clear, want launch php script booting raspberry. thanks

/etc/rc.local easiest it'll run root don't want put above "exit 0"..

code: select all

sudo -u {user} -i {/path/to/php/script}
eg: have user called "admin" , invoke "z.php" "admin"..

code: select all

sudo -u admin -i /wrk/z.php
..and "z.php" is..

code: select all

#!/usr/bin/php  <?php  ob_start(); phpinfo(); $x = ob_get_contents(); ob_end_clean(); file_put_contents("./wibble",$x."\n"); file_put_contents("/tmp/z",$x."\n");  ?>
btw, don't know php caveat emptor!


raspberrypi



Comments