Q & A with Zend's founders

来源:互联网 发布:windows loader 下载 编辑:程序博客网 时间:2024/05/22 13:29

Andi Gutmans and Zeev Suraski founded the company that's trying to make a business out of PHP -- Zend Technologies Ltd. -- in 1999. In March of this year, their company released the Zend Optimizer, a freely downloadable tool for improving the speed of PHP scripts. Future plans include the Zend Cache and the Zend Compiler with planned released dates later this year for both products. The Zend Cache will store an intermediate coded version of a PHP application in memory. The Zend Compiler will allow code developers to compile their PHP applications into a binary format before distributing them.

Developers Gutmans and Suraski took some time from their jobs as Zend's co-CTOs to answer Linux Magazine's technical question about PHP. The two of them have been lead developers of the scripting language for over 5 years.

Linux Magazine: Aside from improving execution speed, are there any other changes to help scalability in PHP 4?

Andi Gutmans: In addition to increased speed performance, the memory requirements of PHP 4 have also been significantly reduced in comparison to version 3, thanks to several new mechanisms, most notably, the reference counting mechanism. An RPC server is being planned as a future middle layer that would enable several different PHP servers to access the same resources (e.g. database) seamlessly, but that won't be a part of version 4.0.

LM: What are the benefits of PHP 4 being thread-safe?

Zeev Suraski: PHP's thread safety means it can be used as a native server module inside multi-threaded servers, such as IIS, AOL Server and Zeus. With PHP 3, it wasn't practical to even think about supporting these servers, since as soon as more than one thread ran a PHP script, the two threads would have collided and brought on a crash. The thread safety issue is also extremely important for the Apache community, as Apache 2.0 is going to be a multithreaded server.

LM: Is the new session support in PHP 4 just a bundling of PHPLib with PHP, or have new features been added?

Gutmans: The new session support is a complete ground-up implementation of HTTP Sessions, written in C. It's not based on PHPlib, and is implemented at a low C-level without using PHP scripts.

LM: What were the motives behind changing the license between PHP 3 and PHP 4?

Suraski: There were several reasons. The main concern with the GPL was that commercial companies, such as IBM and others, avoid GPL'd code like the plague. The fact that the GPL is "contagious" discouraged many companies from putting effort into projects that are distributed under it. If we take a look at the few open source projects that IBM endorses, we would find Apache, Jakarta and PHP - none of which is released under the GPL, and we believe it is not a coincidence. These licenses are less restrictive, and we believe they work better in the real world. We also felt PHP was mature enough to let everyone use it, without having to ask for our permission, which is why the permission clause was dropped. Other than that, the license stayed pretty much the same.

LM: How do you think PHP performs on Linux versus Windows?

Suraski: The truth is we never conducted benchmarks using identical hardware, so we can't really tell. Judging by the experience of the MySQL guys, the Windows version would be slightly slower than the Unix version. If you compare PHP under Apache to PHP under IIS/ISAPI [Windows], though, there would probably be a noticeable speed difference, because under IIS, you have to use the thread-safe version of PHP, and under Apache, you don't. The thread-safe version of PHP is slightly slower.

LM: Is one platform more stable or more efficient for running PHP?

Suraski: All of the PHP Group members, ourselves included, feel much more comfortable with a server that runs Linux or Solaris, than one that runs Windows. Also, PHP's thread safety is a relatively new thing, and hasn't been through enough testing yet. Since under Windows, one is pretty much forced to use the thread-safe version of PHP, unless you want to run PHP as a CGI, I have to say that PHP under Windows is probably not as stable as PHP under Unix when used under a single-threaded server like Apache.

LM: Have you run any benchmarks to compare PHP to mod_perl with DBI?

Gutmans: No, we haven't, but we believe that some people on the MySQL mailing list have done so. PHP 4 was faster than mod_perl/DBI in this benchmark, but we can't say for sure that PHP is always faster. Generally, PHP 4 is extremely fast, and is usually at least as fast as Perl, and more often it's faster.

LM: Are there any efforts underway to make a common database API available? Perl/DBI, for example?

Gutmans: Yes. In the PHP Developers' Meeting, held in Tel Aviv last January we agreed that the database abstraction layer would be worked on for PHP 4. The database abstraction layer would be a part of PEAR [PHP Extension and Add-on Repository], and will be written in user-space (as a set of PHP scripts, and not using native C code). Stig Bakken is the the active guy in this story. He has already implemented most of the abstraction layer, as well as interface modules for MySQL, PostgreSQL and ODBC. PEAR is not expected to be at release-quality stage by the time PHP 4.0 is released.

LM: When will the PEAR repository be online?

Suraski: It's already online. It's a part of the PHP 4 CVS [you can find it under /pear]. Additional 'pyrotechnics' will be added as necessary in the future.

LM: Will the PEAR site encourage distribution of binary modules?

Suraski: PEAR is expected to include both text-scripts and binary modules, so it will encourage the concept of binary module distribution. It is too early to tell exactly how this would work.

LM: Will it be easier to write modules for PHP 4 than it was for PHP 3?

Gutmans: Not significantly. The API is very similar to that of PHP 3, even though it's a bit more uniform and clean. There are a few new services that will aid module authors in writing modules that deal with resources, for example SQL links or result sets, and we expect to enhance this new API as PHP 4 evolves.

In some aspects, writing a good PHP 4 module is a bit more demanding than writing a PHP 3 module, for two reasons. First, Zend [the PHP 4 engine] exposes a high performance API that is very similar to the PHP 3-compatible API, but gives a very significant performance boost; using this API is usually straightforward, but in some cases, it requires a deeper understanding of PHP and Zend. Second, a good PHP 4 module has to be thread-safe, so that it will work under all of the different PHP environments. Writing a thread-safe module is not difficult, thanks to the Thread Safe Resource Manager [TSRM] that we developed for PHP 4, but it does require a bit more effort.

LM: How much work is it to port a PHP 3 module to PHP 4?

Suraski: Usually not a lot of work. Several symbol names have changed, which should be a breeze to fix; If the module uses arrays or objects, the logic would have to be modified a bit, because PHP 4 uses reference-counted values, unlike PHP 3 (this conversion is a simple technical process, though). Finally, the developer has the opportunity to convert his module to the new, high-performance API, and/or make it also thread safe. I would say that an average database-module (such as the MySQL module for PHP), would take about 2 or 3 hours to convert from PHP 3 to PHP 4, including the switch to the high-performance API, and addition of thread safety. All in all - it's not bad at all.

LM: Is there a difference between PHP "modules" and "extensions"?

Gutmans: Not really. We use them interchangeably. The correct name we agreed on is extensions, but almost all of us got used to saying modules as well.

LM: How difficult will it be to write and build dynamically loadable modules?

Gutmans: In PHP 4 this issue has been thoroughly addressed. Generally, once the module works as a static module, PHP can do the job of building it as a dynamic module automatically. It does so using the GNU libtool. For the end user, this process becomes as simple as asking the configure program to build a certain module as shared.

LM: Will there be any sample modules included in the main distribution?

Suraski: Probably not at first stage, but the Group does plan to write a sample introductory module. Also, we consider the existing, in-production modules to be good real-world examples.

LM: Other than PHP, what else do you plan to use the Zend engine for?

Gutmans: Because Zend is a stand-alone component, we can use it in virtually any application in existence. Two names that came up in the past are MySQL and KDE. We discussed MySQL-integration with Michael Widenius and David Axmark during the PDM, and we plan to cooperate on introducing Zend into the MySQL database (as a stored procedure language) in the future. About KDE, several people asked us about this, and we said we'll be glad to answer their questions, but we're not sure where it stands today. There are plenty of other options open for this engine; We believe time will tell about this one.

LM: ASP supports VBScript, JavaScript and Perl. Do you see any demand for PHP or Zend to support languages other than PHP?

Suraski: I don't think so. If we end up writing new parsers for the Zend engine, it'll be possible to use it under PHP as well, but we believe most people are very happy with PHP's existing syntax.

LM: How long have you been writing code and how did you get started?

Gutmans: In junior high, I learned Basic & Pascal. I created some small DOS utilities and wrote a Huffman encoding compression program in Pascal. In high-school I took a course on Pascal and Data Structures. I only started writing C in my first year at university.

Suraski: I started coding at a relatively late stage when I started working in Netvision, during my university studies. I started programming in C++ in a Web and SQL environment, and later on I started using PHP/FI a bit, which eventually got me involved in the PHP project.

LM: Do you use an IDE to develop PHP or are you command-line users?

Zeev: We mostly use Visual C++ in order to develop PHP & Zend. However, we still do lots of coding on Linux, especially debugging with the command line gdb [GNU Debugger]. We usually use vi for editing on Linux.

LM: What OS do you use primarily for PHP/Zend development?

Suraski: Linux and Windows NT.

LM: Is the attitude towards open source software different in Israel than the U.S.?

Gutmans: We think open source software is more popular in the U.S. than in Israel, although we have been amazed at how many companies here are using the Linux/Apache/PHP combination.

原创粉丝点击