Build php_perl.dll failing
I'm trying to build php_perl.dll and am getting errors, but my understanding of building these extensions is limited (obviously). So i need to get this compiled, or, alternatively, point me to a pre-built php_perl.dll that will work with PHP 5.2.17. The http://pecl4win.php.net site is dead, and what little i can find at http://pecl.php.net/package/perl isn't much help either.
I've installed Perl (tried 64bit then x86), PHP (installed with XAMPP), and Visual Studio 6. Windows 7 64bit. PERL_HOME set to c:\perl.
This command
msdev perl.dsp /MAKE "perl - Win32 Release_TS"
Results in 102 errors, like this:
--------------------Configuration: perl - Win32 Release_TS--------------------
Compiling...
php_perl.c
C:\Perl\lib\CORE\sys/socket.h(72) : error C2061: syntax error : identifier 'win32_accept'
C:\Perl\lib\CORE\sys/socket.h(72) : error C2059: syntax error : ';'
C:\Perl\lib\CORE\sys/socket.h(72) : error C2146: syntax error : missing ')' before identifier 's'
C:\Perl\lib\CORE\sys/socket.h(72)开发者_如何学编程 : error C2061: syntax error : identifier 's'
C:\Perl\lib\CORE\sys/socket.h(72) : error C2059: syntax error : ','
C:\Perl\lib\CORE\sys/socket.h(72) : error C2059: syntax error : ')'
...
C:\Perl\lib\CORE\sys/socket.h(98) : error C2059: syntax error : ')'
C:\Perl\lib\CORE\win32.h(420) : error C2079: 'Wservent' uses undefined struct 'servent'
C:\Perl\lib\CORE\iperlsys.h(1143) : error C2143: syntax error : missing ')' before '*'
C:\Perl\lib\CORE\iperlsys.h(1143) : fatal error C1003: error count exceeds 100; stopping compilation
Error executing cl.exe.
php_perl.dll - 102 error(s), 0 warning(s)
Any ideas on what i'm doing wrong?
No answer for this question?
I just resolved compilation errors for php 5.3.13 on Windows by slightly modifying the new 1.0.1 php_perl.c source code (line 31):
old:
# define _WINSOCK2API_ /* using winsock.h instead of winsock2.h */
new:
# ifndef _WINSOCK2API_
# include <winsock2.h>
# endif
For the compilation follow the tutorial from this page (http:/ /www.crazyws.fr/tutos/compiler-php-et-ses-extensions-sur-windows-SJ5GT.html), sorry for the french.
Basically install Visual Studio 2008 Express WITH SP1 (otherwise a build error occurs), then uninstall any 2008 Runtime, then install the Windows SDK 6.1 (2008 Server) to compile VC9 builds. I also used a Perl installation from ActiveState (version 5.8.0, ActivePerl-5.8.0.805-MSWin32-x86.msi, not tested with further versions).
Then download the php sdk and deps from http:/ /windows.php.net/downloads/php-sdk/, php sources, sources of extension from http:/ /pecl.php.net/package/perl, unzip directories as described in the tutorial, modify php_perl.c as above.
Then open the CMD shell of the Windows SDK and type:
setenv /xp /x86 /release
cd <root_directory>
bin\phpsdk_setvars.bat
cd <php_src>
buildconf --force
configure --help
configure --with-perl=shared --with-extra-includes="<perl_lib_CORE_directory>" --with-extra-libs="<perl_lib_CORE_directory>"
nmake php_perl.dll
I compiled my dll on windows 7 Pro 64-bit and tested it on my WampServer installation. The .phpt files in the sources of the extension are pretty self-explanatory on how to use it.
For info another version of the file is also available for php 5.4 on this github repo (https:/ /github.com/do-aki/php-ext-perl).
Sorry for the long answer, but the README file of the extension regarding installation on Windows is obsolete and there is no support which I found pretty lame.
Regards
精彩评论