LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-21-2011, 02:50 AM   #1
ksushants
LQ Newbie
 
Registered: Apr 2009
Posts: 10

Rep: Reputation: 0
Running PHP scripts on CLI


Hi,

We are running PHP scripts on the command prompt but it does not display the output. When the same script is run thru a browser it works.
Simple commands like echo, print work on command line, but mysql_connect, ifx_connect are not working.
Please let me know the settings for PHP to work on command line.

Thanks in advance.
 
Old 10-21-2011, 06:33 AM   #2
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 345Reputation: 345Reputation: 345Reputation: 345
Have you looked at e.g. http://stackoverflow.com/questions/5...-connect-error? I just typed "run php script on command line mysql_connect" into duckduckgo...

Hope this helps,
 
Old 10-21-2011, 10:27 AM   #3
linuxwin2
Member
 
Registered: Oct 2011
Posts: 44

Rep: Reputation: Disabled
Quote:
Originally Posted by ksushants View Post
Hi,

We are running PHP scripts on the command prompt but it does not display the output. When the same script is run thru a browser it works.
Simple commands like echo, print work on command line, but mysql_connect, ifx_connect are not working.
Please let me know the settings for PHP to work on command line.

Thanks in advance.
You must install php5-cli package
 
Old 10-21-2011, 11:04 AM   #4
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,493

Rep: Reputation: 636Reputation: 636Reputation: 636Reputation: 636Reputation: 636Reputation: 636
Quote:
Originally Posted by Snark1994 View Post
I just typed "run php script on command line mysql_connect" into duckduckgo...
Hope this helps,
I don't think this helps. If you think people should Google first before asking obvious questions here I agree with you. However duckduckgo doesn't ring a bell. If you want to land your point firmly use http://lmgtfy.com/

The packages to be installed are php5-cli and php5-mysql

jlinkels

Last edited by jlinkels; 10-21-2011 at 11:08 AM.
 
Old 10-22-2011, 04:10 AM   #5
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 345Reputation: 345Reputation: 345Reputation: 345
I said duckduckgo because duckduckgo was actually what I typed it into, as opposed to google However, you're right, I should have taken the time to check it was first result in google as well (it was ). On a mostly unrelated note, I also kinda object to people using lmgtfy, because frankly I find that annoying...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
php cli can't run php file outside its path asiandude Programming 4 12-11-2008 03:50 PM
PHP: some scripts parse, some don't (HTTP and CLI) Splenden Linux - Server 6 03-27-2007 02:27 AM
running test scripts with php PhilTR Linux - Server 11 09-12-2006 02:13 PM
Running PHP Scripts in SuSe Linux 9.3 w/o a server. elliotfuller Linux - Software 3 06-18-2005 07:27 PM
Apache not running php scripts Seventh Linux - Newbie 3 01-08-2004 09:35 PM


All times are GMT -5. The time now is 05:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration