[PHP-DEV] Re: GD2 on Windows
Hi Sebastian, > Could some kind soul please provide me with the library to link > against and the required includes to compile the GD2 extension on > Windows? > > I already tried compiling GD2 from source, but failed, as well as > trying to link against the libary from the gnuwin32 project at sf.net. After 2 days of blood, sweat and tears, i've finally managed to build the gd2 library ( and friends ) on Windows. It took me so long because the Makefile for Windows, shipped with gd2, is really out of date. I have zipped the php-4.0.1/ext/gd directory and copied it to our ftp server. You can download it at ftp://ftp.muze.nl/pub/ariadne/win/iis/php-4.1.0/ The gd2.zip file contains the compiled php_gd.dll file plus all of the required libs and some changes in the vc6 workspaces. Hope this helps. Regards, Gijsbert te Riet. Muze. -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DEV] Re: PATH_INFO doesn't work -- resolution?
Hi Derick, > > can you resend that patch to php-dev? Ofcourse. The patch against the php-4.0.6 php4isapi.c is attached. If you would like to have a patch against the current CVS version then please let me know so i can make time to test it first. Please note that we weren't able to test this fix with other webservers than IIS. Regards, Gijsbert te Riet. Muze. --- php4isapi.c Fri Nov 30 12:33:52 2001 +++ isapi.fix Fri Nov 30 12:35:29 2001 @@ -17,6 +17,7 @@ +--+ */ + #ifdef PHP_WIN32 # include # include @@ -81,11 +82,13 @@ "CONTENT_LENGTH", "CONTENT_TYPE", "PATH_TRANSLATED", + "PATH_INFO", "QUERY_STRING", "REMOTE_ADDR", "REMOTE_HOST", "REMOTE_USER", "REQUEST_METHOD", + "REQUEST_URI", "SERVER_NAME", "SERVER_PORT", "SERVER_PROTOCOL", @@ -462,38 +465,73 @@ #endif +static char *sapi_isapi_get_server_var(LPEXTENSION_CONTROL_BLOCK lpECB, char +*varname, DWORD *buffer_len) { + char*buffer; + + buffer=emalloc(*buffer_len=ISAPI_SERVER_VAR_BUF_SIZE); + if (!lpECB->GetServerVariable(lpECB->ConnID, varname, buffer, buffer_len)) { + if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) { + + buffer = (char *) erealloc(buffer, *buffer_len); + if (!lpECB->GetServerVariable(lpECB->ConnID, varname, buffer, +buffer_len)) { + + efree(buffer); + buffer=0; + + } + + } else { + + efree(buffer); + buffer=0; + } + } + + return buffer; +} + static void sapi_isapi_register_server_variables2(char **server_variables, LPEXTENSION_CONTROL_BLOCK lpECB, zval *track_vars_array, char **recorded_values ELS_DC PLS_DC) { char **p=server_variables; - DWORD variable_len; - char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE]; + DWORD varsize, varbufsize; char *variable_buf; + char *var_buf1, *var_buf2; while (*p) { - variable_len = ISAPI_SERVER_VAR_BUF_SIZE; - if (lpECB->GetServerVariable(lpECB->ConnID, *p, static_variable_buf, &variable_len) - && static_variable_buf[0]) { - php_register_variable(*p, static_variable_buf, track_vars_array ELS_CC PLS_CC); - if (recorded_values) { - recorded_values[p-server_variables] = estrndup(static_variable_buf, variable_len); + + if (variable_buf=sapi_isapi_get_server_var(lpECB, *p, &varsize)) { + // translate PATH_INFO to Apache compatible PATH_INFO + if (strcmp(*p, "PATH_INFO") == 0) { + if (var_buf1=sapi_isapi_get_server_var(lpECB, +"SCRIPT_NAME", &varbufsize)) { + memmove(variable_buf, variable_buf + +strlen(var_buf1), strlen(variable_buf) - strlen(var_buf1) + 1); + efree(var_buf1); + } } - } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) { - variable_buf = (char *) emalloc(variable_len); - if (lpECB->GetServerVariable(lpECB->ConnID, *p, variable_buf, &variable_len) - && variable_buf[0]) { - php_register_variable(*p, variable_buf, track_vars_array ELS_CC PLS_CC); + + // translate PATH_TRANSLATED to Apache compatible +PATH_TRANSLATED + if (strcmp(*p, "PATH_TRANSLATED") == 0) { + if (var_buf1=sapi_isapi_get_server_var(lpECB, +"PATH_INFO", &varbufsize)) { + if (var_buf2=sapi_isapi_get_server_var(lpECB, +"SCRIPT_NAME", &varbufsize)) { + +variable_buf[strlen(variable_buf)-(strlen(var_buf1)-strlen(var_buf2))]='\0'; + efree(var_buf2); + } + efree(var_buf1); + } } + + php_register_variable(*p, variable_buf, track_vars_array +ELS_CC PLS_CC); if (recorded_values) { -
[PHP-DEV] Re: PATH_INFO doesn't work -- resolution?
Hi Albert James, > PROBLEM: > PHP seems to support this functionality on a UNIX server I run. A request > for http://www.foobar.com/hello.php/more/foobar/filename.html works > exactly as the above describes, stuffing "/more/foobar/filename.html" into > the $PATH_INFO php variable. > > However, the problem is that when the same code is moved to a production > server, it fails with a status code 500. A request for hello.php works > fine; a request for hello.php/ fails, as does hello.php/anything. I am > trying to find out if the prod. server is in fact Windows. We have a > workaround whereby we make the php a perl cgi and it works fine; i.e. > hello.cgi/anything runs fine, hello.php/anything yields a 500. > > HELP! > Can someone who is familiar with this component of PHP please let us know > if there are any specific configuratoin parameters that would affect the > way PHP resolves the target resource, or if this is a bug that was fixed > in a certain release? I did search and found many similar problems but no > answers. There is one relative post in the faqts, but it states PATH_INFO > doesn't work on Windows, which is clearly not true per above CGI > workaround. > We have also filed such an error report (back in April this year, bug id #7782). This is the same problem you have. It's due to IIS which doesn't really translate the PATH_TRANSLATED variable (it will pass php the actual script location + the extra PATH_INFO, so PHP cannot find the requested script on disk). We have made several patches to the php4isapi.dll to let PHP translate the request itself so it _can_ load the actual script with the correct PATH_INFO. This patch has been send to the PHP_DEV list (by the BUG-FORM) and a newer patch has been send to the maintainer of the php4isapi.dll, but for now they haven't been added to the php cvs. However, you can download the patched php4isapi.c file (for the php-4.0.6 release) and the compiled version (php4isapi.dll for php-4.0.6) from ftp://ftp.muze.nl/pub/ariadne/win/iis/php-4.0.6/. Regards, Gijsbert te Riet Muze. -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]