Page 1 of 1

How to install a php extension by .so file?

Posted: Wed May 12, 2010 3:42 pm
by leekis
Hi, everyone!
I need your help!

I'm working on a project that needs to develop a php extension for our clients.
The php extension is written by C/C++ and we have complied and installed it to our linux server for testing by using phpize and etc.

So I got a .so file and now we should deliver our product it to our clients, but the problem is that we can't give the source code to them for installing on their php server.
I googled a lot, but all the articls are about phpize&./configure&make&make install things by which needs the source code.

Can I just give the .so file which is complied on our server to our clients and then tell them just copy the .so file to the php exetension modules folder ,setup the php.ini file and then restart apache?
Does it work? Or some ideas?

Re: How to install a php extension by .so file?

Posted: Wed May 12, 2010 4:42 pm
by flying_circus
leekis wrote:Can I just give the .so file which is complied on our server to our clients and then tell them just copy the .so file to the php exetension modules folder ,setup the php.ini file and then restart apache?
Does it work? Or some ideas?
This should work just fine.

Re: How to install a php extension by .so file?

Posted: Wed May 12, 2010 4:48 pm
by AbraCadaver
flying_circus wrote:
leekis wrote:Can I just give the .so file which is complied on our server to our clients and then tell them just copy the .so file to the php exetension modules folder ,setup the php.ini file and then restart apache?
Does it work? Or some ideas?
This should work just fine.
Yes, so long as any libraries that your extension uses are also on the other server.

Re: How to install a php extension by .so file?

Posted: Wed May 12, 2010 6:38 pm
by leekis
I see! Thank you very much!!

Re: How to install a php extension by .so file?

Posted: Wed May 19, 2010 3:10 pm
by leekis
AbraCadaver wrote:
flying_circus wrote:
leekis wrote:Can I just give the .so file which is complied on our server to our clients and then tell them just copy the .so file to the php exetension modules folder ,setup the php.ini file and then restart apache?
Does it work? Or some ideas?
This should work just fine.
Yes, so long as any libraries that your extension uses are also on the other server.

Thanks for your replay!

I tried to copy the .so file to the php extension folder and use dl("abc.so") to load.
But it failed.

When I use "make" to compile the source on my machine, I found a file called "abc.la" created along with the "abc.so".
Do I have to do something with the "abc.la" file too???
Or do some "ldconfig" stuff after I copied the abc.so to the php extension folder???
By the way, the abc.so file needs a 3rd party library of linux program and that's installed at the same path on the client's server too.