473,511 Members | 15,715 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dynamically loadable php files

I have created a set of classes in PHP for internal use in the company.

Hence I don't explicitly want to "require" or "require_once" them
whenever required.

I want to make the library loadable on demand just like mysql or other
libraries in php. I want people to use the classes in my library
without "requiring" anything.

In a nutshell, I want to make my PHP library a .so file in Linux and a
..dll file in Windows.

How do I achieve this?

I currently need a solution for the following combination
Linux, Apache and PHP 5.0.4.

I also welcome a solution on Windows.

Thanks in advance
- Kishore

Sep 1 '05 #1
6 1227
Hi,

have a look @ the PHP - Manual of new Object model in PHP 5.x
here you could fine the method __autoload() this is exactly what u want :)

Have Fun ..

Wolfgang ..

ki*************@gmail.com wrote:
I have created a set of classes in PHP for internal use in the company.

Hence I don't explicitly want to "require" or "require_once" them
whenever required.

I want to make the library loadable on demand just like mysql or other
libraries in php. I want people to use the classes in my library
without "requiring" anything.

In a nutshell, I want to make my PHP library a .so file in Linux and a
.dll file in Windows.

How do I achieve this?

I currently need a solution for the following combination
Linux, Apache and PHP 5.0.4.

I also welcome a solution on Windows.

Thanks in advance
- Kishore

Sep 1 '05 #2
I see that __autoload in a global function.

My problem is where do it define the function.

I don't want to do it in the file where use a class.

- Kishore

Sep 1 '05 #3
Define it at the very top of your page. Once it's been defined, you
don't need to define it again. If you're lucky, you have some header
or something that already get's included at the top of every page, so
you could just add it there.

Sep 1 '05 #4
To avoid all this hassle, is there a way to create a .dll or a .so
file.

A file that I could put in the directory where the mysql and other
libraries reside.
So that I can call them just like any other pre-defined function or
class.

Sep 1 '05 #5
Sure you can.
You have just to write an PHP - Extension ..
Then you could it use as an PHP Function.
ki*************@gmail.com wrote:
To avoid all this hassle, is there a way to create a .dll or a .so
file.

A file that I could put in the directory where the mysql and other
libraries reside.
So that I can call them just like any other pre-defined function or
class.

Sep 1 '05 #6
NC
ki*************@gmail.com wrote:

I have created a set of classes in PHP for internal use in the company.

Hence I don't explicitly want to "require" or "require_once" them
whenever required.

I want to make the library loadable on demand just like mysql or other
libraries in php.
MySQL library usually is NOT loadable "on demand". It is loaded
at the server startup.
I want people to use the classes in my library without "requiring"
anything.
Then use the auto_prepend_file directive in php.ini. This way,
PHP will parse your file(s) every time it parses anything, and
your classes will be available to any PHP script on your server
without explicitly incluing/requiring them.
In a nutshell, I want to make my PHP library a .so file in Linux
and a .dll file in Windows.

How do I achieve this?


You can't. If you want to use the extension mechanism, you have to
write your extension in C.

Cheers,
NC

Sep 1 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
8184
by: Tony | last post by:
Hi, I have dynamically created a PDF document in memory as a FileOutputStream Now I have to get it into a DB2 table, storing it as a BLOB. The table has a document id, document name, some date...
5
1647
by: Sandeep Srinivasa | last post by:
hi, I have a software which has licensing (enabled through flexlm). Now, an end user can build apps (As loadable modules) using this base software. I am introducing a new feature, which I am...
1
2930
by: Frank Drebin | last post by:
In ASP, I have something like this: Set conn = Server.CreateObject("ADODB.Connection") Set cmd = Server.CreateObject("ADODB.Command") Set adoStream = Server.CreateObject("ADODB.Stream")...
0
771
by: DC | last post by:
Hi, I need a GridView with highly customizable column layouts. I think loading templates (from .ascx files) or making up classes that implement ITemplate would do. BUT: the templates must be...
0
7251
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7367
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
7430
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...
1
7089
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...
1
5072
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1581
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
790
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.