Re: [PHP] Segmentation fault problem
each php function is executed by the internal function "execute()" please include the details about this frames also (configure php with --enable-debug first) e.g.: (gdb) frame 6 output... (gdb) print (char *)(executor_globals.function_state_ptr->function)- >common.function_name output... with this information you can see which php-command causing the seg fault -> http://bugs.php.net/bugs-generating-backtrace.php g. martin luethi > Program received signal SIGSEGV, Segmentation fault. > 0x7bacedcc in zend_parse_arg_impl (arg=0x1003853c0, > va=0x7ffe3a88, spec=0x7ffe3a58) > at /root/build/php-4.3.4/Zend/zend_API.c:259 > 259 *p = Z_LVAL_PP(arg); > (gdb) bt > #0 0x7bacedcc in zend_parse_arg_impl (arg=0x1003853c0, > va=0x7ffe3a88, spec=0x7ffe3a58) > at /root/build/php-4.3.4/Zend/zend_API.c:259 > #1 0x7bacfa54 in zend_parse_arg (arg_num=4, arg=0x1003853c0, > va=0x7ffe3a88, > spec=0x7ffe3a58, quiet=0) at > /root/build/php-4.3.4/Zend/zend_API.c:439 > #2 0x7bacff40 in zend_parse_va_args (num_args=0, > type_spec=0x7bb6906c "ll", > va=0x7ffe3a88, flags=0) at > /root/build/php-4.3.4/Zend/zend_API.c:524 > #3 0x7bad032c in zend_parse_parameters (num_args=4, > type_spec=0x7bb69068 "ssz|ll") > at /root/build/php-4.3.4/Zend/zend_API.c:551 > #4 0x7b9493cc in php_pcre_match (ht=4, return_value=0x1008c4c00, > this_ptr=0x0, return_value_used=0, > global=1) at /root/build/php-4.3.4/ext/pcre/php_pcre.c:375 > #5 0x7b94a464 in zif_preg_match_all (ht=4, > return_value=0x1008c4c00, this_ptr=0x0, return_value_used=0) > at /root/build/php-4.3.4/ext/pcre/php_pcre.c:608 > #6 0x7baea870 in execute (op_array=0x1008ac610) at > /root/build/php-4.3.4/Zend/zend_execute.c:1616 > #7 0x7baeabe4 in execute (op_array=0x100884bd0) at > /root/build/php-4.3.4/Zend/zend_execute.c:1660 > #8 0x7baeabe4 in execute (op_array=0x1003a07b0) at > /root/build/php-4.3.4/Zend/zend_execute.c:1660 > #9 0x7baeabe4 in execute (op_array=0x1003af0a0) at > /root/build/php-4.3.4/Zend/zend_execute.c:1660 > #10 0x7baeabe4 in execute (op_array=0x10038f220) at > /root/build/php-4.3.4/Zend/zend_execute.c:1660 > #11 0x7bacde24 in zend_execute_scripts (type=8, retval=0x0, > file_count=3) > at /root/build/php-4.3.4/Zend/zend.c:884 > #12 0x7ba6dd08 in php_execute_script > (primary_file=0x7fffef30) > at /root/build/php-4.3.4/main/main.c:1729 > #13 0x7baf3914 in php_handler (r=0x10037df10) > at /root/build/php-4.3.4/sapi/apache2handler/sapi_apache2.c:537 > #14 0x0001000ac8a0 in ap_run_handler () > #15 0x0001000ad798 in ap_invoke_handler () > #16 0x00010007b6d0 in ap_process_request () > #17 0x0001000712e4 in ap_process_http_connection () > #18 0x0001000c55b8 in ap_run_process_connection () > #19 0x0001000c5c18 in ap_process_connection () > #20 0x0001000a8e28 in child_main () > #21 0x0001000a9030 in make_child () > #22 0x0001000a92a4 in startup_children () > #23 0x0001000a9da8 in ap_mpm_run () > #24 0x0001000b79d8 in main () > (gdb) quit > [EMAIL PROTECTED] httpd] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regexp help (simple)
maybe this work: replace the special-characters first, eg.: $bokid = str_replace("å", "_", $bokid); and replace them back after preg_match or try the preg_match with the hexcode of this special chars: \xhh character with hex code hh (http://ch2.php.net/manual/de/pcre.pattern.syntax.php) g. martin luethi Thu, 22 Jan 2004 15:43:19 +0100 Victor Spång Arthursson <[EMAIL PROTECTED]>: > > 2004-01-22 kl. 10.40 skrev Dagfinn Reiersøl: > >> I assume you mean: >> >> $test = split_bokid("ääö12345"); > > Yes! > >> I don't know. It works fine on my computer. The letters display >> correctly on the command line and even in Mozilla. > > Hmmm? try the following: > <http://adversus.no-ip.com/function_split_bokid.php?bokid=åäö12345> > > Sincerely: > > Victor > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Segmentation fault problem
the function who is causing the seg fault is preg_match_all maybe this helps (http://bugs.php.net/bug.php?id=20698): [28 Nov 2002 6:26am EST] thingol at mail dot ru If the text for preg_match_all is bigger than some value, many regexp constructions causes php to terminate. This code crashes php (on win32 only): [28 Nov 2002 7:06am EST] [EMAIL PROTECTED] Not really a PHP bug; bug is in the PCRE library itself and is because you are asking it to capture a very large number of individual character matches. Increasing your stack size might help (ulimit). g. martin luethi Thu, 22 Jan 2004 14:20:56 -0500 "E. Stuart Hicks" <[EMAIL PROTECTED]>: Please disregard my last post - I'd switched Apache back from the debug module for the night and forgotten to turn it back on. I've attached the full trace but here's the main part: (gdb) print (char *)(executor_globals.function_state_ptr->function)->common.function_name $4 = 0x7bb69250 "preg_match_all" (gdb) frame 8 #8 0x7baeabe4 in execute (op_array=0x1003a07d0) at /root/build/php-4.3.4/Zend/zend_execute.c:1660 1660 zend_execute(EG(active_op_array) TSRMLS_CC); (gdb) frame 9 #9 0x7baeabe4 in execute (op_array=0x1003af0c0) at /root/build/php-4.3.4/Zend/zend_execute.c:1660 1660 zend_execute(EG(active_op_array) TSRMLS_CC); (gdb) frame 10 #10 0x7baeabe4 in execute (op_array=0x10038f230) at /root/build/php-4.3.4/Zend/zend_execute.c:1660 1660 zend_execute(EG(active_op_array) TSRMLS_CC); (gdb) frame 11 #11 0x7bacde24 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /root/build/php-4.3.4/Zend/zend.c:884 884 zend_execute(EG(active_op_array) TSRMLS_CC); (gdb) frame 12 #12 0x7ba6dd08 in php_execute_script (primary_file=0x7fffef20) at /root/build/php-4.3.4/main/main.c:1729 1729retval = (zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, NULL, 3, prepend_file_p, primary_file, append_file_p) == SUCCESS); Stu -Original Message- From: E. Stuart Hicks [mailto:[EMAIL PROTECTED] Sent: Thursday, January 22, 2004 2:07 PM To: 'Martin Luethi'; [EMAIL PROTECTED] Subject: RE: [PHP] Segmentation fault problem I still can't access anything on bugs.php.net so I'm not sure exactly what you need. I grabbed all of the execute() frames, though, and ran that print function and got this: (gdb) print (char *)(executor_globals.function_state_ptr->function)->common.function_name Attempt to extract a component of a value that is not a structure. (gdb) frame 6 #6 0x7babef00 in execute () from /home/httpd/modules/libphp4.so (gdb) frame 7 #7 0x7babf244 in execute () from /home/httpd/modules/libphp4.so (gdb) frame 8 #8 0x7babf244 in execute () from /home/httpd/modules/libphp4.so (gdb) frame 9 #9 0x7babf244 in execute () from /home/httpd/modules/libphp4.so (gdb) frame 10 #10 0x7babf244 in execute () from /home/httpd/modules/libphp4.so Does this help? Stu -Original Message- From: Martin Luethi [mailto:[EMAIL PROTECTED] Sent: Thursday, January 22, 2004 2:24 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Segmentation fault problem each php function is executed by the internal function "execute()" please include the details about this frames also (configure php with --enable-debug first) e.g.: (gdb) frame 6 output... (gdb) print (char *)(executor_globals.function_state_ptr->function)- common.function_name output... with this information you can see which php-command causing the seg fault -> http://bugs.php.net/bugs-generating-backtrace.php g. martin luethi Program received signal SIGSEGV, Segmentation fault. 0x7bacedcc in zend_parse_arg_impl (arg=0x1003853c0, va=0x7ffe3a88, spec=0x7ffe3a58) at /root/build/php-4.3.4/Zend/zend_API.c:259 259 *p = Z_LVAL_PP(arg); (gdb) bt #0 0x7bacedcc in zend_parse_arg_impl (arg=0x1003853c0, va=0x7ffe3a88, spec=0x7ffe3a58) at /root/build/php-4.3.4/Zend/zend_API.c:259 #1 0x7bacfa54 in zend_parse_arg (arg_num=4, arg=0x1003853c0, va=0x7ffe3a88, spec=0x7ffe3a58, quiet=0) at /root/build/php-4.3.4/Zend/zend_API.c:439 #2 0x7bacff40 in zend_parse_va_args (num_args=0, type_spec=0x7bb6906c "ll", va=0x7ffe3a88, flags=0) at /root/build/php-4.3.4/Zend/zend_API.c:524 #3 0x7bad032c in zend_parse_parameters (num_args=4, type_spec=0x7bb69068 "ssz|ll") at /root/build/php-4.3.4/Zend/zend_API.c:551 #4 0x7b9493cc in php_pcre_match (ht=4, return_value=0x1008c4c00, this_ptr=0x0, return_value_used=0, global=1) at /root/build/php-4.3.4/ext/pcre/php_pcre.c:375 #5 0x7b94a464 in zif_preg_match_all (ht=4, return_value=0x1008c4c00, this_ptr=0x0, return_value_used=0) at /root/build/php-4.3.4/ext/pcre/php_pcre.c:608 #6 0x7baea870
Re: [PHP] How do I regain the ability to create databases (phpMyAdmin)?
check if the user you defined in phpMyAdmin/config.inc.php ($cfg['Servers'][$i]['user'] = ???) has the right to create new databases (db: mysql / table: user / field: Create_priv='Y') restart the mysql-server after altering the database mysql g. martin luethi Fri, 23 Jan 2004 01:26:46 -0800 Freedomware <[EMAIL PROTECTED]>: I've finally got both PHP and MySQL up and running, and I've learned how to create new users and databases (at least the basics). But I was told I should add a password to root/localhost, and that's been a major pain in the butt. First, it knocked out phpMyAdmin. Then I learned how to edit a file (phpMyAdmin.config.inc, or something like that), which restored phpMyAdmin. But I next discovered that I can no longer create databases. When I open up phpMyAdmin, near the top of the page is a function for creating new databases. It now says "No Privilieges," just under "Create New Database." I tried to retrace my steps in creating a password. I clicked on Privileges, then clicked Edit in the root/localhost row. Then I went down to where it says "Change Password," clicked the Password radio button and typed in my password twice. I don't think I did anything else. So why would that knock out my databases? More important, how do I get them back? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date(F) +1
try g. martin luethi Mon, 26 Jan 2004 03:08:30 -0500 John Taylor-Johnston <[EMAIL PROTECTED]>: Did I miss something at the FAQ? date("F"); gives me this month. Can I get it to give me next month? These combinations don't work: What is the minimum version for this to work? Or is this my problem? It echoes "1" in the html. http://www.php.net/manual/en/function.date.php John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Detect language date(F)
the variable $_SERVER["HTTP_ACCEPT_LANGUAGE"] contains the Accept-Language- Header from the browser -> http://ch2.php.net/reserved.variables with setlocale() you can set locale-informations -> http://ch2.php.net/function.setlocale finally strftime() formats a date with the current locale-informations -> http://ch2.php.net/manual/en/function.strftime.php sample script: g. martin luethi Mon, 26 Jan 2004 03:29:16 -0500 John Taylor-Johnston <[EMAIL PROTECTED]>: Thanks!! :) Getting tired at this hour. Is there a way to detect the language of the browser and echo the name of the month in that language? Thanks, John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fwd: Re: session start
edit "php.ini" and define a session.save_path e.g. on windows: session.save_path = c:\winnt\temp -> http://ch.php.net/en/session g. martin luethi Loh tuck yong wrote: Hi, i have a problem with the method session_start() this is the warning message generated, and for the php, i have only 1 line Warning: session_start(): open(/tmp\sess_d66a282d6ad936c73c719dc95de84045, O_RDWR) failed: No such file or directory (2) in C:\Program Files\Apache Group\Apache2\htdocs\Dlon\html\verification.php on line 1 Is it my webserver? or is it php? why does it not work? By the way, i'm using Apache HTTP Server 2.0.48 as my web server. Thank You. Yours Sincerely, Loh Tuck Yong -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Detect language date(F)
my example should also work with fr or fr-ca what do you get with: echo $_SERVER["HTTP_ACCEPT_LANGUAGE"]; ? the locale-string depends on your webserver. under linux you have to build them first (e.g.: locale-gen) take a look at the user-notes under http://ch2.php.net/manual/de/function.setlocale.php g. martin luethi Mon, 26 Jan 2004 14:36:04 -0500 John Taylor-Johnston <[EMAIL PROTECTED]>: I see what you are doing, But don't see where to create fr or fr-ca, for my example? John Martin Luethi wrote: the variable $_SERVER["HTTP_ACCEPT_LANGUAGE"] contains the Accept-Language- Header from the browser -> http://ch2.php.net/reserved.variables with setlocale() you can set locale-informations -> http://ch2.php.net/function.setlocale finally strftime() formats a date with the current locale-informations -> http://ch2.php.net/manual/en/function.strftime.php sample script: if (preg_match("/^([a-z]{2}).([a-z]{2})$/i", $_SERVER["HTTP_ACCEPT_LANGUAGE"], $m='')) { // e.g. de-ch $locales[] = strtolower($m[1])."_".strtoupper($m[2]); // e.g. de_CH $locales[] = strtolower($m[1]); // e.g. de setlocale(LC_TIME, $locales); } else if (preg_match("/^([a-z]{2})$/i", $_SERVER["HTTP_ACCEPT_LANGUAGE"], $m='')) { // e.g. de $locales[] = strtolower($m[1])."_".strtoupper($m[1]); // e.g. de_DE $locales[] = strtolower($m[1]); // e.g. de setlocale(LC_TIME, $locales); } echo strftime("%B", strtotime("+1 month")); ?> g. martin luethi Mon, 26 Jan 2004 03:29:16 -0500 John Taylor-Johnston <[EMAIL PROTECTED]>: > Thanks!! :) Getting tired at this hour. > > Is there a way to detect the language of the browser and echo the > name of the month in that language? > >> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] >>Remove Dynamic String between StringA and StringB
$pattern = "/$stringA.*?$stringB/"; .*? -> matches everything between $stringA and $stringB the "?" means: stop matching after the first occurence of $stringB (quantifier minimizer). otherwise ".*" would match everything between the first occurence of $stringA and the last occurence of $stringB -> http://ch2.php.net/manual/de/pcre.pattern.syntax.php g. tinu Tue, 27 Jan 2004 13:25:27 +0100 Jack Bauer <[EMAIL PROTECTED]>: Hi :), i tried your code zu replace some parts of a string, the problem is that this method only replaces when there is only 1 word between stringA and stringB. i got the problem that the part between both strings is a dynamic one and much larger then 1 word. i really tried to use the php manual and google to find some help for this, but i got no luck with that :( $stringA = "AA"; $stringB = "BB"; $string = "AA oneword BB AA two words BB"; $pattern = "/$stringA.\w*.$stringB/"; $replacement = ""; echo preg_replace($pattern, $replacement, $string); i think it have to do something with the \w in the pattern, is there a parameter to resolve my problem too? regards manuel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: help with mysql
line 16: mysql_connect("tflood", "thomas91"); I think you mean: mysql_connect("localhost", "tflood", "thomas91"); otherwise mysql_connect takes "tflood" as Server and "thomas91" as Username (if so, its better to replace passwords with * before posting) -> http://ch.php.net/mysql_connect after connecting you need to choose a database, e.g. line 17: mysql_select_db("databasename"); also make sure that the mysql-extension is installed and loaded. to check this, create a textfile "phpinfo.php" with this content: check the output for information about mysql g. tinu Tue, 27 Jan 2004 08:51:52 -0500 Tom Flood <[EMAIL PROTECTED]>: Thank you both, here is the entire code : 1 2 3Untitled Document 4 5 6 7 8\n"; 13print "Address is $address\n"; 14print "City is $city\n"; 15 16mysql_connect("tflood", "thomas91"); 17 18$result = mysql_query( 19 "insert into ephi.info 20 (name, address, city) values 21 ('$name', '$address', '$city')" 22); 23if ($result) { 24 print << Thank you. 27 Your signup is highly appreciated. To show our appreciation, we will send you something that you, in turn, will appreciate. 28 Remember our motto: Once a Sinfonian, Always a Sinfonian, Long Live Sinfonia! 29EOT; 30 } 31 else { 32 print "Something went wrong dunbass"; 33 } 34 mysql_close(); 35?> 36 As far as mysql working on the machine, it is. I am able to use the mysql command to loginto the server and query my databases. And I have the MySQL Command Center installed and am able to see the databases on my computer just fine. Thank you for your help. Tom "Krit Kanrat" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi, Are you sure that you already enable mysql function on your web server ? Krit Kanrat "Tom Flood" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > I am just beginning my learning of php and its uses with mysql. I wrote a > small program to add information into a mysql database. However my script > returns the following error: > > Fatal error: Call to undefined function: mysql_connect() in > /var/www/html/ephi/mysql.php on line 16 > > what is the problem here? How can I fix it? > > I truly appreciate any help given. > > Tom Flood > [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unix-Apache: running apache as different user
Wed, 28 Jan 2004 16:11:59 +0200 Lorderon <[EMAIL PROTECTED]>: > "Mike Migurski" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> >I have PHP installed on Apache and Unix with several vhosts so each vhost >> >has its own user account on Unix. Now when accessing a webpage, Apache >> >runs with user httpd.. but I want it to run as the user of the vhost >> >account.. How can I do that? >> >> http://httpd.apache.org/docs/suexec.html >> > > The SuEXEC is not good for my purpose, since I want to run PHP as Apache > Module (and not CGI). > I'm using Apache 1.3... does the User / Group directives change the > user/group in case I use Apache Module for PHP? yes > Also, I read about the AssignUserID directive, but couldn't figure out if it > affects Apache Module or only CGI module for PHP? AssignUserID is for apache2 apache2 has a MPM called perchild. with this MPM you can assign a user/group to each vhost (but there is still work in progress...) -> http://httpd.apache.org/docs-2.0/en/mod/perchild.html with apache1.3 and php as apache-module all vhosts have the same user/group what you can do: add the apache-user to each vhost-group and work with open_basedir: ...skip... ...skip... php_admin_value open_basedir "/somedir:/tmp" because some functions ignore open_basedir I also modified disable_functions in php.ini: disable_functions = "exec, passthru, shell_exec, system, proc_open, popen" a more complicated way would be: - create virtual-interfaces in linux - run apache on each interface with different user/group g. tinu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] chunk_split();
maybe its better to use fread() and fseek() 2000 bytes should be 2000 characters in a textfile g. tinu Wed, 28 Jan 2004 11:20:32 -0500 Benjamin TrÃpanier <[EMAIL PROTECTED]>: Hi, I am using the chunk_split(); function to separe a long long text on differents pages. At this time, I can split the string into x sections of 2000 characters. Now I need to show only the first 2000 . when user click on page #2, itÂs reloading and show the next 2000 characters... If he click the page 4 button, itÂs going to the 6000th caracters and it show his next 2000.. etc... How can I split this text on many pages without loosing any characters?? Maybe the chunk_split function is not the good one... Thanks Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] chunk_split();
Wed, 28 Jan 2004 11:41:56 -0500 Benjamin Trépanier <[EMAIL PROTECTED]>: On 28/01/04 11:29, "Martin Luethi" <[EMAIL PROTECTED]> wrote: maybe its better to use fread() and fseek() 2000 bytes should be 2000 characters in a textfile g. tinu Wed, 28 Jan 2004 11:20:32 -0500 Benjamin Trépanier <[EMAIL PROTECTED]>: Hi, I am using the chunk_split(); function to separe a long long text on differents pages. At this time, I can split the string into x sections of 2000 characters. Now I need to show only the first 2000 . when user click on page #2, itÅs reloading and show the next 2000 characters... If he click the page 4 button, itÅs going to the 6000th caracters and it show his next 2000.. etc... How can I split this text on many pages without loosing any characters?? Maybe the chunk_split function is not the good one... Thanks Ben Interesting but my text are from a mySQL DB so, I have to split a text who is content in a variable.. chunk_split($text) What Ca I do? Is there a way to told the server brings me caracters (1,2000) and after by an incrementation 2001- 4001 etc... you can use $text = chunk_split($text, 2000, ""); to insert "" after every 2000 chars. with $testarray = split("", $text); you get an array with your data (each entry is 2000 chars, "" is removed) "" can be anything, just make sure that it never occurs inside the data from mysql. g. tinu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] crypt() sources c# port
download the source code: http://www.php.net/downloads.php or browse online: http://cvs.php.net the crypt() source is under php-src/ext/standard/ g. tinu Thu, 29 Jan 2004 09:54:39 +0100 gerold kathan <[EMAIL PROTECTED]>: hi there - i have user credentials in my DB encrypted with PHPs crypt() function - and should be able to do some user authentication from a c# client - where can i find the source code of PHPs crypt() function so that i can build the same function in c# ? grettings from vienna , gerold. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php