homepage Welcome to WebmasterWorld Guest from 107.20.34.144
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

5+ Year Member



 
Msg#: 4228058 posted 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

WebmasterWorld Senior Member lammert us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 4228058 posted 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

5+ Year Member



 
Msg#: 4228058 posted 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

WebmasterWorld Senior Member lammert us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 4228058 posted 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