0

I am running a script that has to run at the user level, I do not want to change the PHP daemon to run as another user.

Currently I have to manually type php -S 0.0.0.0:8080 /home/user

This works if I input it manually but I want to be able to do this when it boots up.

Nathan K
  • 15
  • 4

2 Answers2

0

if you wanna run php script then create a bash command. How to run shell script at boot theres a topic that might help you in this case :)

Community
  • 1
  • 1
Enigma
  • 23
  • 1
  • 10
0

Write a script containing your command.

it can be a one-liner such as #!/usr/bin/php -S 127.0.0.1:8081 /home/knb (does NOT work for me)

Make the script executable with chmod ugo+x myscript.php

In Ubuntu, there is a GUI tool called "Startup Applications" where you have to enter the full pathname of your script in the textfield labeled "Command:".

ALternatively, If you want to use systemd for this (e.g., to execute the script at bootup for all users, no matter who logs in), read this : https://unix.stackexchange.com/questions/47695/how-to-write-startup-script-for-systemd and follow the instructions (copy + paste an existing minimal startscript, customize it)

knb
  • 9,138
  • 4
  • 58
  • 85