Click to See Complete Forum and Search --> : nohup php not working
stephan.gerlach
04-19-2007, 08:26 AM
Hi there
I want to execute a php file from comandline.
After i went to the folder in which the php file is i write the following
#sudo nohup php script.php
I get the following error message
nohup: cannot run command `php': No such file or directory
I have php installed and also mysql and dont know what i am doing wrong.
Can anyone help me?
NogDog
04-19-2007, 12:31 PM
Sounds like php is not in your search path. Either edit your environment settings to add it, or give the full pathname to it in your command line, something like:
sudo nohup /usr/bin/php script.php
Or, add the following line at the very start of the php file:
#!/usr/bin/php
Make sure the file has execute permission, then call it from the command line as:
sudo nohup script.php
stephan.gerlach
04-20-2007, 12:59 AM
Thanks for the help. Problem is that there is no folder usr/bin/php. This is so strange because I run the linux machine as local dev server and i have loads of websites with php and mysql on there.
System Info:
Distribution: Ubuntu 5.10
PHP: 5.0.5-2ubuntu1.8
Apache: Apache/2.0.54
How did I installed apache and php
#sudo apt-get install apache2
#sudo apt-get install php5
Does anyone else have any idea?
NogDog
04-20-2007, 02:50 AM
"/usr/bin/php" was just an example, not knowing where you might have PHP installed on your server (assuming it is, in fact, installed?). You'll need to locate the actual installation directory and use that in its place.
stephan.gerlach
04-20-2007, 04:12 AM
well it is installed because i run php sites on the server i just dont know where it is installed. How can I find out?
NogDog
04-20-2007, 04:01 PM
# find / -name php -print
(This may take awhile, depending on the number of files/directories on the server.)
Or you could just start searching under likely directories such as /usr, /etc, or /opt.