Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I have a question in my mind that if answered can solve my problem.
How does server handle multiple user request for PHP scripts?
For example, if a user open a page that access a PHP script using ajax request, and for instance that PHP script has a long process ( actually very long ) and another more user open the same page in other machines, and another more and more user.
Does the process in PHP needed to be finished first before the second user who access to the script can be handled or will they be handled in parallel way the server?
The web server, say Apache, will launch a new independent PHP process for every request. There may be several instances of PHP executing the same script independently of each other running simultaneously. They do not wait for each other* nor do they interfere with each other**.
* If they are trying to access shared, locked resources simultaneously, they may have to wait for each other. Say, files or sessions.
** Unless of course they modify some external resource (say files or database records) in a way where they interfere.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
so we got hacked and from that we raised a question based on our logs. Can a hacker start uploading a file at one point and specify when should it stop uploading. I.e. we got a HIT from an IP address at 06:50:52 2020-06-19 and the file uploaded later on 2020-06-20. The file is 2Mb so no way it actually took a full day to upload or does it depend on PHP configuration. Also there is no indication on when the file was uploaded only the first HIT was logged.
The client may influence the speed the file is being uploaded. It depends on the configuration of your server whether you timeout such long lasting requests or not. See the slow loris attack example to see how things may work.
you have to find which vulnerabity got exploited. It can be anything from a reverse shell to the webserver gained throu some php vulnerable scripts ...to some WordPress bug. Look thru all the logs
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
The essence of the situation:
There website is a call-center (websocket-server located at a site different from the server).
The site must receive relevant information for now with this websoket server, the information received by the site is the same for all users (the number of available telephone lines).
Now it is implemented as follows: each visitor at each transition on the pages connects with websocket-server via javascript and receives the data. As a result, created a large number of compounds and websoket server drops.
Change anything on websoket server is not possible.
How should work:
On the site server running PHP daemon that establishes one connection to vebsoket server and receives every N seconds to date information and writes it to a file.
question:
Is it realistic to implement PHP daemon, which will keep a constant connection with websocket-server? If so, what additional libraries needed for this?
here is very useful lib with simple examples. Tested on real projects.
https://github.com/lukaszkujawa/php-multithreaded-socket-server
Here is example page
http://systemsarchitect.net/multi-threaded-socket-server-in-php-with-fork
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
im wondering what would happen if a cron job is set to run every minute but the script it runs takes 2 minutes to run? Would it queue itself, ignore runs if previous cron is still running or run the same file simultaniously? Thanks!
The cron will boot up a new PHP process every minute, and they will all operate simultaneously with various terrible results (unless your script is properly guarded against such things, anyway)
After a while, either you'll constantly have a number of simultaneous requests running OR your server will crash after running out of resources, depending on whether or not the scripts start blocking each other due to trying to access restricted resources.
Either way, it probably won't be pretty and it probably won't be what you want.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I have an Nginx load balancer load balancing two nginx servers serving PHP content (Moodle) up. They share the same database and use the same sessions directory using an NFS share on a separate server.
I am running PHP 5.4.1 and the latest version of Moodle.
Right now the load balancing works just fine, and I am able to access both worker nodes using the proxy. However, when logging in to Moodle, I get an error saying that cookies are disabled. They obviously are not, and logging into one of the worker nodes works just fine. When accessing the nodes individually, the MoodleSession cookie gets set, but when accessing it through the load balancer, no cookie is set.
I have tried changing the cookie mode to use the MySQL database, but this does not work, either.
What can I do get multiple worker nodes to set cookies that the server is storing in a common directory (NFS)?
Try checking for spaces or unknown characters in config.php. This may be preventing cookies from being set and return that warning.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I made a PHP based webapp and a customer of my needs it on his website. Now I want to put the PHP code on my server and let the customer's website include it remotely. How do I set this up? And can I restrict the acces when the customer doesn't need the app anymore and is it secure?
There is nothing such as remote PHP. Doesn't work that way. However you can setup some API to communicate between the two servers on backend. You'd still need both servers to be capable of this interaction, that means both servers still need to be fully functional. And if your code on client's server can talk to your API on host server, then they can take that code and see how it interacts with your host and replicate it.
A very simple solution would be to put the PHP-generated content from your website in an <iframe> on their website.