doupike2351 2018-04-05 02:24
浏览 125

编译要在PHP中使用的第三方DLL

I am trying to compile a third party library into a dll to use in PHP5.6.31. By following the php build directions here, and the dll's reference guide (select 'Using lpsolve from PHP' from the index and scroll down to the compile section). This is what i did.

  1. Downloaded the PHP source php-5.6.31-src.zip from here.
  2. Downloaded the binary tools php-sdk-binary-tools-20110915.zip from here.
  3. Downloaded the php libraries deps-5.6-vc11-x86.7z from here.
  4. Set up the build directory and extracted both the source files and the deps to this directory C:\php-sdk\phpdev\vc11\x86\.
  5. Downloaded lp_solve_5.5.2.5_dev_win32.ziphere and extracted them to C:\lp_solve_5.5.
  6. Downloaded lp_solve_5.5.2.5_PHP_source.tar.gz here and extracted it, then from the extracted files copied this folder lp_solve_5.5\extra\PHP to C:\php-sdk\phpdev\vc11\x86\php-5.6.31-src\ext\lp_solve_5.5.
  7. Opened VS2012 x86 Native Tools Command Prompt that came with Visual Studio 2012.
  8. Ran C:\php-sdk>bin\phpsdk_setvars.bat then C:\php-sdk\phpdev\vc11\x86\php-5.6.31-src>buildconf.
  9. Ran C:\php-sdk\phpdev\vc11\x86\php-5.6.31-src>cscript /nologo configure.js --without-xml --without-wddx --without-simplexml --without-dom --without-libxml --disable-zlib --without-sqlite3 --disable-odbc --disable-cgi --enable-cli --without-iconv --enable-phplpsolve55=shared --with-phplpsolve55path="C:\lp_solve_5.5".
  10. Ran nmake php_phplpsolve55.dll which created a dll named php_phplpsolve55 in this directory C:\php-sdk\phpdev\vc11\x86\php-5.6.31-src\Release_TS.
  11. I then copied php_phplpsolve55 to my wampserver php extensions folder C:\wamp\bin\php\php5.6.31\ext.
  12. Added this line to my php.ini file extension=php_phplpsolve55.dll.

Then I restarted Wampserver, but the php_lpsolve55 extension does not show up in the loaded extensions. I checked the php_error log and this is the error.

PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.6.31/ext/php_phplpsolve55.dll' - The specified module could not be found. in Unknown on line 0

Are there any other ways to troubleshoot this other than the php_error log?
From other posts I read maybe this is a compiler compatibility issue?

Here is my WampServer version.

WampServer version 3.1.0 - 32bit
Apache version: 2.4.27
PHP version: 5.6.31

And here are a few properties from phpinfo()

Compiler: MSVC11 (Visual C++ 2012)
PHP Extension Build: API20131226,TS,VC11
Thread Safety: enabled

Note: I changed line 5 of C:\php-sdk\phpdev\vc11\x86\php-5.6.31-src\ext\lp_solve_5.5\PHPmod.c to static zend_function_entry php_phplpsolve55_functions[] = { I got this from this post.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 西门子S7-Graph,S7-300,梯形图
    • ¥50 用易语言http 访问不了网页
    • ¥50 safari浏览器fetch提交数据后数据丢失问题
    • ¥15 matlab不知道怎么改,求解答!!
    • ¥15 永磁直线电机的电流环pi调不出来
    • ¥15 用stata实现聚类的代码
    • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
    • ¥20 docker里部署springboot项目,访问不到扬声器
    • ¥15 netty整合springboot之后自动重连失效
    • ¥15 悬赏!微信开发者工具报错,求帮改