Sorry! Very Basic Question

Alles, was PHP betrifft, kann hier besprochen werden.

Sorry! Very Basic Question

Postby bxdobs » 23. January 2022 11:44

Hello, I am a top-down dinosaur struggling with a concept of who's on first ... might be that I am just overthinking this BUT ...

Scenario: Unix flavor (apache2 based webserver) running WordPress. Installed Plugin provides for PHP hooks.
Having read through the WP and WP Plugin best practices I am not getting a black and white answer to my concerns that the PHP hook code I have made can't be clobbered by reentry (multiple clients).

What I am struggling with the most is what exactly happens when a client requests a WP page:

Given - Wordpress front end triggers an HTML page build out based on the page Content stored in SQL tables

1) how does unix | apache | wp, keep track of the client? Old school communications (Modems) negotiate a connection that is then exclusively nailed up until the host or client disconnects ... my understanding of Internet | intranet interactions is that a "Connection" isn't physically nailed up in the same way ... but ... expecting there must be some kind of KEY/REFERENCE that the client browser and the host exchange (simulating a nailed connection) for continued interactions?`

2) in keeping with question one, is it likely to expect EACH "Connection" on the server will have its own separate DATA space? The PHP hook I have written needs to have Global variables because EVENTS are disconnected ... ie: Event 1 will store information that Event N requires ... I hate Globals because there is an implication they can be changed by other processes and or events ... SO LONG STORY SHORT: is there any possibility that the GLOBALS are open to other CLIENT "CONNECTIONS" ... OR ... am I safe to assume (without making an ass out of you or me) that EACH client will have its OWN set of GLOBAL variables?

When I do a ps -ef on the server with a minimum 2 clients connected, I was expecting to see tasks for both clients ... basically, only see one of each apache and wp services ... suggesting that if there are separate data spaces, they are being managed at the application/service level? Maybe there are cli tools that can list client connections?

Thank-you in advance for your time on setting this old dinosaur straight
bxdobs
 
Posts: 2
Joined: 23. January 2022 11:39
XAMPP version: 999
Operating System: W7

Re: Sorry! Very Basic Question

Postby Altrea » 23. January 2022 17:35

Hi,

most common practice to track a user session are Browser Cookie based session token in combination with Serverside session data. Session data are delivered per user. So it is very important to implement the tracking cookie correctly so it cannot get stolen (replicated) by another client.

You can and should even secure this up by using one time request tokens (keyword CSRF) and making session token invalid on important changes like IP address switching.

How exactly Wordpress or specific wordpress plugins are implementing this up don't know.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11620
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Sorry! Very Basic Question

Postby bxdobs » 23. January 2022 20:44

The website is secure (https://blah.com) and has several client form pages which dynamically interact with this serverside PHP (hook) program

What I am hearing you say is instead of using serverside Globals I should use Cookies for these variables ... Cookies come with their own baggage which can lead to unpleasant client interactions

Thanks! Reading between the lines of your comment, I think you have answered my concern that PHP Serverside Globals may not be the way to go.

Time to fall back on my database skills and create a table to temporarily capture these serverside values.
bxdobs
 
Posts: 2
Joined: 23. January 2022 11:39
XAMPP version: 999
Operating System: W7

Re: Sorry! Very Basic Question

Postby Nobbie » 23. January 2022 23:41

You have a completely wrong understanding of global PHP variables. These are not global in the scope of a server. They are global to a single HTTP request within the PHP script, and each HTTP request is closed immediately after the server has delivered the requested ressource. Global does not mean the physical scope, but the syntactically scope of the variable name.

After a webserver has delivered the requested ressource, the TCPIP connection is closed and all data of this connection is gone. Therefore HTTP is also known as stateless protocoll. It is a transactional protocoll. Cookies are used to keep previous informations from earlier requests mostly in order to identify the client.
Nobbie
 
Posts: 12515
Joined: 09. March 2008 13:04

Re: Sorry! Very Basic Question

Postby Winfif » 18. July 2022 15:30

At the moment I see that the site is down. Also, monitoring the site here shows that this is not a local problem. The site is not available in all regions that were checked.
Image
Winfif
 
Posts: 4
Joined: 17. June 2022 18:06
XAMPP version: 8.0.19
Operating System: Windows 10


Return to PHP

Who is online

Users browsing this forum: No registered users and 6 guests