LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Running PHP scripts on CLI (https://www.linuxquestions.org/questions/linux-newbie-8/running-php-scripts-on-cli-909285/)

ksushants 10-21-2011 01:50 AM

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.

Snark1994 10-21-2011 05:33 AM

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,

linuxwin2 10-21-2011 09:27 AM

Quote:

Originally Posted by ksushants (Post 4504046)
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

jlinkels 10-21-2011 10:04 AM

Quote:

Originally Posted by Snark1994 (Post 4504179)
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

Snark1994 10-22-2011 03:10 AM

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...


All times are GMT -5. The time now is 10:42 AM.