473,397 Members | 1,961 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,397 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 1757
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>
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
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.