PHP Classes

Are You Ready for MySQL extension Removal from PHP - Lately in PHP podcast episode 59

Recommend this page to a friend!
  Blog PHP Classes blog   RSS 1.0 feed RSS 2.0 feed   Blog Are You Ready for MyS...   Post a comment Post a comment   See comments See comments (9)   Trackbacks (0)  


Viewers: 434

Last month viewers: 6

Categories: Lately in PHP Podcast, PHP opinions

When PHP 7 will be released it will have the mysql extension removed from the core distribution. PHP 5.4 will stop being updated. Many PHP developers will have to move to PHP version 5.5 or higher, on which the mysql extension is deprecated. Many shared hosting providers already use PHP 5.5 without the mysql extension.

Alternative solutions to deal with legacy code that relies on the old mysql extension was one the topics commented by Manuel Lemos and Arturs Sosins in the episode 59 of the Lately in PHP podcast.

They also commented on proposals for future PHP versions like fixing the division by zero issue, adding static constructors to classes, the PHP RFC Watch site to keep up with new PHP proposals and voting.

They also explained the new initiative to promote reviews of books of authors that have written books of interest for PHP developers, as well writing great PHP tutorial articles for the PHP Classes blog and being compensated for that. The latest tutorial articles were also reviewed here.

Listen to the podcast, or watch the hangout video, or read the transcript to learn more about these interesting PHP topics.

Loaded Article


Introduction (0:20)

PHP 5.4.40 and 5.5.24, PHP 5.6.8 released (0:44)

Use mysql_* functions in PHP 5.5 or later when the mysql extension is not available (4:44)

Fix division by zero to throw exception (10:55)

Static Class Constructor (14:10)

PHP RFC Watch site (17:00)

PHP RFC (not) Voting App (20:51)

Have Your PHP Book Reviewed (23:07)

Fix the AJAX Requests that Make PHP Take Too Long to Respond (35:51)

PHP IPC with Daemon Service using Message Queues, Shared Memory and Semaphores (42:46)

JavaScript Innovation Award Winners of February 2015 (48:16)

JavaScript Innovation Award Rankings of 2015 (54:02)

PHP Innovation Award Winners of February 2015 (55:35)

PHP Innovation Award Rankings of 2015 (1:01:29)

Conclusion (1:04:11)


Listen or download the podcast, RSS feed and subscribe in iTunes

Watch the podcast video, subscribe to the podcast YouTube channel

Read the podcast transcript

Click on the Play button to listen now.

Introduction music Harbour used with explicit permission from the author Danilo Ercole, from Curitiba, Brazil

View Podcast in iTunes

In iTunes, use the Subscribe to Podcast... item of the Advanced menu, and then enter the URL above to subscribe to this podcast.

Watch the podcast video

Note that the timestamps below in the transcript may not match the same positions in the video because they were based on the audio timestamps and the audio was compacted to truncate silence periods.

See the Lately in PHP podcast play list on YouTube and Subscribe to this channel there.

Show notes

Introduction (0:20)


Manuel Lemos: Hello. Welcome to the Lately in PHP podcast. This is episode 59. Again, I have here Arturs Sosins from Latvia.

Hello, Arturs.

Arturs Sosins: Hello. And since you don't have a lower third, I should tell everyone that you are Manuel Lemos.


Arturs Sosins: Just in case.

Manuel Lemos: Oh, no, my mother will discover me. OK, thank you for coming once again.

PHP 5.4.40 and 5.5.24, PHP 5.6.8 released (0:44)

Manuel Lemos: We have several interesting topics to talk about. I guess, this month, we don't have as many topics in the past because now that PHP 7 features are frozen, we don't have many proposals to talk about. At least for PHP 7, the list is closed, but we have some new proposals or improvements for future versions.

So let's get started with this. First, as always, we cover a bit about the latest PHP releases which again as always, we don't have much to talk about them. Just to mention that PHP 5.4, as we know, is in security releases mode, so only security bugs were fixed, as you may see here.

I don't know if I need to increase the font. It's not increasing. Or it is increasing but it is a bit slow.

OK, there are not really much to talk about. There are some vulnerabilities that were fixed.

Arturs Sosins: Like bug fixes.

Manuel Lemos: Yeah. So, as always, if you are using PHP 5.4, you should upgrade, especially if these bugs affect your PHP environment. And for PHP 5.5, there are, well, almost same security bugs been fixed, but...

Arturs Sosins: And cURL has implemented HTTP2 support, if anyone is interested.

Manuel Lemos: Oh, I see, it's cURL. Oh, this is interesting, but anyway, it's a feature of a library. I don't know what in practice this means. Let's take a look at these links. So, it's just a bug report. I don't know in practice what this implies in terms of features of the cURL library.

Arturs Sosins: Me, neither.

