Jump to content
xisto Community
Sign in to follow this  
k_nitin_r

Php Interpreter/extension Development

Recommended Posts

Hi!I was wondering if anyone on the forum does C-programming with the PHP interpreter (I'm not sure if this thread should be categorized as C or as PHP... I'm sure on an IRC channel for C programming, they would redirect me to the PHP channel, and on the PHP channel, they would say, "You're off-topic. You should be on the C programming channel."). I like to think of it this way - if you were on the Habari channel/forum, you would talk about Habari core development too and not just the Habari plugins and themes, and they would not direct you back to the PHP programming channel/forum because it is a specific PHP project named Habari that you were dealing with.I have just downloaded the PHP source code (the source code for the PHP interpreter, not a bunch of .php/.inc files) along with the binary tools provided by PHP that consists of a hodge-podge. The binary tools archive contains command-line ZIP utilities, a CVS command line client (but not an SVN or GIT client!), Jam which is probably a clone of Make and is used for automating builds, Flex the lexical analyzer not to be confused with Adobe Flex, wget for downloading files off the web through command line or scripting, and the Bison parser generator. I guess the next step is to setup the development environment (I'm running Visual Studio 2010 and have to setup the binary tools provided by PHP) and get the PHP source code into a Visual Studio project.Right now, I'm hoping to create some PHP extensions but I would probably extend my work toward optimizing the source code that the PHP interpreter uses, wherever I can (most projects seem to have done this already and I doubt I can find much to do on the PHP source code itself).

Share this post


Link to post
Share on other sites

Remember this quote when you're after something in programming -'Make everything as simple as possible, but not simpler'. :P Now tell me what you are exactly trying to do with those extensions. What are these extensions and what you want with the interpreter. I got confused with those two paras so i got to get this straight in order to understand what you're trying to say. :DI'm not much into core module development of PHP so i'll learn something along if you follow up on this thread. I understood that you want to create extension using PHP interpreter while messing up with C. Now what exactly you want ? pointers ? or opinion from someone who is experienced in that before ? I guess truefusion is the only one who is experienced in this much level of php if i'm not wrong.

Share this post


Link to post
Share on other sites

Hi Mahesh!I haven't been able to get much of a response on the forums, so I thought this thread would fade away into obscurity too, but here's a reply!I have tried running WordPress, the content management system that was written in PHP and is all the rage all over the Internet, on the Apache web server and the problem that most system administrators complain about is the CPU usage that the PHP scripts cause. I have noticed a couple of hot spots in the code and I have been thinking about getting those sections of PHP code converted into PHP extensions such that they could perform better. Besides, writing the same bit of logic in C instead of PHP would result in much quicker code execution, while simultaneously reducing the memory footprint that WordPress would require, considering how PHP allocates the space of a few variables with the assumption that it could be an integer, a string, a float, a reference, or a value - all when you declare just one variable, so all of that takes up space when all you wanted is one little variable! I guess it has a trade-off in terms of being able to understand the source code of the PHP interpreter because using a struct would really help in figuring out what is supposed to go in there instead of having four different structures, each representing a different data type.So, anyway, as I go about optimizing through it, I was wondering if anyone else wanted to join in too. Programming is a lot more fun when it is done as a community than as a single developer. The lonesome traveller image may look cool in the movies for the audience, but it gets really really boring for the traveller... though with some terrible company, that lonesome-ness would start to look mighty satisfying (thinking of Ice Age and the weasel) :-PAnyway, if you would like to have a go at it, get a copy of Visual Studio and the source tarball of PHP 5.3.3 and the binary tools that are needed to build the source code for the PHP interpreter. You would have to extract the binary tools and use the Makefile-like utilities provided by it for the builds, but in the end all that you need is the DLL file so it does not really matter whether you use the tools provided for PHP development as long as you get to the end of a DLL that can be loaded by PHP as an extension, but it is easier when you do try going with what everyone else is using because that way you can get community support every step along the way if it does not turn out the way it is supposed to.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.