For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > December 2006 > Is PHP Suitable for This?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Is PHP Suitable for This?
Michael R. Copeland

2006-12-24, 3:59 am

I have an application I've developed in C/C++, written as a console
application. I need to port it to our Web page in such a manner that it
operates from a simple menu and searches a large text file database.
Currently, there are several text files being used together to identify
the existence of relevant information, as well as allow the program to
read "directly" (s/read) the data records. (It's a sort of "indexed
sequential" design.)
I've started working with 2 PHP books, and it _looks_ as though PHP
has the capability to do text file I/o in ways similar to my current
program. The data files are quite large (10MB), which is why byte
indexing is needed...as opposed to vast and slow sequential searching.
Is PHP suitable for something like this? If so, are there any sites
or NewsGroups I'd benefit from in this endeavor? TIA
Jussist

2006-12-24, 3:59 am

Depending on situation with the webserver, and complexity of your
console-application, but perhaps you could change a bit the
console-application so, that it would provide an interface usable to
php.

See www.php.net/manual/ref.exec.php

-jussi

Michael R. Copeland wrote:
> I have an application I've developed in C/C++, written as a console
> application. I need to port it to our Web page in such a manner that it
> operates from a simple menu and searches a large text file database.
> Currently, there are several text files being used together to identify
> the existence of relevant information, as well as allow the program to
> read "directly" (s/read) the data records. (It's a sort of "indexed
> sequential" design.)
> I've started working with 2 PHP books, and it _looks_ as though PHP
> has the capability to do text file I/o in ways similar to my current
> program. The data files are quite large (10MB), which is why byte
> indexing is needed...as opposed to vast and slow sequential searching.
> Is PHP suitable for something like this? If so, are there any sites
> or NewsGroups I'd benefit from in this endeavor? TIA


Ric

2006-12-24, 7:59 am

Michael R. Copeland schrieb:
> I have an application I've developed in C/C++, written as a console
> application. I need to port it to our Web page in such a manner that it
> operates from a simple menu and searches a large text file database.
> Currently, there are several text files being used together to identify
> the existence of relevant information, as well as allow the program to
> read "directly" (s/read) the data records. (It's a sort of "indexed
> sequential" design.)
> I've started working with 2 PHP books, and it _looks_ as though PHP
> has the capability to do text file I/o in ways similar to my current
> program. The data files are quite large (10MB), which is why byte
> indexing is needed...as opposed to vast and slow sequential searching.
> Is PHP suitable for something like this? If so, are there any sites
> or NewsGroups I'd benefit from in this endeavor? TIA

If the c++ app works well, why redesign it in php, just add few
functions to your c++ code and make it a php extensions:

http://www.zend.com/apidoc/zend.creating.php
Veign

2006-12-24, 6:59 pm

"Michael R. Copeland" <mrc2323@cox.net> wrote in message
news:MPG.1ff7b2a0eeea0ed99896bf@news.cox.net...
> The data files are quite large (10MB), which is why byte


10MB is actually small. When you get into the Gig range you are getting
into 'quite large' data files.

--
Chris
http://www.veign.com / http://www.veign.com/blog
--


hackajar@gmail.com

2006-12-25, 7:58 am

Just like in C/C++

http://us2.php.net/manual/en/function.fgets.php

<?php
$handle = @fopen("/tmp/inputfile.txt", "r");
if ($handle) {
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
echo $buffer;
}
fclose($handle);
}
?>

Hackajar
Michael R. Copeland wrote:
> I have an application I've developed in C/C++, written as a console
> application. I need to port it to our Web page in such a manner that it
> operates from a simple menu and searches a large text file database.
> Currently, there are several text files being used together to identify
> the existence of relevant information, as well as allow the program to
> read "directly" (s/read) the data records. (It's a sort of "indexed
> sequential" design.)
> I've started working with 2 PHP books, and it _looks_ as though PHP
> has the capability to do text file I/o in ways similar to my current
> program. The data files are quite large (10MB), which is why byte
> indexing is needed...as opposed to vast and slow sequential searching.
> Is PHP suitable for something like this? If so, are there any sites
> or NewsGroups I'd benefit from in this endeavor? TIA


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com