LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices



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

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


Hello,

I've been looking around the internet for a while trying to find a way to access functions from libmikmod.so (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 libmikmod.so, or any library for that matter?
 
Old 06-16-2008, 07:21 AM   #2
graemef
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, 07:41 PM   #3
TheMusicGuy
Member
 
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, 08:28 AM   #4
kguptalinux
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,
Kapil
 
  


Reply

Tags
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-05-2007 12:11 AM
JAVA JNI program to access shared library sabliny Programming 3 11-17-2005 06:13 PM
Extracting Functions from a Shared Library TGWDNGHN Linux - Newbie 9 06-25-2005 02:48 PM
howto compile bin with my library using all-static and shared linked standart library stpg Programming 4 06-29-2004 05:20 AM
UnsatisfiedLinkError on JNI access to Shared Library Kavinjka Linux - Software 1 08-25-2003 07:08 AM


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

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