Hello I want to scan audio-video files and store their metadata in a database using php. I found this Command-line wrapper that uses TagLib.dll compiled by banshee developpers to do the job. It's works fine but it limited by the functions implemented. I want to access directly to the dll methods via PHP.
In PHP we have a function (DOTNET) that allows me to instantiate a class from a .Net assembly and call its methods and access its properties like this :
/*$obj = new DOTNET("assembly", "classname");*/
$stack = new DOTNET("mscorlib", "System.Collections.Stack");
$stack->Push(".Net");
$stack->Push("Hello ");
echo $stack->Pop() . $stack->Pop();
//Returns string(10) "Hello .Net";
Here is the Taglib# project sources in github
I saw many questions relatives to PHP-DLL-COM and there is some recommendations :
regsvr32
;;
;
DESCRIPTION "Simple COM object"
EXPORTS
DllGetClassObject PRIVATE
DllCanUnloadNow PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
My question is : How can I build the DLL and use its method via PHP ?
My config :
OS
Windows Server 2012 R2 Standard Edition i586
Apache :
Apache/2.2.21 (Win32) DAV/2 PHP/5.4.42 mod_ssl/2.2.21 OpenSSL/0.9.8r
PHP
PHP Version : 5.4.42
Arch : x86
Compiler : MSVC9 (Visual C++ 2008)
COM support : enabled
DCOM support : disabled
.Net support enabled
Microsoft Visual Studio 2013
Give the following steps a try:
Now that you have src\taglib-sharp.dll you need to register it into the global assembly cache in order for the DOTNET class to find it. See PHP DOTNET hell for details if you are not familiar with this.
If all is good, you can get yourself a copy of SharpZipLib, and reenter the HAVE_SHARPZIPLIB conditional compilation symbol --> rebuild --> redeploy to GAC --> and be a happy man! :)