471,594 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,594 software developers and data experts.

pure PHP

Is there any initiative out there aiming to rewrite PHP
extensions in pure PHP ? For example, MySQL driver in
pure PHP or LDAP extension in pure PHP ?

With Java and, as far as I know, Perl, one can extend the
language capabilities without having access to any command
like gcc, g++, cc or c++ on a system.

That way applications could be written without need to bother
system administrator to install additional packages. All additional
functionality is avaliable with "include" command.

DG

Sep 14 '05 #1
6 1600
Drazen Gemic wrote:
Is there any initiative out there aiming to rewrite PHP
extensions in pure PHP ? For example, MySQL driver in
pure PHP or LDAP extension in pure PHP ?
I doubt it...
With Java and, as far as I know, Perl, one can extend the
language capabilities without having access to any command
like gcc, g++, cc or c++ on a system.


Things like database access libraries (and comms protocols like
sockets, cURL, etc. AFAIK) rely on platform-specific libraries
deep-down, so there's no way you could could replicate them in pure
PHP.

Things like GD (graphics) could be done, theoretically, but would be
*horrifically* inefficient.

The only ones that would ever be worth implementing would be "simple"
platform-independent things, like XML functions, tidy, diff.

--
Oli

Sep 14 '05 #2
On Wed, 14 Sep 2005 08:19:29 -0700, Oli Filth wrote:
Things like database access libraries (and comms protocols like
sockets, cURL, etc. AFAIK) rely on platform-specific libraries
deep-down, so there's no way you could could replicate them in pure
PHP.

I agree for basic things like sockets, but cURL functionality is something that
would be easy to write using existing socket library.

Database drivers rely on sockets most of the time. They are not very much
system specific. Besides network library(ies), most of the work is parsing
data streams.
Things like GD (graphics) could be done, theoretically, but would be
*horrifically* inefficient.


It does matter, but it does not have the highest priority.
Many PHP people argue about Java choice for enterprise
applications, but the main reason is ability to extend Java by just
dropping JAR files somewhere on the hard disk.

DG

Sep 14 '05 #3
Oli Filth wrote:
Drazen Gemic wrote:
Is there any initiative out there aiming to rewrite PHP
extensions in pure PHP ? For example, MySQL driver in
pure PHP or LDAP extension in pure PHP ?


Things like database access libraries (and comms protocols like
sockets, cURL, etc. AFAIK) rely on platform-specific libraries
deep-down, so there's no way you could could replicate them in pure
PHP.


Nonsense. Most of them can be replicated - in practice it's usually not
really worth the effort. I wrote a class to handle posts to pages - when I
benchmarked it was only slightly slower than using the curl extension
(about 30% slower). This replaced a method where the standalone curl
executable was invoked to carry out a post which was 800% slower.

PHP now has a range of process control functions - it does not have direct
access to the device ioctls you'd need for writing low level hardware
drivers but if you really wanted to do that there's not a lot to stop you
writing your own PECL.

It's interesting that a lot of people are now using PHP outside of
web-browsers 0 indeed, there's at least one web_server_ wirtten in PHP.

C.
Sep 14 '05 #4
Colin McKinnon said the following on 14/09/2005 20:35:
Oli Filth wrote:

Drazen Gemic wrote:
Is there any initiative out there aiming to rewrite PHP
extensions in pure PHP ? For example, MySQL driver in
pure PHP or LDAP extension in pure PHP ?
Things like database access libraries (and comms protocols like
sockets, cURL, etc. AFAIK) rely on platform-specific libraries
deep-down, so there's no way you could could replicate them in pure
PHP.

Nonsense. Most of them can be replicated - in practice it's usually not
really worth the effort.
I guess it depends how you interpret "pure PHP". I would hazard a guess
that with no extensions at all (i.e. literally just PHP language
constructs), then it's not possible, as cURL functionality etc. still
relies on sockets, which rely on low-level drivers.
PHP now has a range of process control functions - it does not have direct
access to the device ioctls you'd need for writing low level hardware
drivers but if you really wanted to do that there's not a lot to stop you
writing your own PECL.


Well, clearly, but that doesn't really fall in line with the OP's
original question about pure PHP functionality (i.e. not using
extensions), without involving any other languages, etc.
--
Oli
Sep 14 '05 #5
Colin McKinnon wrote:
PHP now has a range of process control functions - it does not have direct
access to the device ioctls you'd need for writing low level hardware
drivers but if you really wanted to do that there's not a lot to stop you
writing your own PECL.


Not a lot--except for the royal pain in the ass? PHP module really is
far more involving that it needs to be. Writing the code is easy,
provided that you know C. Getting the code to compile is hard, because
of all the cross dependency and funky macro. If someone would only make
the effort to make a better interface... Anyway, I'm way off topic.

Sep 15 '05 #6
On Wed, 14 Sep 2005 18:12:13 +0200, "Drazen Gemic" <he**@there.net>
wrote:
I agree for basic things like sockets, but cURL functionality is something that
would be easy to write using existing socket library.
cURL functionality isn't much needed anymore because of sockets -- but
in the past, PHP didn't do as well with sockets which is why the cURL
extension exists. If you can get by without it, then do so.
Database drivers rely on sockets most of the time. They are not very much
system specific. Besides network library(ies), most of the work is parsing
data streams.
PHP is a glue language -- most of it's functions are just slim
wrappers over existing libraries. That's really the point. While it
may be possible to write your own database driver for say MySQL it's
far easier and smarter to use the driver provided by the MySQL
developers.
Many PHP people argue about Java choice for enterprise
applications, but the main reason is ability to extend Java by just
dropping JAR files somewhere on the hard disk.


Well mostly it isn't hard to extend PHP by dropping the appropriate
library and extension somewhere on the hard disk.

Sep 16 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Fuzzyman | last post: by
11 posts views Thread by santosh | last post: by
13 posts views Thread by junky_fellow | last post: by
6 posts views Thread by pakis | last post: by
6 posts views Thread by Miguel Guedes | last post: by
3 posts views Thread by dragonslayer008 | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.