Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 10-10-2008, 02:15 PM   #1
Registered: Oct 2008
Posts: 68

Rep: Reputation: 15
running a php script from command line

I've got well over a million flat files and have written a php script that scrapes the necessary content and drops to a mysql database -- I ran it once on a sub section of the files from a localhost browser and it timed out after about 50,000 records...

The script is simple, it reads the file, displays the data it's scraping and inserts it into the database...

I'm running a pretty stock install of latest version of pcbsd and was wondering would it be possible to run this script from the path of /usr/local/www/apache22/data/Sect1 from the command line -- what would be my syntax for this... do I need to be in the directory or elsewhere...

Old 10-10-2008, 02:24 PM   #2
Registered: Aug 2008
Distribution: opensuse, RHEL
Posts: 374
Blog Entries: 1

Rep: Reputation: 32
running it through the 'php' or 'php5' command should do it. Here are a few ways that might work given your file was 'script.php':
php script.php
php -f script.php
cat script.php | php
php < script.php
At least one of those should work, if not, try appending a 5 to the command: 'php5'


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
Apache PHP != Command Line PHP? wh33t Linux - Server 3 10-23-2007 10:21 PM
Problems running PHP script in command line Hondro Linux - Software 1 06-21-2007 05:16 AM
Problems running PHP scrip in command line Hondro Programming 0 06-21-2007 03:39 AM
auto running a script from command line millionknives Slackware 7 10-03-2005 11:07 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:34 PM.

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