Manuel Lemos: Well, maybe it's just internal implementation that it can send a request to servers that support HTTP2.

Arturs Sosins: Yeah.

Manuel Lemos: But other than that, there is nothing that is worth mentioning here. There are lots of bugs fixes, and this is PHP 5.5.24. As for PHP 5.6, we have 5.6.8. The idea is practically the same as 5.5, except it is a newer version. And so, the bug fixes are practically the same.

So, as you may be aware, we already mention here, once PHP 7 is released... Probably in October, November. We don't know exact day, but that's the planned release time. Maybe if there are no surprises, it probably won't take that much to release. And so by then, they will stop when they release PHP 7.0, they'll stop releasing newer versions of PHP 5.4.

Use mysql_* functions in PHP 5.5 or later when the mysql extension is not available (4:44)

Arturs Sosins: Actually, a little maybe off topic about PHP versions, I got some complaints from my friends, colleagues, who develop Web sites for a long time. Their older web site developed are not working anymore, and mostly because servers are upgrading to PHP 5.5, and they don't use MySQL extension anymore. My point is that all servers are actually - at least shared servers - are upgrading to PHP 5.5.

Manuel Lemos: Yeah. Well, in reality, what they need to do is to switch to MySQLi.

Arturs Sosins: If you have not already.

Manuel Lemos: Yeah. Personally, I have a database abstraction library called Metabase that is also in PHP Classes, but I have been using... I developed it since probably 1999, and it has drivers. Sometime ago, a user asked me to support MySQLi, so I added the driver for that. The package has a unit test suite that effectively tests lots of features including some that require insert queries in the database.

There are some people that follow strict rule to not implement tests that access databases, but they use mock objects. But for this type of package, if I'm not testing the queries, what else am I going to test?

There isn't much to test there. So test everything, test transactions, test the conversion of the values that need to be escaped. So everything needs to work. Most of the test are processing it, executing queries to do that.

Arturs Sosins: Actually, there would be an interesting idea. I don't know, maybe PHP Classes already have the class that would write MySQLi API under MySQLi API, so somebody could just add the file, and their older projects could magically work or something like that.

Manuel Lemos: I think there is an innovative class that does exactly that.

Arturs Sosins: Yeah?

Manuel Lemos: If I'm not mistaken. We'll try to look at it very quickly, if the browser here responds, if I'm not asking too much. Let me check very quickly. I think there's a package that was nominated last year that does that.

Arturs Sosins: It would be a great temporary fix. Just write it to the project and let it work as it was, and then fix it later.

Manuel Lemos: Maybe I was dreaming, but I think there was something that would... Oh, no, it's not for MySQLi, but for PDO. So if you don't have MySQL, there is a package by Aziz Hussain. Let me share the screen here. I don't know if that's you're talking about. So it provides wrapper functions that use PDO to access MySQL databases.

I don't know if the example can show you. There was an example up here. OK, this is actually a package of 2013, so it's not even a new thing. Basically, you just include some classes in the beginning, and then it provides you the MySQL functions even if they are not enabled.

Arturs Sosins: OK, that's awesome. I will recommend that to my colleagues.

Manuel Lemos: Or maybe they should stop being lazy and move to MySQLi. Yes, there are some differences. It's not exactly...

Arturs Sosins: Not exactly adding the I in the end function, right?

Manuel Lemos: Exactly. That's not exactly the way it works, but it 's almost it for most cases.

Arturs Sosins: Who wants to dive into a ten-year or more project just to fix something like that? Come on.

Manuel Lemos: Yeah, it's probably lots of code to fix, but it doesn't matter. It doesn't help warning developers with years in advance that MySQL extension will be dropped?

Arturs Sosins: No, it doesn't help.

Manuel Lemos: It doesn't help because somebody has to pay for the maintenance work. Sometimes the companies that hire them to pay for the development of the project don't want to pay to do some maintenance work that will not add any features, any enhancements. But it has to be done, and since it costs money for the companies, sometimes they are tight on budgets and then they want to avoid it. And it's not just that, it will take them some time. So doing things like that will delay further the development.

Anyway, we were talking about the newer PHP versions. We already mentioned PHP 5.6, so let's move on. Well, actually, PHP 5.6.8. I think I mentioned that.

Arturs Sosins: Yeah.

Fix division by zero to throw exception (10:55)

Manuel Lemos: So let's move on to some other more specific topics. Some proposals here. Then, first, something that is not exactly a proposal. It's rather to make PHP server more consistent, and the idea is if you have a division by zero in PHP, currently, it emits a warning and carry on. So you divide the number by 0, the result shouldn't be anything useful.

So the idea is to turn this into exceptions. I think this is more consistent, now that we have also exceptions on the engine. I mean, the actually PHP code that has errors may throw exceptions. I don't know if division by zero could be considered engine exception.

Well, anyway, the idea is to have this feature changed, to make it more consistent. They also mentioned something that... I don't use this type of math, using the bit shifts. They're saying that you negative shifts should not be accepted... negative offsets for the shifts.

Arturs, do you ever bit shifts in your code?

Arturs Sosins: No, I don't think so.

Manuel Lemos: Yeah, sometimes, it's just... This is a practice that you need to probably do when you are programming in C because you need to have a number that has a bunch of bits that are flexed and you pack them all in a single variable. And sometimes, to determine the set bit that you want to turn or turn off, you need to use a bit mask.

Then, you use bit shift to create that mask. And what they're saying here is that apparently PHP accepts negative offsets. Bit shifts could be to the left or to the right, so if you want to shift to the right, you just use the right operator. You don't need to have negative offsets, unless you have some weird logic on your applications.

Anyway, at least the division by zero makes sense to fix, make it an exception. So PHP can use catch statements to also catch this eventual bugs that cause divisions by 0.

Static Class Constructor (14:10)

Manuel Lemos: OK, now, let's talk about another topic which is more about a new proposal targeted to PHP 7.X... so PHP 7.1, .2, or whatever... I think for the future.

This is still a proposal, and this proposal is to have static class constructors. So, there's an introduction here. It talks about currently how it works in general. When you make static calls, you don't create objects. You just call the class directly, but maybe in some phases, you may need to initialize some code. The proposal here is to have something like, I think it is __static().

So you would have this function where you initialize properties, and this function if present, it will be called on the first call to either the object constructor or any public or private protective static method. So the idea is to do something suitable for your application that makes sense to initialize something related with static properties or so.

Arturs Sosins: Yeah, at first, I thought that it actually, well, does not really make sense. If you need some state variables, then you could add them in the class and then use it. But if you look at the way that class, for example, need to initialize the variables from database, then yeah, it would be much easier to have a static constructor other than call init() function somewhere in the beginning and then use it later. It would be more handy that's way.

I'm just not sure why static would also be called on object constructor because if you're using constructor, you're initializing an object that won't be static anymore. So why use it as object constructor there?

Manuel Lemos: Well, I don't know. Maybe when you use the class without static calls, maybe you may have some static properties inside that you need to initialize for some reason.

Arturs Sosins: OK, makes sense.

Manuel Lemos: Well, I don't know. That's the only thing that comes to my mind about this.

PHP RFC Watch site (17:00)

Manuel Lemos: OK, so let's move on now with the next topic. One which we comment about a site that was created. It was already sometime ago, but since we have so many topics in the past episode, we have decided to postpone this, but it is interesting.

We are always talking about proposals, RFCs, and so. Here is a site, I think it was created by Benjamin Eberlei, if I'm not making any mistake telling his name. Anyway, it's called PHP RFC Watch.

The idea is to list the activity around RFC proposals. You can see the latest votes on the left and on the right, you can see how it is going, the votes of certain proposals.

This is interesting, although, I think it could be better, for instance, if I want to know what are the latest proposals. I don't need to know all the votes that happened. I just want to know about these proposals, either that were submitted or are being voted.

Arturs Sosins: Yeah, basically, I would want to switch both those fields and make the RFC's field bigger, and who voted for what smaller, like a feed on the side.

Manuel Lemos: Yeah, it will be interesting to at least have some user interface buttons to see just what you want to see.

Arturs Sosins: Yeah, or other filter.

Manuel Lemos: Yeah, but this is a new project and was done by voluntaries. It is on GitHub. If you want to help make it better, there is a link here, a button or ribbon or whatever. This is all to fork the project on GitHub so you can submit patches.

Arturs Sosins: Yeah, I think it was basically was meant a little different than they want to use it. It was meant more like an Twitter feed for what's happening, what would open, what would close in the timeline.

Manuel Lemos: Well, exactly. I don't know, I was trying to refresh the page here to see. But it seems the last vote is seven days ago. I don't know if this site is stalled, or there were really no votes after that. I don't know, maybe it is just like that because there are no more proposals for PHP 7.0 to be voted.

Arturs Sosins: If we go click on Improved Error Callback Mechanism, then it says that voting... It doesn't say anything. I couldn't find anything.

Manuel Lemos: Well, this proposal...

Arturs Sosins: Voting. Status is voting. So nobody voted yet. There are 11 people voted, and there are 1, 2, 3, 4, 5, 6, 7, then 11 there. So yeah, nobody for this. So no activity for the past seven days on the voting also.

Manuel Lemos: Yeah. I don't know, this is just... It's an interesting project that could better, but if anybody wants to help to make it better, just fork it on GitHub and submit patches, I think. The author put it there because he's open to contributions.

Arturs Sosins: Yup.

PHP RFC (not) Voting App (20:51)

Manuel Lemos: OK, now moving on to another topic which is a curious one. There is this supposedly mobile app that was created. I don't know, I'm trying to share the video here. Can you listen?

Arturs Sosins: No, I don't hear anything.

Manuel Lemos: I think I can share the screen but not...

Arturs Sosins: The sound.

Manuel Lemos: Yeah. Is it maximized?

Arturs Sosins: Yup.

Manuel Lemos: Yup. Well, if you are not listening what the guy is saying. Basically, this is Jeremy Mikola, a contributor of PHP, and he is coming with an app that allows you to vote on RFCs just swiping on the mobile application. So, the only small detail is that this application was released on April 1st.

Arturs Sosins: That raises a flag, red flag.

Manuel Lemos: Yeah, and you can't find this application anywhere.

Arturs Sosins: But it's probably meant only for PHP Internals, that's why you can find it.

Manuel Lemos: And another detail is that the guy is smiling when he's presenting the proposal. It was...

Arturs Sosins: I actually read Reddit thread on this one. There was an interesting comment. Let me quote it, "I can see the potential as a dating app. You meet only people who agree on the same RFCs. No more awkward scalar types debate on first date!"

Manuel Lemos: Yeah, exactly. That would be funny. Well, anyway, this is just a curiosity because now, on this month, we don't have as many topics to talk about, so I thought it wouldn't hurt to comment about this joke application. If you do not find this application anywhere, it's because it doesn't exist, so you cannot vote with a swipe on RFCs.

Have Your PHP Book Reviewed (23:07)

Manuel Lemos: Anyway, let's move on to another topic. This one is more related to PHP Classes, but also with the PHP community in general. So let me share the screen here about an article that I wrote to tell people about this.

First, let me share the screen here. So the article is Have Your PHP Book Reviewed. It was published recently these days, because there are a couple of initiatives that the PHP Classes are sort of reviving. They are not new. They are just being revived. The first is to have more new book reviews on the Book Reviews section of the PHP Classes site.

So the idea is to encourage authors that have books that have released, and then they need some exposure to make review copies available to potential books reviewers. The reason for this is that... Well, I don't know if you have ever written book. Did you publish any book?

Arturs Sosins: Yeah. But not for PHP. It's for Lua.

Manuel Lemos: OK, did you get rich?

Arturs Sosins: Almost.

Manuel Lemos: Almost means you need to write a lot of more books.

Arturs Sosins: Yeah, like a million more books, and I'll get there.

Manuel Lemos: Yeah, exactly. The problem is that we are developers. We are not marketers. And nowadays, publishers don't have a great budget to invest on specific books unless they are really, really potential bestsellers. So it's basically up to the author to find ways to promote his book in as many places as he can.

So, I thought it would also be useful to take advantage of this section of PHP Classes site that can list books to be reviewed. This section was implemented many years ago. There were some books listed there and reviewed some years ago, but since the idea was to get some additional revenue from affiliate commissions, it didn't work well because it's not easy to get this money from affiliate commission, so I ended up not publishing much books there.

Arturs Sosins: I actually forgot that PHP Classes actually has this functionality. I was always so concentrated on classes that it kind of slipped my mind that, yeah, you could actually review books there.

Manuel Lemos: Yeah, it's a very old function of the site. So since it would not pay for me to publish book reviews, I thought, well, maybe if there is some other people that want to review the books, then I could make it open to find reviewers for the books that writers would like to get greater exposure.

So the idea is to bring books to book reviewers, so the books get decent exposure. So the article lets authors know how they can get their book reviewed. As a matter of fact, there are several books being reviewed right now, and the reviews will probably be released next week or so.

Arturs Sosins: We also contacted publishers like Packt and APress because they are looking for reviewers a lot.

Manuel Lemos: Yes, actually because of the Innovation Award, we already contacted Packt and O'Reilly. Depending on the books that the reviewers may be interested to review, I can also contact others.

Recently, I got a contact from an author that has published a book on LeanPub, and we already found a reviewer for him, so it is just a matter of getting the book for review and have it published.

Anyway, this site will try to encourage reviewers to approach, so they can get some compensation, which can be in form of getting free review copies, even printed version ones in some places. There are some publishers that give away free printed versions like Packt. Others not so much because it's also expensive for them to send printed versions. But you can always try to ask the publishers to get the eventual printed version, if they are important because many users do not want printed versions anymore.

Another type of compensation is to pay a monetary amount, to be agreed. The PHP Classes would pay that amount and that amount is funded using revenue from advertising. If possible, that can also be complemented with affiliate commissions, but since we don't know if they will work well these days, it probably depends on the interest of the book, the site is not depending on having affiliate commissions revenue to provide monetary compensation.

So this is one thing that will hopefully attract more reviewers because reviewing your book also takes time. It's not like just you are having fun reading the book. Producing the actual review will also take time. So if you are interested to become a reviewer, you should contact the site. Send an email message to express your interest.

You must be qualified enough to make a review. You should be able to write in English correctly. You need not be perfect because the review itself will be reviewed before being published, so any mistakes will be fixed. So that's not a problem. You don't have to write perfect English. You just need to be available to write the reviews.

If it is all right, you, as a reviewer get the review copy, and you have some time to produce that review. Well, producing the review is not hard, because you just need to write a small text that...

Arturs Sosins: You need to read the book first.

Manuel Lemos: Exactly. I mean to write the actual review is relatively simple. You just need to cover the topics that the book is about, tell a bit about those topics, so the people that will be reading the review understand the importance of the topics. Then, you express your opinion about the quality of the books recommending it, the book, if you found it interesting.

So we'll tend to review books that are potentially that are potentially very interesting, so most of the reviews will present recommendations for people to get the book if it makes sense for them. Well, that is that simple.

Another thing that I also mentioned in this article is that starting a few weeks ago, the site started accepting tutorial articles that are published on the site's blog. They are more in depth articles. They are not like reviews that probably will only have a few paragraphs. Tutorial articles are more in-depth.

We have been talking about a few that are already published. And for this, if you are to write nice tutorial articles, PHP Classes also pays a monetary amount to be agreed.

If you want to publish a tutorial article, the site can send you an invitation. But these invitations for writing tutorial articles currently are restricted to contributors of the site. For instance, people that already have submitted packages, because that will help to verify that you are qualified enough to talk about the topics.

So if you are a contributor, you probably have already received an invitation. Arturs, did you get your invitation?

Arturs Sosins: Yeah, I think so. I got the email.

Manuel Lemos: So if you have time and interest to write about interesting topics related with PHP or Web development in general... it doesn't need to be PHP, could be something about JavaScript for instance or mobile development or something like that... if you would like to write those articles, you get an invitation, and the invitation will show you a URL where you can submit a proposal.

And there are already two articles being proposed, and they will be written and approved in the next weeks. Some were already approved and published.

Finally, in this article, I wanted to mention that the site also publishes sponsored articles about commercial products. As you may have noticed some occasional sponsors that post articles on the site. In this case, these articles are paid. There is a fee. If you contact the site, I'll let you know about the details.

Because there are sponsors that do not just want to sponsor an article. They also want to sponsor the podcast so they can be mentioned. Like in last month, we comment about the HipChat application, and that was sponsored participation.

If you are interested, you can contact the site so you can be aware of the terms and conditions and timelines. Hopefully, you get great exposure to your company.

I know there are couple sponsors that we already schedule participations. Not this month, but I think probably next month, we already have some participation.

Fix the AJAX Requests that Make PHP Take Too Long to Respond (35:51)

Manuel Lemos: So, now, back to the actual articles of the site that we have been publishing. First, there is an article, an interesting article. This one by Eslam Mahmoud.

I'm going to share the screen here.

This article is talking about an interesting problem that maybe you already experienced, but you couldn't figure what it was and just let it go just like that, which is basically due to a matter of sending AJAX requests from your site Web pages. If you use PHP sessions, you may have experienced some delays in responding to those pages.

So Eslam Mahmoud has written this article to talk about this problem, which is basically caused, as he mentioned here in the Cause section about by the fact that when he use the default PHP sessions which are implemented files, they cause locks. Those locks may hold simultaneously requests for a bit, and then, when locks are released... Well, when the scripts exits, the locks are released, and then all AJAX requests tend to respond at once.

So, understanding this problem, he suggested that the solution is to use the session_write_close() function which is a function that will implicitly unlock the sessions.

This is an interesting article. Many people have commented actually below, and including some people proposed that instead of using the default session and in files to store the sessions in databases.

Well, to do it right, database session analysts should use transactions. So, if you have simultaneous accesses to set a single page, one access would not make the information on the database inconsistent. So, it is the same problem.

The reason why some people are telling to use databases, that's because they don't use transactions. And this is bad because, well, at least for highly concurrent applications that have many simultaneous request, you could be having problems because some accesses may be changing information that you are showing, and thus inconsistent.

Anyway, this is an interesting article. Regardless whether you use files or databases, the solution here is to use the session_write_close() function to address this problem.

Arturs, did you ever experience this problem? Or if you experienced it, you were not aware?

Arturs Sosins: I don't think that I did because, well, if you're not using AJAX, you're just sending single HTTP request on each page they view, and it responds an unlock the session file, so there is no actual problem.

For AJAX, there is a problem because there could be simultaneous HTTP requests from the same user that uses the same session file. But once I start using AJAX, I also moved to Node.js, so I didn't have that problem.

But, yeah, the bottom line here is don't shoot session files in productions, and though large volume of traffic Web sites. And even if you are not using them, still be aware of the problem that when you are using sessions, that for the same user, it will lock something up, and you would need to find a way around it.

Manuel Lemos: Yeah, well, the main problem using files is not so much about the locking. It's more about that files are not suitable for restricted environments on which you have multiple servers. And if you want access session data, you have multiple servers storing files which are local to each server, changes is done one request may not be seen on changes on sessions and other requests that would survive within the server.

Arturs Sosins: Basically, if you're using load balancer that will might redirect you to one server or another server based on the load, if you have different values.

Manuel Lemos: So, ideally, you probably use something more suitable. It could be databases, but sometimes databases for this purpose are slow. It could use memcache or some other distributed memory system that makes things faster, they take more memory, but at least they are faster and they are more suitable for environments with load balancing.

Arturs Sosins: I never actually liked session implementation, not in PHP, but generally, you can achieve an HTTP request. So it kind of seem wrong to me, but there is no better way we could do it.

Manuel Lemos: I think this session thing started because ASP provided sessions, and many years ago, somebody decided, "Oh, we are not going to lose because ASP have sessions we don't." So, somebody implemented sessions like this. But, fortunately, in PHP, you can have session handlers. There are several session handler classes in PHP that allows you to store and retrieve session data from other types of storage, not just local files.

Well, anyway, this article is more about the session locking problem caused implicitly when you start the session. So, now that you are more aware of this problem, maybe you have a solution to fix an issue that you have.

PHP IPC with Daemon Service using Message Queues, Shared Memory and Semaphores (42:46)

Manuel Lemos: OK, now moving on to another article, this time, written by Dmitry Mamontov. Actually, he has written an article in the past month about PHP daemons, creating daemon applications that stay there running at all times and probably monitoring some information of processing requests. This time, it's a sort of continuation of that article because it tells more how you can implement communication between processes.

Processes are just instances of your program that are running on memory so that interprocess communication could read between, for instance, a live script or a console script that wants to send a command to a daemon. So using this interprocess communication method that he mentions in the article, you can actually send commands to a daemon that is running.

It can also be used to communicate between multiple instances of a daemon program that is running. Sometimes, daemons need to start multiple processes just to handle information faster. And then you need to communicate between master processes and child processes, and you use it to process communication methods, to communicate between those instances.

So, what are these process communication methods? Well, this article is geared towards mainly UNIX-like environments, like Linux or others. So it talks about resources available only on this environment. For instance, he's not talking about how it would go in Windows. If you are on Windows environment, you probably have other interprocess communication methods that are not mentioned in this article.

So first, he talks about Message Queues, which are available on UNIX systems that have System V IPC Messages Queues. And then, he shows some code how we can queue messages, how they would be handled and received. But this, as Dmitry recommends, message queues are just for small messages.

For larger messages, he recommends using Shared Memory. Shared Memories are just blocks of memory that you can allocate and have some access keys. Other process can also access that Shared Memory blocks, so you can exchange using Shared Memory.

And this, he mentions that it would be more suitable for actions in large amounts of data. But since accessing Shared Memory needs to be done consistently so you don't have two processes accessing the same Shared Memory blocks and changing it at the same time, you need to use Semaphores.

Semaphores are just the way to block the access of one process, access for instance Shared Memory while other is doing some work function for that Shared Memory.

So this is basically what this article is about. It's a bit in-depth. It's a bit technical, but I think it is very interesting. For those that were not familiar with this interprocess communication methods, I think they will appreciate the knowledge that Dmitry has shared here... not only on this article, but also in the previous one about PHP Daemons.

Arturs Sosins: Basically, when I read the previous articles, I was OK, you can do that. But why? Now, after reading this article I'm OK, he'd open so much possibilities what you can do with it, but I still have question why, especially, as a Web developer who primarily use PHP for Web page backends. Then, this is completely other usage, I think maybe developers and visitors of the site would also ask the same question.

So it would be great if Dmitry could provide a follow-up article and just blow our minds with different ways that you can achieve with such implementations.

Manuel Lemos: Yeah, that could be interesting. I don't know if he has time but definitely, I will pass him this suggestion. I think articles were already written some time. Probably, they are written in Russian, as he's from Russia. But I'll definitely ask him if he has any articles that can follow up talking about this.

JavaScript Innovation Award Winners of February 2015 (48:16)

Manuel Lemos: So now, we are going to move on with the Innovation Award winners, this time starting with the JavaScript Innovation Award. We'll be talking about the nominees of February, so packages that were posted in February, then in March they were voted, and then in April, the results came out. So now, we can talk about them.

And for JavaScript, we started getting more packages fortunately. As I've mentioned before, there has been a growth in submissions and this month, we had three nominees. Since the first one is written by Arturs Sosins himself, Arturs, would you like to start and talk about your package.

Sure. Let me just switch window. So, basically, what this JavaScript component does, it allows you to control your TVs, different TVs that are listed like Philips or LG from your browser. For why such class? I can answer that. I worked on another third-party project, which stands for Make Your Magic, where we develop magic band controller to control different devices, and my objective is to integrate it with third-party services.

So I started with TVs, and interesting fact that they all share the same environment that you could all do in JavaScript. And I thought, why don't let's create such class? So basically here it is, and probably, I can't show any demo or anything right now. My TVs are off, but you can select TVs, and then it would query what keys it could send or send a text and you could do it from your browser, if your TV supports it. LG, Sony, NetCast, and Philips to be with JointSpace API, which I think all the newest TV have.

Manuel Lemos: Yeah, I think I found it very curious and innovative because I have never seen anything like this before. I didn't know you could control a TV from your network. I suppose TVs have Web servers to accept those request, right?

Arturs Sosins: Yeah. You can discover old TV using UPnP. Unfortunately, you can't do in browser. That's why you need to set IP address directly. But then, yeah, they are controlled either REST APIs or WebSockets service, stuff like that.

Manuel Lemos: So you don't have any means to discover the IP address automatically. You need to see where it is manually.

Arturs Sosins: Yeah, because HTTP request can't send this M-SEARCH header to make UPnP device respond. And even if they respond, they can't receive it. Basically, there are lots of problem in communication, but all others is possible.

Manuel Lemos: Yeah, well, it was very interesting.

And on my behalf, I also would like to comment about the other two packages. The first one is from Ovidiu Bokar from United Kingdom. He created a simple package that can help you to put links to share webpages on social media pages. And this package that's what it does, and it uses the Bootstrap library to show some nice items near those links.

It's a very simple package, but still innovative compared to what you have on site. So congratulations for Ovidiu Bokar, and he picked a downloadable book by O'Reilly.

The other package that I want to comment, this one is not trivial to understand. It is a package by Jason Gerfen from the United States. He has been a nice contributor with several nominated packages.

What it provides is a package that uses Node.js to monitor the activity of, for instance, a group of servers. So it connects to those servers via SSH, and it monitors the changes on log files and brings the content of those log files to a central server.

So, that's basically what it does, and Jason sent a package for this. We don't have many Node.js packages, so they are always welcome here because Node.js is reasonably popular. So I encourage everybody else to send more innovative packages based on Node.js as well.

JavaScript Innovation Award Rankings of 2015 (54:02)

Manuel Lemos: Now, regarding the Innovation Award of 2015, actually these rankings already considered packages published on I would say March, right?

And given that, we have here in the first place, Suresh Kumar from India with two packages and seven points, Andras Toth with two packages and four points. Then, Arturs comes with one package and three points, then Ryan Silalahi (one package and three points), then Ovidiu Bokar (one package and two points), and then, Jason Gerfen with one package and one point.

By country, the ranking is more or less...

Arturs Sosins: Basically the same.

Manuel Lemos: Basically the same because we still have few packages. It's basically the same countries. So you have India, Hungary, Latvia, Indonesia, United Kingdom, and United States by this order, with the same points and packages that we mentioned before because there is practically one author per country that is listed that submit the packages.

Well, next month, since we have more packages being nominated, this will become more interesting.

PHP Innovation Award Winners of February 2015 (55:35)

Manuel Lemos: Now, we are going to talk about the Innovation Award PHP Classes that is more competitive as many more authors are participating. Arturs, would you like to start talking about your preferred nominees of February, 2015?

Arturs Sosins: Yeah, let me zoom it right.

So the first class I would want to mention is PHP Native Mobile App Dispatcher by André Liechti from Switzerland. And what it does is that you could provide links to your apps for different platforms, and then when the user visits the Web site, it determines your platform based on user agent and displays the proper link, so you could suggest to use native app instead of your website.

Manuel Lemos: It's very, very interesting because it addresses a problem that until you develop your own mobile application, you don't know how to solve. Which is, for instance, if you have a website, but you also a mobile application that provides a better user experience, you could redirect the user but the user needs to go to the actual page to install that package.

Depending on the device that you have, you need to go to the right page. Also, it needs to compute the sort of one-time password parameters to send you to those pages of the applications.

So this is very interesting. I even have mentioned this class in the article that I talked about adapting your Web sites to mobile. If you're going to develop an application, you could use this package to redirect the user to the right page to install the applications from your device.

Arturs Sosins: And André got one copy of the Zend Studio for this package.

The next one I wanted to comment is FusionCharts PHP Class by Lucas de Oliveira from Brazil. And probably lots of PHP developers that are backend developers don't really like to wrangle with the frontend code, then this class provides all that you need to generate charts using FusionCharts API, which will generate the code to use. And the usage seem to be quite simple. As you see, you just take the class and provide user data. So that's why I like it.

Lucas got one downloadable copy of PHP ED Professional for this class. I think you're on mute. So again, yeah, let's just...

Manuel Lemos: Sorry. I think on my behalf I also have several packages to talk about. I'm going to start precisely by this one. This is PHP DNSSEC Library which is a package that deals with DNSSEC, which is a standard... My mouse is behaving by himself, I don't know why.

Arturs Sosins: It's just a smart mouse.

Manuel Lemos: Yeah, not very smart. Anyway, this is a package that is interesting because it does something that is advanced that deals with the DNSSEC standard for dealing with public and private keys to create records, calculate values. If you know about DNSSEC, you'll find this package useful, so you don't have to do it by yourself. But this is for people that deal with the network configuration using DNS.

And this is a package by Jan Altensen from Germany, and for this package, he has chosen a downloadable copy of Komodo IDE.

Another package that I wanted to comment, this one by Till Wehowski from Germany as well. He has a package that is called aSQL CLI. This is basically to parse the command line arguments, which is something that many packages do, but he also does the opposite. He can reveal the user interface configuration... I mean, the user command line string... so it allows you to parse an existing command line or add some parameters or remove or pass. So do something useful and then rewrite it, so you can eventually pass to another program that wanted to add it to the command line.

So this can be useful to implement wrappers around programs adding or removing some parameters.

Congratulations to Till for this package. It is interesting. For this, he picked a downloadable copy of Code Lobster Editor Professional.

PHP Innovation Award Rankings of 2015 (1:01:29)

Manuel Lemos: Anyway, now, we are going to talk about the Innovation Award rankings for 2015. As I mentioned, this is a more competitive ranking. So far, individually, André Liechti is leading with 2 packages and 16 points, followed by wapmorgan, 2 packages and 14 points, Vladimir Zurita with 1 package and 10 points, Xavier Perez with 1 package and 9 points, then Raskin Veniamin from Russia, also with the same package and points.

Then, Ruturaj Maniyar, also one package and one point from India, Nadir Latif from Pakistan, with one package and eight points, 7 Rafael Rodriguez (two packages and eight points), YoungHyeong Ryu from Korea with one package and eight points, Lucas de Oliveira from Brazil (one package and eight points).

So this ranking is evolving very quickly because there are many innovative packages being sent. This contributed for the Innovation Award ranking by country to be also more competitive.

So currently, Russia is leading with 3 packages and 23 points, followed by Switzerland with 2 packages and 16 points, then Brazil with 2 packages and 15 points, and then Germany 3 packages and 11 points, then Venezuela with 2 packages and 11 points, Chile (1 package and 10 points), India (2 packages and 10 points), Spain (1 package and 9 points), Pakistan (1 package and 8 points) and South Korea (1 package and 8 points).

So this year, it looks it would be very promising, especially because we've been having a growing number of innovative packages, just now in April. We have, I think, 16 nominees which is a lot. And which raise another challenge because there are not as many sponsors, so somebody will not get prizes. Well, we'll see.

Anyway, it's always great for people to participate and see them sending great packages, not just packages that do the same things. So the original intention of promoting the usual package for new purposes of the Innovation Award is working well. So I think this is great.

Conclusion (1:04:11)

Manuel Lemos: So with this, we practically ended this podcast. I also wanted to apologize to all authors that had been sending lots and lots of packages because I am still catching up on the queue of approving all of them. I'm doing the best I can, but lately I only have been able to approve two packages and there are 30 packages in the queue. Let's see if this goes well.

One thing that I can anticipate, I'm planning to work on a new feature on the site that will allow authors that have more urgency to have their packages to be approved sooner, so they can request priority as long as they have a certain reputation level. But this is something to be implemented in the next weeks, months. Let's see how it goes.

So with this, we practically ended this podcast. I'd like to thank you, Arturs, again for coming. And I hope to see you again next month.

So on my behalf, that is all for now. Bye.

Arturs Sosins: Bye.


You need to be a registered user or login to post a comment

1,615,527 PHP developers registered to the PHP Classes site.
Be One of Us!

Login Immediately with your account on:


3. Wrapoers for retrocompatibility - Gianluca Gimigliano (2016-03-15 20:29)
Useful libraries... - 0 replies
Read the whole comment and replies

2. PHP warned about Mysql years ago. - Jorge Castro (2015-05-19 22:15)
So its not excuse to still use it.... - 2 replies
Read the whole comment and replies

1. Moving from MySQL to MySQLi - Dave Smith (2015-05-18 06:38)
It is not as difficult as it may first sound... - 4 replies
Read the whole comment and replies

  Blog PHP Classes blog   RSS 1.0 feed RSS 2.0 feed   Blog Are You Ready for MyS...   Post a comment Post a comment   See comments See comments (9)   Trackbacks (0)