473,406 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Running PHP in custom www server app

We are developing a (Win32) C++ application which among other things is
able to generate some HTML pages and send them to an HTML client (in the
same app actually). Now for more flexibility we would like to filter the
generated pages through PHP. What should be the best/easiest way to
proceed? I would like to avoid any temporary files as much as possible.

1. Use _popen or CreateProcess to launch PHP-CGI.EXE, feed the input file
in stdin and capture stdout. I'm afraid this will create nasty black
windows on the screen.

2. Include <php.h> etc and call php_execute_script() et al directly (are
these documented somewhere?). Seems to be very file/stream-oriented, I
would like string-in, string-out instead.

3. Install php ActiveScript support and call it via COM interface. Seems
to be the cleanest approach, but how to do it in C++? Any examples?

4. ...?

Also, what possibilities are there to pass data to php? Again, I would
like to avoid temporary files. Possibly to inject variable/array creation
PHP code directly in the passed script text?

thanks in advance
Paavo

Jul 17 '05 #1
3 2118
Paavo Helde <no****@ebi.ee> wrote in message
news:<Xn**********************@194.126.101.124>...

We are developing a (Win32) C++ application which among other things is
able to generate some HTML pages and send them to an HTML client (in the
same app actually). Now for more flexibility we would like to filter the
generated pages through PHP.
Please clarify what you are referring to as "filtering" pages through
PHP. It sounds like you want to generate PHP code to be executed, but
I am not sure...

Also, you forgot to mention what HTTP server you are using... PHP can
be deployed on a variety of servers, quite often in more than one way
(CGI binary vs. module on Apache, CGI executable vs. ISAPI module on
IIS)...
What should be the best/easiest way to proceed?


Assuming you want to generate (and then run) PHP code, the easiest way
would be to pass a chunk of PHP code via POST to this simple snippet:

<?php
eval($_POST['code']);
?>

Obviously, you may want to implement some security checks (i.e., send
additional data to be used for authentication).

Cheers,
NC
Jul 17 '05 #2
nc@iname.com (Nikolai Chuvakhin) wrote in message news:<32**************************@posting.google. com>...
Paavo Helde <no****@ebi.ee> wrote in message
news:<Xn**********************@194.126.101.124>...

We are developing a (Win32) C++ application which among other things is
able to generate some HTML pages and send them to an HTML client (in the
same app actually). Now for more flexibility we would like to filter the
generated pages through PHP.


Please clarify what you are referring to as "filtering" pages through
PHP. It sounds like you want to generate PHP code to be executed, but
I am not sure...

Also, you forgot to mention what HTTP server you are using... PHP can
be deployed on a variety of servers, quite often in more than one way
(CGI binary vs. module on Apache, CGI executable vs. ISAPI module on
IIS)...


Sorry if I was unclear. There is no HTTP server, nor can we make use
of one as the app will be distributed to end users who don't have it
anyway.

Instead, our app itself acts as a HTTP server. It listens on some port
and provides HTML pages for the CHtmlView controls sitting in the same
app. It's quite easy as there is (almost) no question of security,
transaction speed, support of n+1 protocols, etc. However, now has
arisen a need to add PHP support to our "server"...

Regards
Paavo
Jul 17 '05 #3
pa***@ebi.ee (Paavo Helde) wrote in message
news:<a5**************************@posting.google. com>...

Sorry if I was unclear. There is no HTTP server, nor can we make use
of one as the app will be distributed to end users who don't have it
anyway.


Oh, I see. In this case, you need to use the command-line interpreter,
which does not require an HTTP server. You can pipe output of your
application to the command-line interpreter's STDIN and receive the
output via STDOUT.

For more information, read The Manual:

http://www.php.net/manual/en/features.commandline.php

Cheers,
NC
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Shahir A. Ahang | last post by:
Sorry for the cross-post as I am not sure which group to post this question to. I am trying to run an ASP.NET application in IIS 6.0. If I have my application in the c:\inetpub\wwwroot\app1\...
7
by: Scotter | last post by:
Hi - Simple ASPX application not running. I've given the ASP.NET, IWAM, and USR accounts full permissions to the folder my application resides in. I don't know what else needs done on the server...
9
by: Marina Anufreichik | last post by:
Hi, After deploymnet web application on web server I can access page on local machine and login fine but when I'm trying to access web site from remote machine I can see login page, but when I'm...
4
by: kurt.krueckeberg | last post by:
I am considering going with the ISP Dreamhost because they offers both php4 and php5 support. However, I recently learned php4 runs as a regular CGI by default. This can be change, so it will runs...
0
by: Luke Dalessandro | last post by:
I have an application with a web page that I would like to run as if it were at a different location than it actually resides at. As an example: Imagine that I have a site layout as, ~/...
1
by: David Herbst | last post by:
Enterprise Library Jan 2006 with Visual Studio 2005 on Windows 2000 Server sp4. My custom exception formatter fails with a "Unable to handle exception: 'LoggingExceptionHandler'." exception. ...
4
by: news.citenet.net | last post by:
I keep getting the following error message after my web site running 2 or 3 days I share one folder with about 200 domain names Any one can help? ...
1
by: omx | last post by:
hi threre, well i receive following error when i run the file from the server, if i run the file using file system option then no error can you guys help me in solving this problem: Server...
10
by: TS | last post by:
i just noticed the website i created in VS 2005 is running on a different port than the default. I see that it is running on the local web server, and also that the website i created isn't in IIS....
3
by: bangeye | last post by:
Tribe, I have need to use ASP.NET to connect to an already running application (non web) that will be running on the same server as IIS. Start MyServerApp, MyServerApp is now running - doing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.