Page 1 of 1

making test.php executable on linux

Posted: Wed Aug 18, 2004 10:01 am
by soul8o8
Yo!

I have installed php4 on a debian box. I want to run php from the command line. I couldn't find any php4-cli with apt-get, erh so i tried installing php-cgi. (stupid?) Now i have a 'php4' in my /usr/bin, is that good?

Anyway so i made a script file like so:

#!/usr/bin/php4
<?PHP
echo "yo!";
?>

and called it 'test'. Then i ran 'chmod +x test'.. ok, but it doesn't seem to work! When i type 'test' and press enter nothing happends! If i type 'php4 test' it runs the program! What am i doing wrong? Shouldn't it work?



cheerio
/soul8o8

Posted: Wed Aug 18, 2004 10:11 am
by soul8o8
..ok if i type

./test

it works!?? wtf! why wont just

test

work??

Posted: Wed Aug 18, 2004 10:25 am
by soul8o8
aaaah, i have to set the PATH in order for the shell to look for the executable in the proper folder, casue it wont search for executables in the current working directory.. sweet..


export PATH=$PATH:/home/me/bin


also there already was a file named 'test' somwhere else...




hi-5
/soul8o8