homepage Welcome to WebmasterWorld Guest from 54.204.141.129
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
Forum Library, Charter, Moderators: bakedjake

Linux, Unix, and *nix like Operating Systems Forum

    
Running php and mysql commands at terminal
ocon




msg:4228060
 3:41 pm on Nov 8, 2010 (gmt 0)

I'm trying to run php and mysql commands from the command terminal.

I'd like to run commands such as: php mypage.php

But I can't because I get this error: -sh: php: not found

What I have to do is run: /opt/php5/bin/php mypage.php

I can't even find the path to run mysql from the command line, but I know mysql works because it works on the site.

How can I configure my Ubuntu 10.04 setup to allow me to use short commands such as php instead of /opt/php5/bin/php and mysql instead of (how do I find the path?).

 

lammert




msg:4228136
 6:59 pm on Nov 8, 2010 (gmt 0)

The path is in the environment variable PATH. The place where you add an extra directory to your path depends on the shell you use, but it is probably the file .bash_profile or .profile in your home directory.

You can extend your path by adding the following two lines to the profile file:

PATH=$PATH:/opt/php5/bin
export PATH


Be sure to logout and login again, because the profile file is only read at login.

ocon




msg:4228180
 8:45 pm on Nov 8, 2010 (gmt 0)

Thank you. I located my .bash_profile. Would I add those two lines in verbatim into the document, or do I need to change anything?

lammert




msg:4228192
 9:09 pm on Nov 8, 2010 (gmt 0)

If you add these two lines to the end of the file it should work, even if there are other PATH assignment statements in the profile file.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved