473,382 Members | 1,341 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 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 1755
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Fuzzyman | last post by:
Python 2.4 is built with Microsoft Visiual C++ 7. This means that it uses msvcr7.dll, which *isn't* a standard part of the windows operating system. This means that if you build a windows installer...
11
by: santosh | last post by:
Hello, I was going through the Marshal Cline's C++ FAQ-Lite. I have a doubt regarding section 33.10. Here he is declaring a pure virtual destructor in the base class. And again defining...
13
by: junky_fellow | last post by:
I have read certain articles that encourage to use/write pure functions (if possible) as they are better suited for optimization. I got one example that expalins how the code can be optimised....
8
by: Ted Miller | last post by:
Hi folks, I'm looking at moving a large base of C++ code to .Net under tight time constraints. The code runs in mission-critical environments, and I am extremely concerned about the loader lock...
6
by: pakis | last post by:
I am having a problem of pure virtual function call in my project. Can anyone explaine me the causes of pure virtual function calls other than calling a virtual function in base class? Thanks
10
by: John Goche | last post by:
Hello, page 202 of Symbian OS Explained by Jo Stichbury states "All virtual functions, public, protected or private, should be exported" then page 203 states "In the rare cases where a...
5
by: =?Utf-8?B?U2hhcm9u?= | last post by:
I have a class that is writen in unmanaged pure native C++. This class files (h and cpp) are inserted to a managed C++ (VC++ 2005, C++/CLI) DLL compoenet. This DLL compoenet is used in a C#...
6
by: Miguel Guedes | last post by:
Hello, I recently read an interview with Bjarne Stroustrup in which he says that pure abstract classes should *not* contain any data. However, I have found that at times situations are when it...
3
by: dragonslayer008 | last post by:
I am building a control library in C++/CLI. My project links with a native library and am getting an error that the library cannot work with pure: dxerr.lib(dxerr.obj) : fatal error LNK1313:...
14
by: Jack | last post by:
Hi, I meet a question with it , I did not get clear the different betteen them, for example: #include <iostream>
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.