Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embed a web-server that can handle multiple requests at the same time #14

Closed
GoogleCodeExporter opened this issue Aug 28, 2015 · 13 comments

Comments

@GoogleCodeExporter
Copy link

Seems like the PHP built-in webserver is not multi-threaded, it
can handle only one request at the same time, this can be a problem
when executing scripts that take a significant amount of time. Take 
for example this scenario:

test1.php
---------
{{{
<?php
sleep(5);
print("test1 finished.");
?>
}}}

test2.php
---------
{{{
<?php
print("test2 finished.");
?>
}}}

Run test1.php & test2.php, you will see that you have to wait five
seconds before test2.php is executed, as test1.php has made the
web-server busy.

The same problem exists when using direct PHP API calls, see Issue 3.

Original issue reported on code.google.com by [email protected] on 15 Jan 2013 at 5:26

@GoogleCodeExporter
Copy link
Author

Problem also exists with the Thread Safe version of PHP.

Original comment by [email protected] on 15 Jan 2013 at 5:48

@GoogleCodeExporter
Copy link
Author

One of the options is to embed embed a web-server like Mongoose, which 
is written in C,only 140 KB, with CGI support, it is cross-platform and 
MIT licensed, this is the only option for Internet Explorer engine:

http://en.wikipedia.org/wiki/Mongoose_(web_server)

Wich Chrome we can implement a custom scheme handler, thus making web-server
an optional thing, we could go with direct PHP API calls to execute scripts,
but this would have to be done in a multi-threaded manner, CEF would need to
have a multi-threaded message loop.

Original comment by [email protected] on 15 Jan 2013 at 6:03

  • Changed title: Embed a web-server that can handle multiple requests at the same time

@GoogleCodeExporter
Copy link
Author

Mongoose official website is at:
http://code.google.com/p/mongoose/

Original comment by [email protected] on 15 Jan 2013 at 6:11

@GoogleCodeExporter
Copy link
Author

Mongoose PHP example (available in Downloads) comes with a Thread Safe
version of PHP, as I see "php5ts.dll".

Original comment by [email protected] on 15 Jan 2013 at 6:17

@GoogleCodeExporter
Copy link
Author

I've tested test1.php and test2.php with Mongoose and it works great.

Original comment by [email protected] on 15 Jan 2013 at 6:19

@GoogleCodeExporter
Copy link
Author

The question is whether we should embed Mongoose directly in our application,
or distribute "Mongoose.exe" along with "mongoose.conf" & "php-cgi.exe". When
running Mongoose.exe I don't see php-cgi.exe in the processes, maybe if we
embed through the C API we won't have any additional processes except the
"phpdesktop-msie.exe", that would be great, if anything hangs up there won't
be any gargage still running in the background.

Original comment by [email protected] on 15 Jan 2013 at 6:25

@GoogleCodeExporter
Copy link
Author

"php-cgi.exe" appears in processes only while php script is running.

Original comment by [email protected] on 15 Jan 2013 at 7:11

@GoogleCodeExporter
Copy link
Author

Original comment by [email protected] on 16 Jan 2013 at 5:54

  • Added labels: NextRelease

@GoogleCodeExporter
Copy link
Author

PHP web-server is not reliable, it sometimes doesn't start for 
unknown reason.

Original comment by [email protected] on 19 Jan 2013 at 4:35

@GoogleCodeExporter
Copy link
Author

Mongoose allows us to log the coming http requests directly to application's
debugging console.

Original comment by [email protected] on 19 Jan 2013 at 2:58

@GoogleCodeExporter
Copy link
Author

Mongoose options:
https://github.com/valenok/mongoose/wiki/Manual

We might consider adding these to settings.json:
  access_log_file
  enable_directory_listing
  error_log_file
  extra_mime_types
  num_threads
  url_rewrite_patterns

Create a separate issue for adding this options.

Original comment by [email protected] on 19 Jan 2013 at 4:02

@GoogleCodeExporter
Copy link
Author

This feature was added in revision 302ce0d6e6e3.

Original comment by [email protected] on 19 Jan 2013 at 5:58

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Project will move to Github. Find this issue at the new address (soon): 
https://github.com/cztomczak/phpdesktop/issues/14

Original comment by [email protected] on 24 Aug 2015 at 3:14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant