[PHP] Re: [PDO] Re: [PHP] PDO working via Apache but not at the command line?
Things to check: - Environment: what env vars are set or not set in your Apache vs. CLI - Owner: are you running as the same user as your web server? - Do you or the web server have some kind of rc file that might impact how things run? Suggestion: Use sudo -u webserverusername -s to run a shell as your web server user, then try to run the CLI. Get the environment to match up with your webserver. If this still doesn't work, it might be something more esoteric; check to see if you have other apache modules loaded that might also use FreeTDS or ODBC and that might be messing with things. Use strace php db-dump.php to see what the CLI is up to. Use strace -p apachepid to see what the Apache version is up to (probably want to run apache -X to make this easier). --Wez. On Oct 18, 2010, at 5:26 PM, Scott Baker wrote: On 10/18/2010 02:17 PM, a...@ashleysheridan.co.uk wrote: It's most likely because both cli and web modules are using different php.ini config files. See what the output of a phpinfo() call in both browser and command line. I didn't even think about it parsing different php.ini files. Checking the output of phpinfo() I see it's calling the same php.ini (/usr/local/lib/php.ini) though. :( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: PHP, Windows and COM.
[Note: To/CC headers trimmed] // Create a VT_EMPTY value $empty = new VARIANT(); GoTo(wdGoToBookmark, $empty, $empty, BookmarkName); On Wed, 26 Feb 2003, Richard Quadling wrote: Hi Harald. The problem with some of the VBA functions is that the first and last parameter need to be set and the ones in the middle have no meaning and cannot be present. This can only be achieved by using named parameters. The GoTo method, as a function, in VBA would be ... GoTo(wdGoToBookmark,,,BookmarkName) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DEV] Terminal text objects (PHP CDK NCURSES)
This would be a nice thing to include in PECL (see http://pear.php.net). --Wez. On Wed, 8 Jan 2003, Nikolai Vladychevski wrote: Hello, I want to share the code (php-extension) I have included into php-4.2.2 to support CDK widgets (http://gd.tuwien.ac.at/hci/cdk/?file=cdk.tar.gztype=listing) to enable PHP to use text based GUI in terminal environment. CDK supports: -Alphalist (list with alphanumeric search) -Calendar dialog box -Dialog -Entry field with type masking -Scale field -2 dimension graphics (text mode) -Histogram display -Item list field -Label -Marque (text box in movement) -Matrix field -Menu -Scroll -Selection field -Slider field -Radio button -Template field -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/gd config.m4
wez Thu Apr 19 07:16:09 2001 EDT Modified files: /php4/ext/gdconfig.m4 Log: Patch from Adam Dickmeiss to make configure detect libtff again. Index: php4/ext/gd/config.m4 diff -u php4/ext/gd/config.m4:1.57 php4/ext/gd/config.m4:1.58 --- php4/ext/gd/config.m4:1.57 Mon Apr 16 18:02:37 2001 +++ php4/ext/gd/config.m4 Thu Apr 19 07:16:09 2001 @@ -110,6 +110,7 @@ AC_CHECK_LIB(gd, gdImageCreateTrueColor, [AC_DEFINE(HAVE_LIBGD20, 1, [ ])]) AC_CHECK_LIB(gd, gdImageSetTile, [AC_DEFINE(HAVE_GD_IMAGESETTILE, 1, [ ])]) AC_CHECK_LIB(gd, gdImageSetBrush, [AC_DEFINE(HAVE_GD_IMAGESETBRUSH, 1, [ ])]) +AC_CHECK_LIB(gd, gdImageStringFTEx, +[AC_DEFINE(HAVE_GD_STRINGFTEX, 1, [ ])]) ]) @@ -249,7 +250,7 @@ ]) AC_MSG_CHECKING(whether to include FreeType 1.x support) - if test "$with_freetype_dir" = "no" ; then + if test "$with_freetype_dir" = "no" -o "$with_freetype_dir" = ""; then if test -n "$CHECK_TTF" ; then for i in /usr /usr/local "$CHECK_TTF" ; do if test -f "$i/include/freetype.h" ; then -- PHP CVS 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]
[PHP-CVS] cvs: php4 / README.STREAMS
wez Wed Apr 18 03:43:21 2001 EDT Added files: /php4 README.STREAMS Log: Information about php streams Index: php4/README.STREAMS +++ php4/README.STREAMS An Overview of the PHP Streams abstraction == $Id: README.STREAMS,v 1.1 2001/04/18 10:43:21 wez Exp $ Please send comments to: Wez Furlong [EMAIL PROTECTED] Note: this doc is preliminary and is intended to give the reader an idea of how streams work and should be used. Why Streams? You may have noticed a shed-load of issock parameters flying around the PHP code; we don't want them - they are ugly and cumbersome and force you to special case sockets and files everytime you need to work with a "user-level" PHP file pointer. Streams take care of that and present the PHP extension coder with an ANSI stdio-alike API that looks much nicer and can be extended to support non file based data sources. Using Streams = Streams use a php_stream* parameter just as ANSI stdio (fread etc.) use a FILE* parameter. The main functions are: PHPAPI size_t php_stream_read(php_stream * stream, char * buf, size_t count); PHPAPI size_t php_stream_write(php_stream * stream, const char * buf, size_t count); PHPAPI int php_stream_eof(php_stream * stream); PHPAPI int php_stream_getc(php_stream * stream); PHPAPI char *php_stream_gets(php_stream * stream, char *buf, size_t maxlen); PHPAPI int php_stream_close(php_stream * stream); PHPAPI int php_stream_flush(php_stream * stream); PHPAPI int php_stream_seek(php_stream * stream, off_t offset, int whence); PHPAPI off_t php_stream_tell(php_stream * stream); These (should) behave in the same way as the ANSI stdio functions with similar names: fread, fwrite, feof, fgetc, fgets, fclose, fflush, fseek, ftell. Opening Streams === Ultimately, I aim to implement an fopen_wrapper-like call to do this with minimum fuss. Currently, mostly for testing purposes, you can use php_stream_fopen to open a stream on a regular file. PHPAPI php_stream * php_stream_fopen(const char * filename, const char * mode); This call behaves just like fopen(), except it returns a stream instead of a FILE * Casting Streams === What if your extension needs to access the FILE* of a user level file pointer? You need to "cast" the stream into a FILE*, and this is how you do it: FILE * fp; php_stream * stream; /* already opened */ if (php_stream_cast(stream, PHP_STREAM_AS_STDIO, fp, 1) == FAILURE){ RETURN_FALSE; } The prototype is: PHPAPI int php_stream_cast(php_stream * stream, int castas, void ** ret, int show_err); The show_err parameter, if non-zero, will cause the function to display an appropriate error message of type E_WARNING if the cast fails. castas can be one of the following values: PHP_STREAM_AS_STDIO - a stdio FILE* PHP_STREAM_AS_FD - a generic file descriptor PHP_STREAM_AS_SOCKETD - a socket descriptor If you ask a socket stream for a FILE*, the abstraction will use fdopen to create it for you. Be warned that doing so may cause buffered data to be lost if you mix ANSI stdio calls on the FILE* with php stream calls on the stream. If your system has the fopencookie function, php streams can synthesize a FILE* on top of any stream, which is useful for SSL sockets, memory based streams, data base streams etc. etc. NOTE: There might be situations where this is not desireable, and we need to provide a flag to inform the casting routine of this. You can use: PHPAPI int php_stream_can_cast(php_stream * stream, int castas) to find out if a stream can be cast, without actually performing the cast, so to check if a stream is a socket you might use: if (php_stream_can_cast(stream, PHP_STREAM_AS_SOCKETD) == SUCCESS) { /* it's a socket */ } Stream Internals There are two main structures associated with a stream - the php_stream itself, which holds some state information (and possibly a buffer) and a php_stream_ops structure, which holds the "virtual method table" for the underlying implementation. The php_streams ops struct consists of pointers to methods that implement read, write, close, flush, seek, gets and cast operations. Of these, an implementation need only implement write, read, close and flush. The gets method is intended to be used for non-buffered streams if there is an underlying method that can efficiently behave as fgets. The ops struct also contains a label for the implementation that will be used when printing error messages - the stdio implementation has a label of "STDIO" for example. The idea is that a stream implementation defines a php_stream_ops struct, and associates it with a php_stream using php_stream_alloc. As an example, the php_stream_fopen() function looks like this: PHPAPI php_stream * php_stream_fopen(const char * filename, const char * mo
[PHP-CVS] cvs: php4 / configure.in
wez Tue Apr 17 10:01:33 2001 EDT Modified files: /php4 configure.in Log: Added --enable-php-streams option for experimental file abstraction Index: php4/configure.in diff -u php4/configure.in:1.233 php4/configure.in:1.234 --- php4/configure.in:1.233 Mon Apr 9 08:47:16 2001 +++ php4/configure.in Tue Apr 17 10:01:33 2001 @@ -1,4 +1,4 @@ -dnl ## $Id: configure.in,v 1.233 2001/04/09 15:47:16 sas Exp $ -*- sh -*- +dnl ## $Id: configure.in,v 1.234 2001/04/17 17:01:33 wez Exp $ -*- sh -*- dnl ## Process this file with autoconf to produce a configure script. divert(1) @@ -599,6 +599,14 @@ PEAR_DIR=pear fi +# temporary until streams are better integrated +PHP_ARG_ENABLE(php-streams,whether to enable php streams, +[ --enable-php-streamsInclude experimental php streams. + Do not use unless you are testing the code!]) + +if test "$PHP_PHP_STREAMS" = "yes"; then + AC_DEFINE(HAVE_PHP_STREAM, 1, [Whether to use php streams]) +fi divert(5) -- PHP CVS 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]
[PHP-CVS] cvs: php4 /main Makefile.in php.h php_streams.h streams.c
wez Tue Apr 17 10:03:18 2001 EDT Added files: /php4/main php_streams.h streams.c Modified files: /php4/main Makefile.in php.h Log: Added files for PHP streams Index: php4/main/Makefile.in diff -u php4/main/Makefile.in:1.13 php4/main/Makefile.in:1.14 --- php4/main/Makefile.in:1.13 Fri Feb 23 14:07:14 2001 +++ php4/main/Makefile.in Tue Apr 17 10:03:18 2001 @@ -5,6 +5,7 @@ safe_mode.c fopen_wrappers.c alloca.c \ php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \ strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c \ +streams.c \ network.c php_open_temporary_file.c php_logos.c include $(top_srcdir)/build/ltlib.mk Index: php4/main/php.h diff -u php4/main/php.h:1.134 php4/main/php.h:1.135 --- php4/main/php.h:1.134 Mon Feb 26 10:14:30 2001 +++ php4/main/php.h Tue Apr 17 10:03:18 2001 @@ -1,4 +1,4 @@ -/* +/* +--+ | PHP version 4.0 | +--+ @@ -17,7 +17,7 @@ +--+ */ -/* $Id: php.h,v 1.134 2001/02/26 18:14:30 andi Exp $ */ +/* $Id: php.h,v 1.135 2001/04/17 17:03:18 wez Exp $ */ #ifndef PHP_H #define PHP_H @@ -44,9 +44,9 @@ #ifdef PHP_WIN32 #include "win95nt.h" # ifdef PHP_EXPORTS -# define PHPAPI __declspec(dllexport) +# define PHPAPI __declspec(dllexport) # else -# define PHPAPI __declspec(dllimport) +# define PHPAPI __declspec(dllimport) # endif #define PHP_DIR_SEPARATOR '\\' #else @@ -127,11 +127,11 @@ #endif #if HAVE_STDARG_H #include stdarg.h -#else +#else # if HAVE_SYS_VARARGS_H # include sys/varargs.h -# endif -#endif +# endif +#endif #include "zend_hash.h" @@ -156,6 +156,7 @@ char *strerror(int); #endif +#include "php_streams.h" #include "fopen_wrappers.h" #if (REGEX == 1 || REGEX == 0) !defined(NO_REGEX_EXTRA_H) @@ -307,7 +308,7 @@ #define XtOffset(p_type,field) ((unsigned int)(((p_type)NULL)-field)) -#endif /* !CRAY2 */ +#endif /* !CRAY2 */ #endif /* __STDC__ */ #else /* ! (CRAY || __arm) */ Index: php4/main/php_streams.h +++ php4/main/php_streams.h /* +--+ | PHP version 4.0 | +--+ | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | +--+ | This source file is subject to version 2.02 of the PHP license, | | that is bundled with this package in the file LICENSE, and is| | available at through the world-wide-web at | | http://www.php.net/license/2_02.txt. | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | [EMAIL PROTECTED] so we can mail you a copy immediately. | +--+ | Authors: | | Wez Furlong ([EMAIL PROTECTED]) | +--+ */ #ifndef PHP_STREAMS_H #define PHP_STREAMS_H #if HAVE_PHP_STREAM #ifdef HAVE_SYS_TIME_H #include sys/time.h #endif typedef struct _php_stream php_stream; typedef struct _php_stream_ops { /* stdio like functions - these are mandatory! */ size_t (*write)(php_stream * stream, const char * buf, size_t count); size_t (*read)(php_stream * stream, char * buf, size_t count); int(*close)(php_stream * stream); int(*flush)(php_stream * stream); /* these are optional */ int(*seek)(php_stream * stream, off_t offset, int whence); /* used only in unbuffered mode */ char * (*gets)(php_stream * stream, char * buf, size_t size); int (*cast)(php_stream * stream, int castas, void ** ret); const char * label; /* label for this ops structure */ } php_stream_ops; typedef struct _php_stream_buffer { char * buffer; size_t buflen; int dirty; /* 1 if we need to commit data */ off_t readpos; off_t writepos; size_t chunksize; /* amount to commit in one operation */ int persistent; } php_stream_buffer; PHPAPI int php_stream_buf_init(php_stream_buffer * buffer, int persistent, size_t chunksize); PHPAPI int php_stream_buf_cleanup(php_stream_buffer * buffer); /* add data into buff
[PHP-CVS] cvs: php4 /ext/standard basic_functions.c file.c file.h fsock.c fsock.h info.c
wez Tue Apr 17 10:06:07 2001 EDT Modified files: /php4/ext/standard basic_functions.c file.c file.h fsock.c fsock.h info.c Log: Changes for streams. Added temporary fopenstream function to PHP so that the streams can be tested. Index: php4/ext/standard/basic_functions.c diff -u php4/ext/standard/basic_functions.c:1.323 php4/ext/standard/basic_functions.c:1.324 --- php4/ext/standard/basic_functions.c:1.323 Sat Apr 7 08:43:06 2001 +++ php4/ext/standard/basic_functions.c Tue Apr 17 10:06:06 2001 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: basic_functions.c,v 1.323 2001/04/07 15:43:06 andre Exp $ */ +/* $Id: basic_functions.c,v 1.324 2001/04/17 17:06:06 wez Exp $ */ #include "php.h" #include "php_main.h" @@ -430,6 +430,9 @@ use socket_set_blocking() instead */ PHP_FE(set_socket_blocking, NULL) PHP_FE(socket_set_blocking, NULL) +#if HAVE_PHP_STREAM + PHP_FE(fopenstream, NULL) +#endif #if HAVE_SYS_TIME_H PHP_FE(socket_set_timeout, NULL) #else @@ -2491,11 +2494,11 @@ if (!zend_hash_exists(SG(rfc1867_uploaded_files), Z_STRVAL_PP(path), Z_STRLEN_PP(path)+1)) { RETURN_FALSE; } - + if (PG(safe_mode) (!php_checkuid(Z_STRVAL_PP(new_path), NULL, CHECKUID_CHECK_FILE_AND_DIR))) { RETURN_FALSE; } - + V_UNLINK(Z_STRVAL_PP(new_path)); if (rename(Z_STRVAL_PP(path), Z_STRVAL_PP(new_path))==0) { successful=1; Index: php4/ext/standard/file.c diff -u php4/ext/standard/file.c:1.152 php4/ext/standard/file.c:1.153 --- php4/ext/standard/file.c:1.152 Sun Apr 15 12:03:12 2001 +++ php4/ext/standard/file.cTue Apr 17 10:06:06 2001 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: file.c,v 1.152 2001/04/15 19:03:12 sasha Exp $ */ +/* $Id: file.c,v 1.153 2001/04/17 17:06:06 wez Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -101,7 +101,10 @@ /* {{{ ZTS-stuff / Globals / Prototypes */ /* sharing globals is *evil* */ -static int le_fopen, le_popen, le_socket; +static int le_fopen, le_popen, le_socket; +/* sorry folks; including this even if you haven't enabled streams + saves a zillion ifdefs */ +static int le_stream = FAILURE; /* }}} */ @@ -116,7 +119,7 @@ } -static void _file_socket_dtor(zend_rsrc_list_entry *rsrc) +static void _file_socket_dtor(zend_rsrc_list_entry *rsrc) { int *sock = (int *)rsrc-ptr; SOCK_FCLOSE(*sock); @@ -126,8 +129,15 @@ efree(sock); } +#if HAVE_PHP_STREAM +static void _file_stream_dtor(zend_rsrc_list_entry * rsrc) +{ + php_stream * stream = (php_stream*)rsrc-ptr; + php_stream_close(stream); +} +#endif -static void _file_fopen_dtor(zend_rsrc_list_entry *rsrc) +static void _file_fopen_dtor(zend_rsrc_list_entry *rsrc) { FILE *fp = (FILE *)rsrc-ptr; fclose(fp); @@ -176,6 +186,10 @@ le_popen = zend_register_list_destructors_ex(_file_popen_dtor, NULL, "pipe", module_number); le_socket = zend_register_list_destructors_ex(_file_socket_dtor, NULL, "socket", module_number); +#if HAVE_PHP_STREAM + le_stream = zend_register_list_destructors_ex(_file_stream_dtor, NULL, +"stream", module_number); +#endif + #ifdef ZTS file_globals_id = ts_allocate_id(sizeof(php_file_globals), (ts_allocate_ctor) file_globals_ctor, (ts_allocate_dtor) file_globals_dtor); #else @@ -217,20 +231,27 @@ pval **arg1, **arg2, **arg3; int type, fd, act, ret, arg_count = ARG_COUNT(ht); void *what; - + if (arg_count 3 || zend_get_parameters_ex(arg_count, arg1, arg2, arg3) == FAILURE) { WRONG_PARAM_COUNT; } - - what = zend_fetch_resource(arg1,-1,"File-Handle",type,3,le_fopen,le_popen,le_socket); + + what = zend_fetch_resource(arg1, -1, "File-Handle", type, 4, le_fopen, +le_popen, le_socket, le_stream); ZEND_VERIFY_RESOURCE(what); - + +#if HAVE_PHP_STREAM + if (type == le_stream) { + if (php_stream_cast((php_stream*)what, PHP_STREAM_AS_FD, (void*)fd, +1) == FAILURE) { + RETURN_FALSE; + } + } else +#endif if (type == le_socket) { fd = *(int *) what; } else { fd = fileno((FILE*) what); } - + convert_to_long_ex(arg2); act = (*arg2)-value.lval 3; @@ -271,7 +292,7 @@ char *token_data=NULL, *name=NULL, *value=NULL, *temp=NULL; php_meta_tags_token tok, tok_last; PLS_FETCH(); - + /* check args */ switch (ARG_COUNT(ht)) { case 1: @@ -290,7 +311,7 @@ WRONG_PARAM_COUNT; } convert_to_string_ex(filename); - +
[PHP-CVS] cvs: php4 /ext/standard basic_functions.c file.c
wez Tue Apr 17 10:08:04 2001 EDT Modified files: /php4/ext/standard basic_functions.c file.c Log: Discovered warn_not_available and used it. Index: php4/ext/standard/basic_functions.c diff -u php4/ext/standard/basic_functions.c:1.324 php4/ext/standard/basic_functions.c:1.325 --- php4/ext/standard/basic_functions.c:1.324 Tue Apr 17 10:06:06 2001 +++ php4/ext/standard/basic_functions.c Tue Apr 17 10:08:03 2001 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: basic_functions.c,v 1.324 2001/04/17 17:06:06 wez Exp $ */ +/* $Id: basic_functions.c,v 1.325 2001/04/17 17:08:03 wez Exp $ */ #include "php.h" #include "php_main.h" @@ -432,6 +432,8 @@ PHP_FE(socket_set_blocking, NULL) #if HAVE_PHP_STREAM PHP_FE(fopenstream, NULL) +#else + PHP_FALIAS(fopenstream, warn_not_available, NULL) #endif #if HAVE_SYS_TIME_H PHP_FE(socket_set_timeout, NULL) Index: php4/ext/standard/file.c diff -u php4/ext/standard/file.c:1.153 php4/ext/standard/file.c:1.154 --- php4/ext/standard/file.c:1.153 Tue Apr 17 10:06:06 2001 +++ php4/ext/standard/file.cTue Apr 17 10:08:03 2001 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: file.c,v 1.153 2001/04/17 17:06:06 wez Exp $ */ +/* $Id: file.c,v 1.154 2001/04/17 17:08:03 wez Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -576,9 +576,9 @@ } /* }}} */ +#if HAVE_PHP_STREAM PHP_FUNCTION(fopenstream) { -#if HAVE_PHP_STREAM zval ** zfilename, ** zmode; php_stream * stream; @@ -595,11 +595,8 @@ RETURN_FALSE; } ZEND_REGISTER_RESOURCE(return_value, stream, le_stream); -#else - zend_error(E_ERROR, "%s(): no stream support in this PHP build", get_active_function_name()); - RETURN_FALSE; -#endif } +#endif /* {{{ proto int fopen(string filename, string mode [, int use_include_path]) Open a file or a URL and return a file pointer */ -- PHP CVS 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]
[PHP-CVS] cvs: php4 /ext/gd config.m4
wez Mon Apr 16 18:02:37 2001 EDT Modified files: /php4/ext/gdconfig.m4 Log: Fixed lame attempt to prevent ttf linkage when using freetype2 Index: php4/ext/gd/config.m4 diff -u php4/ext/gd/config.m4:1.56 php4/ext/gd/config.m4:1.57 --- php4/ext/gd/config.m4:1.56 Fri Apr 13 17:15:26 2001 +++ php4/ext/gd/config.m4 Mon Apr 16 18:02:37 2001 @@ -248,43 +248,41 @@ fi ]) - if test "$with_freetype_dir" != "no" ; then -CHECK_TTF="" - else -CHECK_TTF="$withval" - fi - AC_MSG_CHECKING(whether to include FreeType 1.x support) - if test -n "$CHECK_TTF" ; then -for i in /usr /usr/local "$CHECK_TTF" ; do - if test -f "$i/include/freetype.h" ; then -TTF_DIR="$i" -unset TTF_INC_DIR - fi - if test -f "$i/include/freetype/freetype.h"; then -TTF_DIR="$i" -TTF_INC_DIR="$i/include/freetype" - fi -done -if test -n "$TTF_DIR" ; then - AC_DEFINE(HAVE_LIBTTF,1,[ ]) - if test "$shared" = "yes"; then -GD_LIBS="$GD_LIBS -lttf" -GD_LFLAGS="$GD_LFLAGS -L$TTF_DIR/lib" - else -PHP_ADD_LIBRARY_WITH_PATH(ttf, $TTF_DIR/lib) - fi - if test -z "$TTF_INC_DIR"; then -TTF_INC_DIR="$TTF_DIR/include" - fi - PHP_ADD_INCLUDE($TTF_INC_DIR) - AC_MSG_RESULT(yes) -else - AC_MSG_RESULT(no) -fi - else -AC_MSG_RESULT(no) - fi + if test "$with_freetype_dir" = "no" ; then +if test -n "$CHECK_TTF" ; then + for i in /usr /usr/local "$CHECK_TTF" ; do + if test -f "$i/include/freetype.h" ; then + TTF_DIR="$i" + unset TTF_INC_DIR + fi + if test -f "$i/include/freetype/freetype.h"; then + TTF_DIR="$i" + TTF_INC_DIR="$i/include/freetype" + fi + done + if test -n "$TTF_DIR" ; then + AC_DEFINE(HAVE_LIBTTF,1,[ ]) + if test "$shared" = "yes"; then + GD_LIBS="$GD_LIBS -lttf" + GD_LFLAGS="$GD_LFLAGS -L$TTF_DIR/lib" + else + PHP_ADD_LIBRARY_WITH_PATH(ttf, $TTF_DIR/lib) + fi + if test -z "$TTF_INC_DIR"; then + TTF_INC_DIR="$TTF_DIR/include" + fi + PHP_ADD_INCLUDE($TTF_INC_DIR) + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + else + AC_MSG_RESULT(no) + fi + else + AC_MSG_RESULT(no - FreeType 2.x is to be used instead) + fi AC_MSG_CHECKING(for T1lib support) AC_ARG_WITH(t1lib, -- PHP CVS 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]
[PHP-CVS] cvs: php4 /ext/gd config.m4 gd.c php_gd.h
wez Fri Apr 13 05:00:12 2001 EDT Modified files: /php4/ext/gdconfig.m4 gd.c php_gd.h Log: Added GD 2.0.1 support. Index: php4/ext/gd/config.m4 diff -u php4/ext/gd/config.m4:1.54 php4/ext/gd/config.m4:1.55 --- php4/ext/gd/config.m4:1.54 Tue Mar 27 12:34:26 2001 +++ php4/ext/gd/config.m4 Fri Apr 13 05:00:12 2001 @@ -23,7 +23,32 @@ ]) ]) +AC_DEFUN(PHP_GD_PNG,[ +AC_MSG_CHECKING([for libpng (needed by gd-2.0)]) +AC_ARG_WITH(png-dir, +[ --with-png-dir[=DIR] GD: png dir for gd-2.0+],[ + AC_MSG_RESULT(yes) + if test "$withval" = "yes"; then +withval="/usr/local" + fi + jold_LIBS=$LIBS + LIBS="$LIBS -L$withval/lib" + AC_CHECK_LIB(png,png_info_init, [LIBS="$LIBS -lpng"],[AC_MSG_RESULT(no)],) + LIBS=$jold_LIBS + if test "$shared" = "yes"; then +GD_LIBS="$GD_LIBS -lpng" +GD_LFLAGS="$GD_LFLAGS -L$withval/lib" + else +PHP_ADD_LIBRARY_WITH_PATH(png, $withval/lib) + fi + LIBS="$LIBS -L$withval/lib -lpng" +],[ + AC_MSG_RESULT(no) + AC_MSG_WARN(If configure fails try --with-png-dir=DIR) +]) +]) + AC_DEFUN(PHP_GD_XPM,[ AC_MSG_CHECKING([for libXpm (needed by gd-1.8+)]) AC_ARG_WITH(xpm-dir, @@ -44,8 +69,31 @@ AC_MSG_WARN(If configure fails try --with-xpm-dir=DIR) ]) ]) - +AC_DEFUN(PHP_GD_FREETYPE,[ + AC_MSG_CHECKING([for freetype(2) (needed by gd 2.0+)]) + AC_ARG_WITH(freetype-dir, + [ --with-freetype-dir[=DIR]GD: freetype 2 dir for gd 2.0+],[ + for i in /usr /usr/local "$CHECK_FREETYPE" ; do + if test -f "$i/include/freetype2/freetype/freetype.h"; then + FREETYPE2_DIR="$i" + FREETYPE2_INC_DIR="$i/include/freetype/freetype2" + fi + done + if test -n "$FREETYPE2_DIR" ; then + AC_DEFINE(HAVE_LIBFREETYPE,1,[ ]) + PHP_ADD_LIBRARY_WITH_PATH(freetype, $FREETYPE2_DIR/lib) + PHP_ADD_INCLUDE($FREETYPE2_INC_DIR) + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no (freetype2 not found)) + fi + ],[ + AC_MSG_RESULT(no) + AC_MSG_RESULT(If configure fails, try +--with-freetype2-dir=DIR) + ]) +]) + AC_DEFUN(PHP_GD_CHECK_VERSION,[ AC_CHECK_LIB(z, compress, LIBS="-lz $LIBS",,) AC_CHECK_LIB(png,png_info_init, LIBS="-lpng $LIBS",,) @@ -58,6 +106,9 @@ AC_CHECK_LIB(gd, gdImageWBMP,[AC_DEFINE(HAVE_GD_WBMP, 1, [ ])]) AC_CHECK_LIB(gd, gdImageCreateFromJpeg, [AC_DEFINE(HAVE_GD_JPG, 1, [ ])]) AC_CHECK_LIB(gd, gdImageCreateFromXpm, [AC_DEFINE(HAVE_GD_XPM, 1, [ ])]) +AC_CHECK_LIB(gd, gdImageCreateTrueColor, [AC_DEFINE(HAVE_LIBGD20, 1, [ ])]) +AC_CHECK_LIB(gd, gdImageSetTile, +[AC_DEFINE(HAVE_GD_IMAGESETTILE, 1, [ ])]) +AC_CHECK_LIB(gd, gdImageSetBrush, +[AC_DEFINE(HAVE_GD_IMAGESETBRUSH, 1, [ ])]) ]) @@ -84,7 +135,9 @@ PHP_WITH_SHARED old_withval=$withval PHP_GD_JPEG + PHP_GD_PNG PHP_GD_XPM + PHP_GD_FREETYPE withval=$old_withval AC_MSG_CHECKING(whether to include GD support) @@ -183,6 +236,8 @@ if test "$with_gd" != "no" test "$ac_cv_lib_gd_gdImageLine" = "yes"; then CHECK_TTF="yes" + + AC_ARG_WITH(ttf, [ --with-ttf[=DIR]GD: Include FreeType 1.x support],[ if test $withval = "no" ; then @@ -191,7 +246,7 @@ CHECK_TTF="$withval" fi ]) - + AC_MSG_CHECKING(whether to include FreeType 1.x support) if test -n "$CHECK_TTF" ; then for i in /usr /usr/local "$CHECK_TTF" ; do Index: php4/ext/gd/gd.c diff -u php4/ext/gd/gd.c:1.121 php4/ext/gd/gd.c:1.122 --- php4/ext/gd/gd.c:1.121 Fri Apr 6 11:01:52 2001 +++ php4/ext/gd/gd.cFri Apr 13 05:00:12 2001 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.121 2001/04/06 18:01:52 sniper Exp $ */ +/* $Id: gd.c,v 1.122 2001/04/13 12:00:12 wez Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -149,6 +149,24 @@ PHP_FE(imagecopymerge, NULL) PHP_FE(imagecopyresized,NULL) PHP_FE(imagecreate, NULL) + + PHP_FE(imagecreatetruecolor,NULL) +
[PHP-CVS] cvs: php4 /ext/gd config.m4
wez Fri Apr 13 17:15:26 2001 EDT Modified files: /php4/ext/gdconfig.m4 Log: When using freetype2, turn off libttf and turn on native gd ttf. Index: php4/ext/gd/config.m4 diff -u php4/ext/gd/config.m4:1.55 php4/ext/gd/config.m4:1.56 --- php4/ext/gd/config.m4:1.55 Fri Apr 13 05:00:12 2001 +++ php4/ext/gd/config.m4 Fri Apr 13 17:15:26 2001 @@ -77,20 +77,21 @@ for i in /usr /usr/local "$CHECK_FREETYPE" ; do if test -f "$i/include/freetype2/freetype/freetype.h"; then FREETYPE2_DIR="$i" - FREETYPE2_INC_DIR="$i/include/freetype/freetype2" + FREETYPE2_INC_DIR="$i/include/freetype2/freetype" fi done if test -n "$FREETYPE2_DIR" ; then AC_DEFINE(HAVE_LIBFREETYPE,1,[ ]) PHP_ADD_LIBRARY_WITH_PATH(freetype, $FREETYPE2_DIR/lib) PHP_ADD_INCLUDE($FREETYPE2_INC_DIR) + AC_DEFINE(USE_GD_IMGSTRTTF, 1, [ ]) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no (freetype2 not found)) fi ],[ AC_MSG_RESULT(no) - AC_MSG_RESULT(If configure fails, try --with-freetype2-dir=DIR) + AC_MSG_RESULT(If configure fails, try +--with-freetype-dir=DIR) ]) ]) @@ -246,7 +247,13 @@ CHECK_TTF="$withval" fi ]) - + + if test "$with_freetype_dir" != "no" ; then +CHECK_TTF="" + else +CHECK_TTF="$withval" + fi + AC_MSG_CHECKING(whether to include FreeType 1.x support) if test -n "$CHECK_TTF" ; then for i in /usr /usr/local "$CHECK_TTF" ; do -- PHP CVS 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]
[PHP-CVS] cvs: php4 /ext/openssl openssl.c
wez Thu Apr 5 01:40:26 2001 EDT Modified files: /php4/ext/openssl openssl.c Log: Fix for Bug #10168 (is_dst undeclared) Index: php4/ext/openssl/openssl.c diff -u php4/ext/openssl/openssl.c:1.12 php4/ext/openssl/openssl.c:1.13 --- php4/ext/openssl/openssl.c:1.12 Mon Apr 2 16:14:00 2001 +++ php4/ext/openssl/openssl.c Thu Apr 5 01:40:26 2001 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: openssl.c,v 1.12 2001/04/02 23:14:00 wez Exp $ */ +/* $Id: openssl.c,v 1.13 2001/04/05 08:40:26 wez Exp $ */ #include "php.h" #include "php_openssl.h" @@ -456,7 +456,7 @@ ** the value of timezone - 3600 seconds. Otherwise, we need to overcorrect and ** set the adjustment to the main timezone + 3600 seconds. */ - gmadjust = -(is_dst ? timezone - 3600 : timezone + 3600); + gmadjust = -(thetime.tm_isdst ? timezone - 3600 : timezone + 3600); #endif ret += gmadjust; -- PHP CVS 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]
[PHP-CVS] cvs: php4 /ext/openssl CREDITS README openssl.c php_openssl.h
wez Sun Apr 1 16:06:14 2001 EDT Modified files: /php4/ext/openssl CREDITS README openssl.c php_openssl.h Log: Added whole bunch of PKCS7 (S/MIME) functions and made the key/cert params a bit more friendly to use. See the README for more info. Index: php4/ext/openssl/CREDITS diff -u php4/ext/openssl/CREDITS:1.2 php4/ext/openssl/CREDITS:1.3 --- php4/ext/openssl/CREDITS:1.2Thu Nov 23 11:30:37 2000 +++ php4/ext/openssl/CREDITSSun Apr 1 16:06:14 2001 @@ -1,2 +1,2 @@ OpenSSL -Stig Venaas +Stig Venaas, Wez Furlong Index: php4/ext/openssl/README diff -u php4/ext/openssl/README:1.1 php4/ext/openssl/README:1.2 --- php4/ext/openssl/README:1.1 Thu Nov 23 11:30:37 2000 +++ php4/ext/openssl/README Sun Apr 1 16:06:14 2001 @@ -1,53 +1,210 @@ OpenSSL extension for PHP4 -$Id: README,v 1.1 2000/11/23 19:30:37 venaas Exp $ +$Id: README,v 1.2 2001/04/01 23:06:14 wez Exp $ -The functions implemented so far make it possible to seal and open data, -and also create and verify signatures. To enable the extension, configure -PHP with --with-openssl. +The functions implemented so far make it possible to seal and open data, and +also create and verify signatures. +NEW: support for S/MIME encrypt/decrypt/sign/verify, as well as more +flexibility for specifying certificates/keys. -Functions: +To enable the extension, configure PHP with --with-openssl. -int openssl_get_privatekey(string key [, string passphrase]) +Specifying keys/certificates + +Most of the functions require a key or a certificate as a parameter; to make +things easy for you to use openssl, this extension allows you +to specify certificates in the following way: + +1. As an X.509 resource returned from openssl_x509_read +2. As a string in the format file://filename, where filename is the path to the + certificate file (it will be opened and read automatically) +3. As a string containing the data from the certificate file + +Similarly, you can use the following methods of specifying a public key: + +1. As a key resource returned from openssl_get_publickey +2. An X509 resource - public key only +3. As a string in the format file://filename +4. As a string containing the data from the key file + +Additionally, for a private key, when the openssl extension function does not +allow you to enter the passphrase as a parameter you may use the syntax +array($key, "passphrase") where $key can be a key specified using one of the +methods listed above. + +Certificate Verification + +When calling a function that will verify a signature/certificate, the cainfo +parameter is an array containing file and directory names that specifiy the +locations of trusted CA files. If a directory is specified, then it must be a +correctly hashed directory. + +Misc: +- + +mixed openssl_error_string() + +returns the message from the last error that the OpenSSL library encountered +and moves it's internal error pointer to the next message. If there are no +more error messages, returns false. + +General Key/Cert Functions: +--- + +resource openssl_get_privatekey(mixed key [, string passphrase]) + Parses the key data and returns a key resource identifier. If the key is encrypted a passphrase is needed. This can be supplied as second argument. -int openssl_get_publickey(string cert) +resource openssl_get_publickey(mixed cert) Extracts the public key from the given certificate and returns a key resource identifier. -void openssl_free_key(int key) +void openssl_free_key(resource key) Frees the resource given by the key resource identifier. +Note that this function does not accept the extended key specification +syntax mentioned above, as it doesn't make sense in this case! + +array openssl_x509_parse(mixed x509[, bool shortnames=true]) + +Parses the certificate data and returns an array containing information +about the certificate, it's intended purposes, subject, issuer, validity +etc. etc. If shortnames is true (the default) then the fields will be +keyed by the shortname forms eg: CN as opposed to commonName (shortnames += false). + + +bool openssl_x509_checkpurpose(mixed x509cert, int purpose, + array cainfo[, string untrustedfile]) + +Verifies if the certificate can be used for a specific purpose. +Purpose can be one of the following values: + X509_PURPOSE_SSL_CLIENT + X509_PURPOSE_SSL_SERVER + X509_PURPOSE_NS_SSL_SERVER + X509_PURPOSE_SMIME_SIGN + X509_PURPOSE_SMIME_ENCRYPT + X509_PURPOSE_CRL_SIGN + X509_PURPOSE_ANY + +cainfo is an array of CA information (as mentioned above). +untrusted file specifies a file containing a bunch of certs that +are not trusted but may be useful in validating the certificate. + + +resource openssl_read_x509(mixed cert) + +Parses the cert and returns a resource that can be used with the +other openssl functions + + +void openssl
[PHP-CVS] cvs: php4 /ext/openssl openssl.c
wez Sun Apr 1 18:31:07 2001 EDT Modified files: /php4/ext/openssl openssl.c Log: added some more error reporting and did a little tidying. Index: php4/ext/openssl/openssl.c diff -u php4/ext/openssl/openssl.c:1.10 php4/ext/openssl/openssl.c:1.11 --- php4/ext/openssl/openssl.c:1.10 Sun Apr 1 16:06:14 2001 +++ php4/ext/openssl/openssl.c Sun Apr 1 18:31:07 2001 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: openssl.c,v 1.10 2001/04/01 23:06:14 wez Exp $ */ +/* $Id: openssl.c,v 1.11 2001/04/02 01:31:07 wez Exp $ */ #include "php.h" #include "php_openssl.h" @@ -152,7 +152,7 @@ if (resourceval) *resourceval = -1; - if ((*val)-type == IS_RESOURCE){ + if (Z_TYPE_PP(val) == IS_RESOURCE) { /* is it an x509 resource ? */ void * what; int type; @@ -210,7 +210,7 @@ /* Given a zval, coerce it into a EVP_PKEY object. It can be: 1. private key resource from openssl_get_privatekey() - 2. X509 resource - private key will be extracted from it + 2. X509 resource - public key will be extracted from it 3. if it starts with file:// interpreted as path to key file 4. interpreted as the data from the cert/key file and interpreted in same way as openssl_get_privatekey() 5. an array(0 = [items 2..4], 1 = passphrase) @@ -225,13 +225,13 @@ int free_cert = 0; long cert_res = -1; char * filename = NULL; - + if (resourceval) *resourceval = -1; - if ((*val)-type == IS_ARRAY) { + if (Z_TYPE_PP(val) == IS_ARRAY) { zval ** zphrase; - + /* get passphrase */ if (zend_hash_index_find(HASH_OF(*val), 1, (void **)zphrase) == FAILURE) { @@ -248,7 +248,7 @@ } } - if ((*val)-type == IS_RESOURCE){ + if (Z_TYPE_PP(val) == IS_RESOURCE) { void * what; int type; @@ -1144,20 +1144,28 @@ convert_to_string_ex(zoutfilename); privkey = php_openssl_evp_from_zval(zprivkey, 0, "", 0, keyresource); - if (privkey == NULL) + if (privkey == NULL){ + zend_error(E_ERROR, "%s(): error getting private key", +get_active_function_name()); goto clean_exit; + } cert = php_openssl_x509_from_zval(zcert, 0, certresource); - if (cert == NULL) + if (cert == NULL) { + zend_error(E_ERROR, "%s(): error getting cert", +get_active_function_name()); goto clean_exit; + } infile = BIO_new_file(Z_STRVAL_PP(zinfilename), "r"); - if (infile == NULL) + if (infile == NULL) { + zend_error(E_ERROR, "%s(): error opening input file %s!", +get_active_function_name(), Z_STRVAL_PP(zinfilename)); goto clean_exit; + } outfile = BIO_new_file(Z_STRVAL_PP(zoutfilename), "w"); - if (outfile == NULL) + if (outfile == NULL){ + zend_error(E_ERROR, "%s(): error opening output file %s!", +get_active_function_name(), Z_STRVAL_PP(zoutfilename)); goto clean_exit; + } p7 = PKCS7_sign(cert, privkey, others, infile, flags); if (p7 == NULL) { -- PHP CVS 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]
[PHP-CVS] cvs: php4 /ext/iconv iconv.c
wez Thu Mar 29 01:37:09 2001 EDT Modified files: /php4/ext/iconv iconv.c Log: Fixed leak in php_iconv_string. Also returns FAILURE on failure, rather than -1 Index: php4/ext/iconv/iconv.c diff -u php4/ext/iconv/iconv.c:1.9 php4/ext/iconv/iconv.c:1.10 --- php4/ext/iconv/iconv.c:1.9 Thu Mar 15 12:45:49 2001 +++ php4/ext/iconv/iconv.c Thu Mar 29 01:37:09 2001 @@ -126,15 +126,15 @@ php_error(E_WARNING, "iconv: cannot convert from `%s' to `%s'", in_charset, out_charset); efree(out_buffer); - return -1; + return FAILURE; } result = icv(cd, (const char **) in_p, in_size, (char **) out_p, out_size); if (result == (size_t)(-1)) { -sprintf(out_buffer, "???") ; - return -1; +efree(out_buffer); + return FAILURE; } icv_close(cd); -- PHP CVS 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]