[SOLVED] making test.php executable on linux

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
soul8o8
Forum Newbie
Posts: 4
Joined: Wed Aug 11, 2004 6:47 am

making test.php executable on linux

Post 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
User avatar
soul8o8
Forum Newbie
Posts: 4
Joined: Wed Aug 11, 2004 6:47 am

Post by soul8o8 »

..ok if i type

./test

it works!?? wtf! why wont just

test

work??
User avatar
soul8o8
Forum Newbie
Posts: 4
Joined: Wed Aug 11, 2004 6:47 am

Post 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
Post Reply