LinuxQuestions.org
Visit Jeremy's Blog.
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-10-2008, 01:15 PM   #1
leicaphotos
Member
 
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...


thanks...
 
Old 10-10-2008, 01:24 PM   #2
CRC123
Member
 
Registered: Aug 2008
Distribution: opensuse, RHEL
Posts: 374
Blog Entries: 1

Rep: Reputation: 31
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':
Code:
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'
 
  


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


All times are GMT -5. The time now is 03:09 AM.

Main Menu
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