You are here: Re: PHP script communicating with C/C++ program « PHP Programming Language « IT news, forums, messages
Re: PHP script communicating with C/C++ program

Posted by Lisa Pearlson on 09/30/84 11:24

Everyone here is telling you how to optimize your queries.
look into indexing, caching, stored procedures (mysql5 ?).. optimizing
queries and code.

But your question was how to let your script communicate with your c++ code.
The way I understand your question, your options would be:

execute scripts in php like this:
exec() shell() or ` ` quotes.

Alternatively, you can communicate with your C++ code via sockets.

But as suggested by others, I don't think programming C++ will help, because
the bottle neck is not your PHP code, rather running the queries against the
database.


"Nimit" <nimit.maru@gmail.com> wrote in message
news:1124291529.132802.8000@g14g2000cwa.googlegroups.com...
> Hi, I wasn't sure which forum this post belongs to, so I've posted it
> to a couple forums that I thought may be appropriate.
>
> In giving me advice, please consider me a beginner. Below is a synopsis
> of my problem/question:
>
> SOME BACKGROUND:
> - I am writing a php based web application.
> - There is a very data intensive task I need to do that requires
> reading and lookup of a lot of data.
> - This data is all stored in a database. If I did the computation
> directly from php, then the load on the database is too intensive, and
> takes a unacceptable amount of time (over 20 secs) to calculate (I've
> already tried this).
> - So I thought what I need to do is load all this data into memory,
> and then do this operation from there, and this should be a lot faster
> than doing lookups on a database.
>
> WHAT I WANT TO DO:
> - Write a C/C++ program that is constantly running that is dedicated
> to doing this data intensive operation.
> - This program would read all the data from the dbase into memory upon
> load. Then it would take requests from a PHP script to run the
> operation on that data and return the results to the PHP script.
>
> THINGS I'VE LOOKED INTO:
> - I know you can write extensions to php in C++
> (http://bugs.tutorbuddy.com/php5cpp/php5cpp/) but I don't know if this
> is what I want to do because (as far as I understand) an extension is
> loaded and unloaded with the script. The C++ program I need has to be
> constantly running in the background, taking requests and returning
> results.
>
> If anyone has any advice of how I can go about writing this c/c++
> program that communicates with a php script or doing something similar,
> I would appreciate any help. (even if you think I am using the wrong
> technology to accomplish this, I'd like to know) Thank you!
>
> PS- my current apache/php/mysql setup is in Windows, however when this
> project goes live, I expect it to be running in unix.
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация