Article
Interview - PHP's Creator, Rasmus Lerdorf
The Future of PHP
SP: Are there any plans for server-side, stateful variables in PHP? It would be useful to place instantiated objects in shared memory so that users didn't have to incur large overhead due to class instantiation.
RL: The Alternative PHP Cache (APC) project can already stick instantiated classes in shared memory, so that one has been solved by APC and others.
Personally I think if you really have performance issues, you should either simplify your code a bit or have a look at writing the critical parts in C. Extending PHP at the C level is actually much easier than most people think.
SP: Current 'session' variables use disk space (e.g. /tmp) which is no good for high-traffic sites. Are there plans to remedy this?
RL: Right from day one of the session support in PHP, we provided a shared memory backend session handler. Just set your handler to mm instead of files in php.ini. However, for high-traffic sites this is not the solution. The real solution is to load-balance the site across multiple servers.
Having session data in memory on a single machine doesn't solve anything. For this, you write yourself a session save handler and stick your session data into a central database of some sort. See http://php.net/session_set_save_handler.
SP: What about database connection pooling? Persistent connections are not nearly good enough - are there plans to implement connection pooling in the future?
RL: A pool of connections has to be owned by a single process. Since most people use the Apache Web server, which is a multi-process pre-forking server, there is simply no way that PHP can do this connection pooling. It has to be done by a dedicated standalone process and is quite outside the scope of PHP itself. Both SQLRelay and SRM can be used to solve this problem.
If/when the common architecture for PHP is a single-process multithreaded Web server, we might consider putting this functionality into PHP itself, but until that day it really doesn't make much sense. Even Apache 2 is still going to be a multi-process server with each process being able to carry multiple threads. So we could potentially have a pool of connections in each process.
SP: Are there plans to improve OOP? Users feel there should be less overhead in instantiating classes; and the provision of encapsulation so that they can keep member variables hidden (promotes better programming). Are there any plans to this effect in the pipeline?
RL: Yes.
SP: Sybase and MS SQL Server provide support for multiple result sets returned from SQL stored procedures. PHP does not support this! When can users expect it?
RL: When someone contributes the code to do it.
SP: Database queries are currently buffered in memory before being available to the client. Can PHP programmers expect this behaviour to change so that queries are available immediately as rows are being sent from the server, so they do not have to wait?
RL: When the various database API's support this, sure they can. We already support this with MySQL through the mysql_unbuffered_query() call and have for quite a while.
SP: ZendEngine2 has plans for a number of exciting new features, such as Exception handling and mature OOP support. Can you give us a rough estimate as to when PHP users can expect a release - at least in terms of months or years?
RL: Nope. It will be released when it is ready.
SP: Do you see a future in PHP-GTK, with popular desktop applications being written in PHP?
RL: I see PHP-GTK mainly being used in cases where you need to provide both a Web interface and a GUI interface to the same application. Being able to use the same backend code for both is a big win.
SP: Is development of PHP and Apache now running in parallel? And is it likely that the two projects will merge in some way, in the future?
RL: PHP and Apache have always been quite closely linked since they are both pieces of the puzzle that solves the Web problem. As such there are a number of developers who work on both projects. But no, the projects will definitely not merge. That wouldn't make much sense.
SP: Do you think major corporations will use PHP in their environments instead of J2EE and .NET in the future?
RL: Some do, so yes.