LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 05-02-2004, 06:44 PM   #1
odious1
Member
 
Registered: Jun 2003
Location: Virginia, USA
Distribution: Slackware
Posts: 252

Rep: Reputation: 30
php from command line


I compiled php with apxs for apache support. I cannot however get it to run from the command line. I had hoped I could use it for some basic shell scripting as well. If I create a simple:

#! /usr/bin/php -q

<?php echo "test"; ?>

and execute it I get no output. Keep in mind that this is my first experience with a scripting language from the command line. Am I doing something wrong?

Thanks
Tom
 
Old 05-02-2004, 06:49 PM   #2
Mega Man X
Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 63
I don't think php can run outside a web server? You've to upload the homepage with the php code to your Apache directory, then run it from a browser for that to work. Or have I been dreaming again...
 
Old 05-02-2004, 07:27 PM   #3
rkef
Member
 
Registered: Mar 2004
Location: bursa
Posts: 110

Rep: Reputation: 15
odious1, it works fine for me on Slackware 9.1, php version 4.3.6 (not my own pack, just an official Slackware one, ie. I didn't build it myself as I normally do). When you compiled it, did you use --enable-cli?
 
Old 05-02-2004, 08:11 PM   #4
odious1
Member
 
Registered: Jun 2003
Location: Virginia, USA
Distribution: Slackware
Posts: 252

Original Poster
Rep: Reputation: 30
No I did not, if I recompile with that option I wonder if module function will remain intact. I do see that as one of the options of configure --help I will give it a try; thanks.
 
Old 05-03-2004, 01:31 AM   #5
nodger
Member
 
Registered: Oct 2003
Location: Ireland
Distribution: Slackware 9.1, Ubuntu
Posts: 192

Rep: Reputation: 30
you can run a php script from the command line by using
Code:
#php file.php
 
  


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] accessing command line dtra Linux - Software 1 04-26-2005 08:19 PM
Command Line PHP in Slack 10 Trano Slackware 4 02-12-2005 06:16 PM
php command line scripts naflan Programming 5 11-09-2004 09:02 AM
Command Line PHP on Mandrake Dilireus Linux - Software 2 08-04-2004 06:46 PM
PHP execute at command line gjmwalsh Mandriva 2 12-06-2003 02:03 AM


All times are GMT -5. The time now is 09:44 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration