Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 06-14-2008, 07:42 PM   #1
Registered: Mar 2004
Distribution: Ubuntu 8.04
Posts: 127

Rep: Reputation: 15
Question How can I use PHP to access shared library functions?


I've been looking around the internet for a while trying to find a way to access functions from (tracked music library) from inside of a PHP script. So far the only way I have found is to write a PHP extension with C, but that probably won't work for several reasons:

1.) I'm pretty sure I don't have permission to add extensions to my server's PHP extensions folder,
2.) I don't know how to write a PHP extension anyway.

Does anybody know how I can access the functions and data structures exported by, or any library for that matter?
Old 06-16-2008, 06:21 AM   #2
Senior Member
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
It would either have to be via a PHP extension or another (such as C) program that utilises the extension and then you can access it via the system call. I believe that you can load php extension dynamically via the dl() function (although it's not very safe having been depreciated)
Old 06-16-2008, 06:41 PM   #3
Registered: Mar 2004
Distribution: Ubuntu 8.04
Posts: 127

Original Poster
Rep: Reputation: 15
Yes, I was just looking at the PHP manual and discovered that if I wrote a small app to print out the data I need from the module files I could call that with passthru(). I suppose that would work...but it just seems kind of messy.

Anyway, thank you for your reply!
Old 08-11-2008, 07:28 AM   #4
LQ Newbie
Registered: Aug 2008
Posts: 1

Rep: Reputation: 0
Accessing SharedLibrary Functions from PHP (Linux)

Hi Everyone,

I am a newbie on PHP and need to know " How to call shared library functions from PHP".

Please anyone provide a step b y step process to mak eit possible.
Any help would be very useful.

Thank you,


library, php

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
LINUX - linking archive (static library) with shared (dynamic) library gurkama Programming 5 03-04-2007 11:11 PM
JAVA JNI program to access shared library sabliny Programming 3 11-17-2005 05:13 PM
Extracting Functions from a Shared Library TGWDNGHN Linux - Newbie 9 06-25-2005 01:48 PM
howto compile bin with my library using all-static and shared linked standart library stpg Programming 4 06-29-2004 04:20 AM
UnsatisfiedLinkError on JNI access to Shared Library Kavinjka Linux - Software 1 08-25-2003 06:08 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:52 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration