Related Content
A Look At Flood Fill Algorithms In PHP
If you have ever used a paint program then you might have used a flood fill algorithm. This is a mechanism by which an area of an image can be filled with a different colour and is normally depicted by a pain can pouring paint.
A Look At Benford's Law
Benford's Law is an interesting heuristic in data analysis. It states that in any large collection of numbers that are created naturally, you should expect to see numbers starting with the number 1 about 30% of the time. The frequency distribution of numbers states that 2 should appear about 17% of the time, down to 9 being seen just 5% of the time.
Protecting A Page From Being Directly Accessed With PHP
I was thinking recently about the number of ways in which I could restrict access to a page using PHP.
The obvious option is to create a user authentication system, but in some situations that is overkill for what is required. If you just want to prevent users from going directly to a certain page then there are a few options open to you.
Generating Colour Palettes From Images In PHP
A common web design pattern is to incorporate an image into the design of the page. This creates a tighter integration with the image and the rest of the page.
The main issue in designing a page around the image is that the colours of the page must match the image. Otherwise this creates a dissonance between the image and the styles of the site.
Validating XML Files With XML Schema Definitions In PHP
XML is a useful format for configuration, data storage, and transmitting data from one system to another. As a human readable format that can be easily read by machines it quickly gained favor in lots of different systems as a mechanism for data storage.
Creating A Character Bitmap In PHP
I was watching a video from NDC by Dylan Beattie the other day on The Story of Typography and a particular section stood out to me.
Comments
Thank you! This fixed my script-only-runs-for-so-long problem and makes perfect sense. SOAP sucks, unless you're washing your hands.
Submitted by Mike Lerley on Thu, 05/28/2020 - 22:09
PermalinkThank you! I had gone through an exhaustive and boring process to identify that it was actually a SOAP call that was causing the leak of filehandles (there were loads of other possibilities in my case), so it was really helpful that once I knew that, it took seconds to find this post with the solution.
Submitted by sam marshall on Tue, 02/02/2021 - 14:02
PermalinkHappy to help Sam. Glad you found the solution! \o/
Submitted by philipnorton42 on Tue, 02/02/2021 - 17:15
PermalinkThanks for the time spent on this article, I have a question.
If my soap call takes a long time to complete (at least 3 minutes for response to be complete), turning the "keep_alive" to false may cause some problems.
Is there a way to close the connection manually ?
Submitted by Amir on Thu, 12/16/2021 - 11:09
PermalinkWell, you can't directly close it as the client request is a blocking function. What I mean is that once the request is in motion you can't run any code to see if it's finished.
What you can do is set a timeout. From what I've read you can use the init_set() function to set the "default_socket_timeout".
However, that apparently doesn't effect https addresses, which makes it redundant. There are a few examples out there that extend the SoapClient class and change the __doRequest() method to use a non-blocking stream with a larger timeout, but I don't have any way of testing that these days.
Just remember that under the hood, SOAP is a http(s) request/response model. All the SoapClient does is wraps the complexity of changing arrays and objects into XML and then sends the response.
Submitted by philipnorton42 on Thu, 12/16/2021 - 15:49
PermalinkAdd new comment