title: Compile a third-party DLL to use in PHP
body: <p>I am trying to compile a third party library into a <code>dll</code> to use in <code>PHP5.6.31</code>. By following the php build directions <a href="https://wiki.php.net/internals/windows/stepbystepbuild" rel="nofollow noreferrer">here</a>, and the dll's <a href="http://lpsolve.sourceforge.net/5.5/" rel="nofollow noreferrer">reference guide</a> (select <em>'Using lpsolve from PHP'</em> from the index and scroll down to the compile section). This is what i did.  </p>
  
  <ol>
  <li>Downloaded the PHP source <code>php-5.6.31-src.zip</code> from <a href="https://windows.php.net/downloads/releases/archives/" rel="nofollow noreferrer">here</a>. </li>
  <li>Downloaded the binary tools <code>php-sdk-binary-tools-20110915.zip</code> from <a href="https://windows.php.net/downloads/php-sdk/" rel="nofollow noreferrer">here</a>.  </li>
  <li>Downloaded the php libraries <code>deps-5.6-vc11-x86.7z</code> from <a href="https://windows.php.net/downloads/php-sdk/" rel="nofollow noreferrer">here</a>.  </li>
  <li>Set up the build directory and extracted both the source files and the deps to this directory <code>C:\php-sdk\phpdev\vc11\x86\</code>. </li>
  <li>Downloaded <code>lp_solve_5.5.2.5_dev_win32.zip</code><a href="https://sourceforge.net/projects/lpsolve/files/lpsolve/5.5.2.5/" rel="nofollow noreferrer">here</a> and extracted them to <code>C:\lp_solve_5.5</code>.  </li>
  <li>Downloaded <code>lp_solve_5.5.2.5_PHP_source.tar.gz</code> <a href="https://sourceforge.net/projects/lpsolve/files/lpsolve/5.5.2.5/" rel="nofollow noreferrer">here</a> and extracted it, then from the extracted files copied this folder <code>lp_solve_5.5\extra\PHP</code> to <code>C:\php-sdk\phpdev\vc11\x86\php-5.6.31-src\ext\lp_solve_5.5</code>.   </li>
  <li>Opened <code>VS2012 x86 Native Tools Command Prompt</code> that came with Visual Studio 2012.  </li>
  <li>Ran <code>C:\php-sdk&gt;bin\phpsdk_setvars.bat</code> then <code>C:\php-sdk\phpdev\vc11\x86\php-5.6.31-src&gt;buildconf</code>.  </li>
  <li>Ran <code>C:\php-sdk\phpdev\vc11\x86\php-5.6.31-src&gt;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"</code>.  </li>
  <li>Ran <code>nmake php_phplpsolve55.dll</code> which created a dll named <code>php_phplpsolve55</code> in this directory <code>C:\php-sdk\phpdev\vc11\x86\php-5.6.31-src\Release_TS</code>.  </li>
  <li>I then copied <code>php_phplpsolve55</code> to my wampserver php extensions folder <code>C:\wamp\bin\php\php5.6.31\ext</code>.  </li>
  <li>Added this line to my <code>php.ini</code> file <code>extension=php_phplpsolve55.dll</code>.  </li>
  </ol>
  
  <p>Then I restarted Wampserver, but the <code>php_lpsolve55</code> extension does not show up in the loaded extensions. I checked the php_error log and this is the error.</p>
  
  <blockquote>
    <p>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</p>
  </blockquote>
  
  <p>Are there any other ways to troubleshoot this other than the php_error log?<br>
  From other posts I read maybe this is a compiler compatibility issue?  </p>
  
  <p>Here is my WampServer version.  </p>
  
  <blockquote>
    <p>WampServer version 3.1.0 - 32bit<br>
    Apache version: 2.4.27<br>
    PHP version: 5.6.31 </p>
  </blockquote>
  
  <p>And here are a few properties from <code>phpinfo()</code>  </p>
  
  <blockquote>
    <p>Compiler: MSVC11 (Visual C++ 2012)<br>
    PHP Extension Build: API20131226,TS,VC11<br>
    Thread Safety: enabled</p>
  </blockquote>
  
  <p>Note: I changed line 5 of <code>C:\php-sdk\phpdev\vc11\x86\php-5.6.31-src\ext\lp_solve_5.5\PHPmod.c</code> to <code>static zend_function_entry php_phplpsolve55_functions[] = {</code> I got this from this <a href="https://stackoverflow.com/questions/9688452/php-module-does-not-compile-does-not-recognize-static-function-entry#11632283">post</a>.</p>