Solved

PHP - AJAX - why is file access sequential - No Sessions

Posted on 2012-03-28
4
380 Views
Last Modified: 2012-06-27
I have a php file that acts as a gateway to an application server. The php file acts as a connector, it collects values from the request and opens a socket to send a msg to the application server, and then echoes back the returned response - generally some HTML.

The process works correctly, however an individual user can only send requests in serial manner, ie one request to the php file must complete before the next queued request is executed. However multiple users can access the same file, and two simultaneous requests from two different browsers from the same PC will also work.

We are not using any php session management as the application server handles all of that.

I am confused as to why I cannot execute multiple calls to the same file from a single connection/'session'.

As a footnote, the PHP file used with IIS 7.5 does not exhibit this behaviour an individual connection can access the php file in a con-current manner.

Here are some settings from php.ini

session.save_handler = files
session.auto_start = 0

The environment is Ubuntu Server 10.04.4
PHP Version 5.3.2-1ubuntu4.14
Apache/2.2.14 (Ubuntu) Server built: Feb 14 2012 16:42:25
0
Comment
Question by:kyleitvss
  • 2
  • 2
4 Comments
 
LVL 7

Expert Comment

by:designatedinitializer
ID: 37776124
It could be due to PHP socket blocking, which is ON by default in PHP -- I don't know if in IIS your default is off.
Bu it's probably something in your Apache configuration.
Check the "accept Serialization - multiple sockets" section in this page:

http://httpd.apache.org/docs/2.2/misc/perf-tuning.html

PS: Sessions have nothing to do with it
0
 

Accepted Solution

by:
kyleitvss earned 0 total points
ID: 37779638
I looked thru' that section ( "accept Serialization - multiple sockets") - and it was very interesting however it was a way over my head. However, I did some testing and found that if the URL is made to be unique then simultaneous requests will get processed.

http://<servername>/path/connector.php/test_response?site_id=mysite&uniqueid=11111

http://<servername>/path/connector.php/test_response?site_id=mysite&uniqueid=22222

So its not sessions as you noted - its how Apache handles discrete requests from a browser.
0
 
LVL 7

Expert Comment

by:designatedinitializer
ID: 37779703
that's got be something you can tweak in the conf, though you will surely go about it that way you devised.
0
 

Author Closing Comment

by:kyleitvss
ID: 37815442
Further testing proved the issue was a related to the uniqueness of the URL
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now