Re: [PHP] Memory Allocation Error
[EMAIL PROTECTED] wrote: Hi! I have a script that reads a 120 MB remote file. This raises a Memory Allocation Error unless I use: ini_set('memory_limit', '130M'); I doubt this is good for my server... I tried both fopen and file_get_contents. This used to work fine in PHP 4 until I upgraded to PHP 5. Any ideas? If you need to keep a 120Mb file in core at any point in time, you'll need the memory. Either adjust the memory-limit, or change your code to process the file in chunks/lines/bytes. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gzuncompress() Not Working.
Casey wrote: When I try gzuncompress() on the same data (I checked), it returns a Data error. I also tried gzinflate() and many user-created gzdecode () functions, with no luck. Did you specify a correct length for gzuncompress() ? From the manpage: The function will return an error if the uncompressed data is more than the optional parameter length. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can I make a process run in background?
Luca Paolella wrote: I want the bot to run a process in background (a periodic message, for example) while listening for events (like a user joining a channel or using a certain command) and consequentially executing the corresponding functions, is it possible? and how? Write a PHP CLI script, then append '' to detach when you start it. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php 4.4.7 configure and sablotron version issue
Edward Vermillion wrote: I don't know enough about the configure test to say there's a bug there, Yes, it's a bug - 1.0.3 will never turn into a floating point number that is 0.96. but then I couldn't figure out how to get it to work either. Tried setting the SAB_VERSION define in sablot.h to 9 just to see if it would work, but no go. Try setting it to 1.03. Finally gave up and removed the xslt stuff from the config options since I don't have a real need for them right now. Be aware that the xslt/sablotron stuff was never ported to PHP5 - you'll likely end up having to migrate anyway. We did. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Chinese input character count
Ronald Wiplinger wrote: I thought I did it correct to define in the header: meta http-equiv=Content-Type content=text/html; charset=utf-8 to display chinese characters correct. It works. However, if you type in a form directly, than each character will be translated to UTF-8 with a sequence of #; I could then count the numbers of # and had the amount of Chinese characters. What do you mean by type in a form directly ? I also use UTF8, and when I store data from a form, they are in UTF8 in my database. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Performance of PHP
Hi there, I am doing some image cropping of about 40.000 files with php. To do this I wrote a PHP file that does what I want and I did disable the timeout so I can call it via webbrowser and fire the script. There are two down sides I see: 1. One image takes about 0.25 s, so the whole process would take about 3 hours. 2. During that time a spider could come along and find that file and fire it again. Is it faster if I would issue this by command line on the linux server? php filename.php Thank you for any help, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] stftime differences on Windows/Linux platforms
Hi All, I'm experiencing some differences in in the return values of strftime on Windows Linux platforms on PHP 5.2.1. I've knocked up a test case to demonstrate the bug: ?php $UNIX_TIME = mktime(0,0,0,5,31,2008); echo Time Made for 31-05-2008: $UNIX_TIME\n; echo Expected Time for 31-05-2008: 1212188400\n; echo Formated generated: . strftime(%d-%m-%Y, $UNIX_TIME) . \n; echo Formated expected: . strftime(%d-%m-%Y, 1212188400) . \n; echo Difference between expected and generated: . ($UNIX_TIME - 1212188400); echo \n\n; ? OUTPUT DEVELOPMENT: C:\php -e c:\test.php Time Made for 31-05-2008: 1212188400 Expected Time for 31-05-2008: 1212188400 Formated generated:31-05-2008 Formated expected: 31-05-2008 Difference between expected and generated: 0 OUTPUT PRODUCTION: Time Made for 31-05-2008: 1212192000 Expected Time for 31-05-2008: 1212188400 Formated generated:31-05-2008 Formated expected: 30-05-2008 Difference between expected and generated: 3600 Development Config: PHP Version 5.2.1 PHP API 20041225 PHP Extension 20060613 Zend Extension 220060519 Production Config: PHP Version 5.2.1 Build Date Apr 25 2007 18:04:12 PHP API 20041225 PHP Extension 20060613 Zend Extension 220060519 Am I missing something obvious here? Any help gratefully received. Cheers, Neil. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Performance of PHP
Merlin wrote: Hi there, I am doing some image cropping of about 40.000 files with php. To do this I wrote a PHP file that does what I want and I did disable the timeout so I can call it via webbrowser and fire the script. There are two down sides I see: 1. One image takes about 0.25 s, so the whole process would take about 3 hours. 2. During that time a spider could come along and find that file and fire it again. Is it faster if I would issue this by command line on the linux server? php filename.php If your site is running on Apache, you can restrict access to spiders. It is quite easy to set up with a .htaccess file in your script directory. Thank you for any help, Merlin -- With Warm Regards, Sudheer. S http://www.binaryvibes.co.in -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] stftime differences on Windows/Linux platforms
On 06/11/2007, Neil Saunders [EMAIL PROTECTED] wrote: Hi All, I'm experiencing some differences in in the return values of strftime on Windows Linux platforms on PHP 5.2.1. I've knocked up a test case to demonstrate the bug: ?php $UNIX_TIME = mktime(0,0,0,5,31,2008); echo Time Made for 31-05-2008: $UNIX_TIME\n; echo Expected Time for 31-05-2008: 1212188400\n; echo Formated generated: . strftime(%d-%m-%Y, $UNIX_TIME) . \n; echo Formated expected: . strftime(%d-%m-%Y, 1212188400) . \n; echo Difference between expected and generated: . ($UNIX_TIME - 1212188400); echo \n\n; ? OUTPUT DEVELOPMENT: C:\php -e c:\test.php Time Made for 31-05-2008: 1212188400 Expected Time for 31-05-2008: 1212188400 Formated generated:31-05-2008 Formated expected: 31-05-2008 Difference between expected and generated: 0 OUTPUT PRODUCTION: Time Made for 31-05-2008: 1212192000 Expected Time for 31-05-2008: 1212188400 Formated generated:31-05-2008 Formated expected: 30-05-2008 Difference between expected and generated: 3600 Development Config: PHP Version 5.2.1 PHP API 20041225 PHP Extension 20060613 Zend Extension 220060519 Production Config: PHP Version 5.2.1 Build Date Apr 25 2007 18:04:12 PHP API 20041225 PHP Extension 20060613 Zend Extension 220060519 Am I missing something obvious here? Any help gratefully received. Well, either the clocks on your dev and production servers are exactly 6 hours out or there's a difference in their locale settings such that one thinks it's in a timezone 6 hours ahead of the other. -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Benchmarking check to see if array key is set
Consider the following test code: ?php $myArray = array(); for( $i = 0; $i = 1; $i++ ) { $date = microtime( TRUE ); $key = rand( $date, $date * rand( 1, 5000 )); $myArray[$key] = $key; } echo '$myArray items created: ' . count( $myArray ) . 'brbr'; $startTime = microtime( TRUE ); $foundCount = 0; for( $i = 0; $i = 1; $i++ ) { $date = microtime( TRUE ); $key = rand( $date, $date * rand( 1, 5000 )); if( array key exists( $key, $myArray )) { $foundCount++; } } $endTime = microtime( TRUE ); echo 'array key exists took [' . ( $endTime - $startTime ) . '] seconds; found: [' . $foundCount . '] keysbrbr'; $startTime = microtime( TRUE ); $foundCount = 0; for( $i = 0; $i = 1; $i++ ) { $date = microtime( TRUE ); $key = rand( $date, $date * rand( 1, 5000 )); if( isset( $myArray[$key] )) { $foundCount++; } } $endTime = microtime( TRUE ); echo 'isset took [' . ( $endTime - $startTime ) . '] seconds; found: [' . $foundCount . '] keysbrbr'; $startTime = microtime( TRUE ); $foundCount = 0; for( $i = 0; $i = 1; $i++ ) { $date = microtime( TRUE ); $key = rand( $date, $date * rand( 1, 5000 )); if( $myArray[$key] ) { $foundCount++; } } $endTime = microtime( TRUE ); echo 'IF() took [' . ( $endTime - $startTime ) . '] seconds; found: [' . $foundCount . '] keysbrbr'; ? Running that I found that if( isset( $myArray[$key] )) is faster than if( array key exists( $key, $myArray )) is faster than if( $myArray[$key] ) To be honest, I was surprised. I would have thought that if( $myArray[$key] ) would have been the fastest way to check. I'm wondering if those in the know could explain why it's the slowest and also where the discrepancies come from w/r/t the difference in the amount of time it takes to make each check. thnx, Chris
[PHP] Re: Performance of PHP
Merlin wrote: Hi there, I am doing some image cropping of about 40.000 files with php. To do this I wrote a PHP file that does what I want and I did disable the timeout so I can call it via webbrowser and fire the script. There are two down sides I see: 1. One image takes about 0.25 s, so the whole process would take about 3 hours. 2. During that time a spider could come along and find that file and fire it again. Is it faster if I would issue this by command line on the linux server? php filename.php Thank you for any help, Regardless of speed etc. (cmdline will have less overhead but probably isn't any faster or slower), I'd say that if you *can* run it via a command line, then why not? You seem to just be using apache as a trigger to start it going which doesn't seem to warrant any real need for a webserver at all. If you don't have access to the cmd line then make the page work with a simple POSTed form or behind a password protected page to stop spiders or other unauthorised people getting to it. Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] stftime differences on Windows/Linux platforms
Hi Robin, Thanks for your reply. The times are exactly synchronized. I'm looking at the date section in the output of phpinfo(), and get the following: Development: D:\Documents and Settings\neil.saundersdate The current date is: 06/11/2007 D:\Documents and Settings\neil.saunderstime The current time is: 12:47:06.46 date date/time support enabled Timezone Database Version 2006.16 Timezone Database internal Default timezoneEurope/London Directive Local Value Master Value date.default_latitude 31.7667 31.7667 date.default_longitude 35.2333 35.2333 date.sunrise_zenith 90.58 90.58 date.sunset_zenith 90.58 90.58 date.timezone no valueno value Production: [~]# date Tue Nov 6 12:49:25 GMT 2007 date date/time support enabled Timezone Database Version 2006.16 Timezone Database internal Default timezoneUTC Directive Local Value Master Value date.default_latitude 31.7667 31.7667 date.default_longitude 35.2333 35.2333 date.sunrise_zenith 90.58 90.58 date.sunset_zenith 90.58 90.58 date.timezone no valueno value Although the timezones are different, my understanding is the UTC is a synonym for GMT, which is based in London. This appears to be confirmed by looking at the default latitudes and longitudes and they match up. Either way, setting the timezone to Europe/London in production fixed the issue. Thanks again for your help. Cheers, Neil. On Nov 6, 2007 12:01 PM, Robin Vickery [EMAIL PROTECTED] wrote: On 06/11/2007, Neil Saunders [EMAIL PROTECTED] wrote: Hi All, I'm experiencing some differences in in the return values of strftime on Windows Linux platforms on PHP 5.2.1. I've knocked up a test case to demonstrate the bug: ?php $UNIX_TIME = mktime(0,0,0,5,31,2008); echo Time Made for 31-05-2008: $UNIX_TIME\n; echo Expected Time for 31-05-2008: 1212188400\n; echo Formated generated: . strftime(%d-%m-%Y, $UNIX_TIME) . \n; echo Formated expected: . strftime(%d-%m-%Y, 1212188400) . \n; echo Difference between expected and generated: . ($UNIX_TIME - 1212188400); echo \n\n; ? OUTPUT DEVELOPMENT: C:\php -e c:\test.php Time Made for 31-05-2008: 1212188400 Expected Time for 31-05-2008: 1212188400 Formated generated:31-05-2008 Formated expected: 31-05-2008 Difference between expected and generated: 0 OUTPUT PRODUCTION: Time Made for 31-05-2008: 1212192000 Expected Time for 31-05-2008: 1212188400 Formated generated:31-05-2008 Formated expected: 30-05-2008 Difference between expected and generated: 3600 Development Config: PHP Version 5.2.1 PHP API 20041225 PHP Extension 20060613 Zend Extension 220060519 Production Config: PHP Version 5.2.1 Build Date Apr 25 2007 18:04:12 PHP API 20041225 PHP Extension 20060613 Zend Extension 220060519 Am I missing something obvious here? Any help gratefully received. Well, either the clocks on your dev and production servers are exactly 6 hours out or there's a difference in their locale settings such that one thinks it's in a timezone 6 hours ahead of the other. -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Performance of PHP
Merlin wrote: Hi there, I am doing some image cropping of about 40.000 files with php. If you're worried about performance, maybe why not use mogrify from ImageMagick? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: stftime differences on Windows/Linux platforms
Neil Saunders wrote: Hi Robin, Thanks for your reply. The times are exactly synchronized. I'm looking at the date section in the output of phpinfo(), and get the following: Development: Default timezone Europe/London Production: Default timezone UTC Could this be the problem? UTC = GMT +0, Europe/London = GMT in winter and BST (GMT+1) in summer.. Could the date you are using flip over the boundary and give you weird results? You are exactly 1 hour out afterall Try using a test date from January or February and I'll bet you don't get those problems. Col. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gzuncompress() Not Working.
I left that empty. The decompressed string is about 224 KB, so it shouldn't throw an error. Thanks for the reply! On Nov 6, 2007 12:25 AM, Per Jessen [EMAIL PROTECTED] wrote: Casey wrote: When I try gzuncompress() on the same data (I checked), it returns a Data error. I also tried gzinflate() and many user-created gzdecode () functions, with no luck. Did you specify a correct length for gzuncompress() ? From the manpage: The function will return an error if the uncompressed data is more than the optional parameter length. /Per Jessen, Zürich -- 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] PHP Won't Access Files Outside Web Root (Leopard/MacOS X 10.5)
On 11/2/07 11:12 AM, Daniel Brown [EMAIL PROTECTED] wrote: Rahul, I believe all of the modern MacOS variants still use the *nix-style (due to being based on BSD) rc.d startups, right? If so: sudo echo sudo -u www mount_smbfs -f 0777 -d 0777 //usr:[EMAIL PROTECTED]/share node /etc/rc.d/init.d/winsharemount sudo chmod 755 /etc/rc.d/init.d/windsharemount sudo ln -s /etc/rc.d/init.d/winsharemount /etc/rc.d/rc3.d/S74winsharemount sudo ln -s /etc/rc.d/init.d/winsharemount /etc/rc.d/rc5.d/S74winsharemount That should help automate it on startup in single-user and multi-user mode (rc3 and rc5, respectively). Daniel, I couldn't find an /etc/rd.d or rc3.d on my system at all. I've been manually mounting after each boot, so still looking for an automated mounting solution. Thought I'd let you know. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Memory Allocation Error
Thank you! That works. On Nov 6, 2007 12:23 AM, Per Jessen [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Hi! I have a script that reads a 120 MB remote file. This raises a Memory Allocation Error unless I use: ini_set('memory_limit', '130M'); I doubt this is good for my server... I tried both fopen and file_get_contents. This used to work fine in PHP 4 until I upgraded to PHP 5. Any ideas? If you need to keep a 120Mb file in core at any point in time, you'll need the memory. Either adjust the memory-limit, or change your code to process the file in chunks/lines/bytes. /Per Jessen, Zürich -- 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] stftime differences on Windows/Linux platforms
On 06/11/2007, Neil Saunders [EMAIL PROTECTED] wrote: Hi Robin, Thanks for your reply. The times are exactly synchronized. I'm looking at the date section in the output of phpinfo(), and get the following: Development Default timezoneEurope/London Production: Default timezoneUTC Although the timezones are different, my understanding is the UTC is a synonym for GMT, which is based in London. This appears to be confirmed by looking at the default latitudes and longitudes and they match up. Either way, setting the timezone to Europe/London in production fixed the issue. Thanks again for your help. Aye, sorry. I don't know what I was thinking, when I said six hours; the difference is of course 60 minutes. The Dev server is in Europe/London, which is adjusted by an hour during British Summer Time. The production server was using UTC. Because the date (31 May) was within BST, there was an hour difference between the two. -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can I make a process run in background?
Per Jessen wrote: Luca Paolella wrote: I want the bot to run a process in background (a periodic message, for example) while listening for events (like a user joining a channel or using a certain command) and consequentially executing the corresponding functions, is it possible? and how? Write a PHP CLI script, then append '' to detach when you start it. /Per Jessen, Zürich This method will work until you log out, when you log out all your background processes are killed. If it were to be a CLI and you wanted it to run constantly and you manually wanted to control it, I would use screen. Screen allows you to start a new terminal, start something, and then detach from that screen. Then you are allowed to log out and the next time you log in, you are able to resume the previous terminal session. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Benchmarking check to see if array key is set
On 06 November 2007 12:57, Christoph Boget wrote: Consider the following test code: [...snip...] Running that I found that if( isset( $myArray[$key] )) is faster than if( array key exists( $key, $myArray )) is faster than if( $myArray[$key] ) To be honest, I was surprised. I would have thought that if( $myArray[$key] ) would have been the fastest way to check. I'm wondering if those in the know could explain why it's the slowest and also where the discrepancies come from w/r/t the difference in the amount of time it takes to make each check. OK, I'll take a stab. Firstly, isset() is a language construct not an actual function, so the only thing your isset() does is check whether the array element exists. Next, array_key_exists() is the only one that involves a real function call, so it's going to bear that cost. However, the function then does a pretty simple test which again only involves checking whether the key exists, so the function itself is going to be pretty quick. Finally, the if() is the only one that actually gets the value in $myArray[$key], and then casts it to Boolean to boot, and the cost of this must therefore outweigh the cost of a function call plus a check for a key's existence. I'm certainly not surprised that isset() is the quickest, because it does the simplest test, but to be honest I'm not sure if I'd have predicted the relative positions of the other two. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, JG125, The Headingley Library, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 812 4730 Fax: +44 113 812 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can I make a process run in background?
Jim Lucas wrote: This method will work until you log out, when you log out all your background processes are killed. man nohup. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php-pecl-session_mysql
I install php-pecl-session_mysql and I config my php.ini in this way session.save_handler = mysql but this error appear: Warning: session_start() [function.session-start]: Cannot find save handler mysql in /var/www/mysite/core/users.php on line 45 I just folow the instructions in the session_mysql.ini config file. Este correo ha sido enviado desde el Politécnico de Informática Carlos Marx de Matanzas. La gran batalla se librará en el campo de las ideas
[PHP] Regular Expressions
I'm a mess in regular expressions and I make this code: $link = ereg_replace('ntilde;','n',$link); $link = ereg_replace('aacute;','a',$link); $link = ereg_replace('eacute;','e',$link); $link = ereg_replace('iacute;','i',$link); $link = ereg_replace('oacute;','o',$link); $link = ereg_replace('uacute;','u',$link); I ask if is a way to make those lines into a single one but working as well as this piece. I'm thinking in increase those lines so will be wonderful if I can optimize the code. Este correo ha sido enviado desde el Politécnico de Informática Carlos Marx de Matanzas. La gran batalla se librará en el campo de las ideas
Re: [PHP] More info on timeout problem, with code
On 11/5/07, Jon Westcot [EMAIL PROTECTED] wrote: Hi all: As requested, here's the code: ?php if(isset($_POST['process'])){ $old_session_gc_maxlifetime = ; $old_max_execution_time = ; $old_max_input_time = ; $old_session_gc_maxlifetime = ini_set(session.gc_maxlifetime,1800); $old_max_execution_time = ini_set(max_execution_time,1800); // 30 minutes $old_max_input_time = ini_set(max_input_time,1800); // 30 minutes -- doesn't work echo pSession.gc_maxlifetime: . ini_get(session.gc_maxlifetime) . /p\n; // shows 1800 echo pMax execution time: . ini_get(max_execution_time) . /p\n; // shows 1800 echo pMax input time: . ini_get(max_input_time) . /p\n; // shows -1 ignore_user_abort(TRUE); set_time_limit(0); $query = mysql_query(TRUNCATE evall;); ^ From The Manual... ** *mysql_query* A SQL query The query string should ___not___ end with a semicolon. echo pResults of Truncate: $query/p\n; $myfile_replace = uploads/evall.csv; $handle = @fopen($myfile_replace, 'rb'); $save_handle = @fopen(tmp/sql_calls.txt, wb); $process_count = 0; if(!$handle) { echo pThe file ($myfile_replace) could not be opened.br //p\n; flush(); } else { echo pThe file ($myfile_replace) opened correctly.br //p\n; flush(); $headings = fgetcsv($handle, 1, ,); // Just ignore the first row returned. $row = 0; while (($data = fgetcsv($handle, 1, ,)) !== FALSE) { $row++; $num = count($data); $insert_query = INSERT INTO evall VALUES(; for ($c=0; $c $num; $c++) { if($c 0) { $insert_query .= ,; } $insert_query .= '' . $data[$c] . ''; } $insert_query .= );; if(fwrite($save_handle, $row . ; . strlen($insert_query) . : . \n) === FALSE) { echo pThe query could not be written./p\n; } else { $process_count++; } if($row % 1000 == 0) { echo $row records processed so farbr /\n; flush(); } } echo pFile import completed. $row records read; $process_count records added./p\n; flush(); fclose($save_handle); fclose($handle); } ini_set(session.gc_maxlifetime,$old_session_gc_maxlifetime); ini_set(max_execution_time,$old_max_execution_time); ini_set(max_input_time,$old_max_input_time); } ? form name=form enctype=multipart/form-data action=?php echo $_SERVER['PHP_SELF']; ? method=POST pVersion 1.9 -- The file uploading process presupposes that the user has uploaded the EVAll.CSV file to the quot;uploadsquot; folder. If this has been done and you're ready to process it, click the lt;Processgt; button./p input type=submit name=process value=Process /br/br/ /form hth, David
Re: [PHP] Can I make a process run in background?
oops, didn't mean to reply off list. SORRY LIST! here is what I said. This method will work until you log out, when you log out all your background processes are killed. If it were to be a CLI and you wanted it to run constantly and you manually wanted to control it, I would use screen. Screen allows you to start a new terminal, start something, and then detach from that screen. Then you are allowed to log out and the next time you log in, you are able to resume the previous terminal session. Per Jessen wrote: Jim Lucas wrote: This method will work until you log out, when you log out all your background processes are killed. man nohup. good point /Per Jessen, Zürich -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More info on timeout problem, with code
Hi David, et al.: Thanks for the comment. I removed the trailing semi-colon in the two areas where it was being sent to mysql_query() and tried the code again. I'm still getting the same basic problem -- it silently aborts somewhere around 22,000 to 26,000 records being processed out of just under 30,000. When I don't build the $insert_query string, I am able to read through the CSV file completely. As odd as this sounds, should I put in some type of delay? Could the system be thinking it's getting flooded by all of the inserts? Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] crop an image
Does anyone have some insight here? I am trying to crop an image. The crop seems to almost work, but I get black bars on the image. Has anyone had any experience with cropping images using the GD library? Thanks. Chris On Nov 2, 2007, at 5:41 PM, Chris Bruce wrote: What was the solution here? I am trying to crop but am getting a black bar the same height as the crop at top. For this image I want to crop 40 pixels off of the top: $image_p = imagecreatetruecolor($width, $height); $image = imagecreatefromjpeg($jpegpath); imagecopyresampled($image_p, $image, 0, 0, 0, 40, 765, 810, 665, 1000) imagejpeg($image_p, $destImage, 75); How do I merely crop x pixels from an image without having black bars? I have tried the x coordinate too with the same result. Thanks, Chris On Oct 31, 2007, at 8:58 AM, Merlin wrote: Merlin schrieb: Hi everybody, I am still strugling with the crop problem. It looks like it is not possible with PHP to do an imagecopyresampled and and imagecopy on the same image. Here is what I try to do: 1: Resize image to 80px width and correct ratio 2: Crop from that image a 80x60 part Both work for themselfes, but not together. Does anybody see the problem? $outputImg = ImageCreateTrueColor($maxX, $dstY); imagecopyresampled($outputImg, $inputImg, $posX, $posY,0,0, $picX, $picY, $srcX, $srcY); $outputImg = ImageCreateTrueColor(80, 60); imagecopy($outputImg, $inputImg, 0,0 , 0, 250, $picX, $picY); If I leave the second imagecreate away, the image will be copied into the bigger size and is not 80x60. Thank you for any help. Merlin David Christopher Zentgraf schrieb: Copying half a pixel? I dare say that's where the problem is. Chrs, Dav On 31 Oct 2007, at 19:34, Merlin wrote: Hi there, I do have a small problem with the proportions of image copy The image is originally vertical in 100px width and 141px height. Now I want to crop it to 80 px width and 60px height. There should be no black area and the proportions should be OK. That means that I have to copy only part of the image. In this case it would be 40.5px from above (141-60 / 2 ) and until 100.5 (40.5+60). This would crop the middle part of the image. Now with imagecoyresampled I can set the starting point of 40.5px, but not the ending point. The image will have a black bottom. Here is the code I am using: imagecopyresampled($outputImg, $inputImg, 0,0, 0 , 40.5, 80, 60, $srcX, $srcY); Thank you for any hint. Maybe somebody has a good idea on how to crop that image. Best regards, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php got it, sorrry for the confusion. I mixed up the lables. -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can I make a process run in background?
if youre running linux, you might also want to consider disown. -nathan
Re: [PHP] Can I make a process run in background?
You could CRON the script, write a simple bash script that polls the server and if the php script is not running, restarts it. * * * * * * /path/to/php php script name Wolf Jim Lucas [EMAIL PROTECTED] wrote: oops, didn't mean to reply off list. SORRY LIST! here is what I said. This method will work until you log out, when you log out all your background processes are killed. If it were to be a CLI and you wanted it to run constantly and you manually wanted to control it, I would use screen. Screen allows you to start a new terminal, start something, and then detach from that screen. Then you are allowed to log out and the next time you log in, you are able to resume the previous terminal session. Per Jessen wrote: Jim Lucas wrote: This method will work until you log out, when you log out all your background processes are killed. man nohup. good point /Per Jessen, Zürich -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- 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] crop an image
On Nov 6, 2007, at 10:20 AM, Chris Bruce wrote: Does anyone have some insight here? I am trying to crop an image. The crop seems to almost work, but I get black bars on the image. Has anyone had any experience with cropping images using the GD library? Thanks. Chris On Nov 2, 2007, at 5:41 PM, Chris Bruce wrote: What was the solution here? I am trying to crop but am getting a black bar the same height as the crop at top. For this image I want to crop 40 pixels off of the top: $image_p = imagecreatetruecolor($width, $height); $image = imagecreatefromjpeg($jpegpath); imagecopyresampled($image_p, $image, 0, 0, 0, 40, 765, 810, 665, 1000) try imagecopyresampled($image_p, $image, 0, 0, 0, 0, 765, 810, 665, 1000) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular Expressions
Maybe this helps ?php $line = preg_replace_callback( '/(aacute;|eacute;|iacute;|oacute;|uacute;|ntilde;)/', create_function( // single quotes are essential here, // or alternative escape all $ as \$ '$matches', 'switch($matches[0]){ case \'aacute;\': return \'a\'; case \'eacute;\': return \'e\'; case \'iacute;\': return \'i\'; case \'oacute;\': return \'o\'; case \'uacute;\': return \'u\'; case \'ntilde;\': return \'n\'; }' ), $line ); echo $line; ? if you want to use this functionality several times: ?php function myReplace($chr) { switch($chr[0]){ case 'aacute;': return 'a'; case 'eacute;': return 'e'; case 'iacute;': return 'i'; case 'oacute;': return 'o'; case 'uacute;': return 'u'; case 'ntilde;': return 'n'; } } $line = Hola que tal con aacute; con acento y entilde;e ; $line = preg_replace_callback( '/(aacute;|eacute;|iacute;|oacute;|uacute;|ntilde;)/', 'myReplace', $line ); echo $line; ? hope this helps. Note that these are pcre (Perl Compatible RegEx). Alberto García Gómez wrote: I'm a mess in regular expressions and I make this code: $link = ereg_replace('ntilde;','n',$link); $link = ereg_replace('aacute;','a',$link); $link = ereg_replace('eacute;','e',$link); $link = ereg_replace('iacute;','i',$link); $link = ereg_replace('oacute;','o',$link); $link = ereg_replace('uacute;','u',$link); I ask if is a way to make those lines into a single one but working as well as this piece. I'm thinking in increase those lines so will be wonderful if I can optimize the code. Este correo ha sido enviado desde el Politécnico de Informática Carlos Marx de Matanzas. La gran batalla se librará en el campo de las ideas -- Ezequiel Gutesman Researcher Corelabs Core Security Technologies http://www.coresecurity.com/corelabs PGP Figerprint: 01E4 0E4F 83F8 2D5D 8050 0449 7156 1DF6 C2B3 34AE -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A workaround for type hinting native types (and a little of self-advertising)
$me-apologizeFor($this-isSelfAdvertising()); if ($you-lookingFor($php-workaround(TYPE_HINT_FOR_NATIVE_TYPES)) { check('http://www.phpclasses.org/browse/package/4195.html'); } $package = new Package('http://www.phpclasses.org/browse/package/4195.html' ); $package-usageExample = EXAMPLE function test(int $n) { } test(1); test(2); // string representation of an int is OK test(1.2); // not an int, fails // there are also type hints for strictly checking types: StrictInt, StrictString, etc EXAMPLE; $package-isExtendable = true; $package-extensionExample = EXAMPLE final class EmailAddress implements TypeHint { private function __construct() { } public static function isTypeHintFor($value) { ... regexp check for $value ... } } sendMail(EmailAddress $email, ) { } sendMail('[EMAIL PROTECTED]', ...); EXAMPLE; echo Regards, \n Martin Alterisio;
Re: [PHP] Regular Expressions
you could do it without any function ?php $line = Hola que tal con aacute; con acento y entilde;e \n; echo preg_replace('/([aeioun])(acute|tilde);/i','\1',$line); ? On Nov 6, 2007 2:44 PM, Ezequiel Gutesman [EMAIL PROTECTED] wrote: Maybe this helps ?php $line = preg_replace_callback( '/(aacute;|eacute;|iacute;|oacute;|uacute;|ntilde;)/', create_function( // single quotes are essential here, // or alternative escape all $ as \$ '$matches', 'switch($matches[0]){ case \'aacute;\': return \'a\'; case \'eacute;\': return \'e\'; case \'iacute;\': return \'i\'; case \'oacute;\': return \'o\'; case \'uacute;\': return \'u\'; case \'ntilde;\': return \'n\'; }' ), $line ); echo $line; ? if you want to use this functionality several times: ?php function myReplace($chr) { switch($chr[0]){ case 'aacute;': return 'a'; case 'eacute;': return 'e'; case 'iacute;': return 'i'; case 'oacute;': return 'o'; case 'uacute;': return 'u'; case 'ntilde;': return 'n'; } } $line = Hola que tal con aacute; con acento y entilde;e ; $line = preg_replace_callback( '/(aacute;|eacute;|iacute;|oacute;|uacute;|ntilde;)/', 'myReplace', $line ); echo $line; ? hope this helps. Note that these are pcre (Perl Compatible RegEx). Alberto García Gómez wrote: I'm a mess in regular expressions and I make this code: $link = ereg_replace('ntilde;','n',$link); $link = ereg_replace('aacute;','a',$link); $link = ereg_replace('eacute;','e',$link); $link = ereg_replace('iacute;','i',$link); $link = ereg_replace('oacute;','o',$link); $link = ereg_replace('uacute;','u',$link); I ask if is a way to make those lines into a single one but working as well as this piece. I'm thinking in increase those lines so will be wonderful if I can optimize the code. Este correo ha sido enviado desde el Politécnico de Informática Carlos Marx de Matanzas. La gran batalla se librará en el campo de las ideas -- Ezequiel Gutesman Researcher Corelabs Core Security Technologies http://www.coresecurity.com/corelabs PGP Figerprint: 01E4 0E4F 83F8 2D5D 8050 0449 7156 1DF6 C2B3 34AE -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can not run PHP pages in Apache
First time poster, so please bear with me... I have installed Apache 1.3 and PHP 5.2.4. I am now trying to install Zen Cart. When accessing the Zen Cart setup, the PHP files are not read. I simply get a directory listing of files instead of execution of the index.php. Seems I have missed something in the config files. When I run php -v, everything seems to be fine with PHP, I just do not run PHP files. Any help is greatly appreciated. -- View this message in context: http://www.nabble.com/Can-not-run-PHP-pages-in-Apache-tf4759553.html#a13611132 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Won't Access Files Outside Web Root (Leopard/MacOS X 10.5)
On 11/6/07, Rahul S. Johari [EMAIL PROTECTED] wrote: I couldn't find an /etc/rd.d or rc3.d on my system at all. I've been manually mounting after each boot, so still looking for an automated mounting solution. look for /etc/fstab -nathan
Re: [PHP] Can I make a process run in background?
Hi, I'm very grateful for your help (thanks to everybody!), but maybe I didn't explain myself correctly, I'm sorry. What I need is the bot to log onto the server and, being logged as a user, to send some periodic messages on a channel (Bot Hello!) while listening for events and reacting consequentially (User !say Hi Bot Hi), so running two parallel scripts that connect separately won't do. A friend of mine suggested me a solution: he said that maybe two php scripts could share the same connection to the irc server so that while the first one processes the events, the second one acts in background, is it possible? The script already runs via terminal, anyway, on Linux (Debian) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can not run PHP pages in Apache
On 11/6/07, SFWahoo [EMAIL PROTECTED] wrote: I have installed Apache 1.3 and PHP 5.2.4. I am now trying to install Zen Cart. When accessing the Zen Cart setup, the PHP files are not read. I simply get a directory listing of files instead of execution of the index.php. Seems I have missed something in the config files. When I run php -v, everything seems to be fine with PHP, I just do not run PHP files. That sounds like your DirectoryIndex directive needs to be updated. Check your httpd.conf file and make sure it looks [something] like this: IfModule mod_dir.c DirectoryIndex index.html index.wml index.cgi index.shtml index.jsp index.js index.jp index.php4 index.php3 index.php index.phtml index.htm default.htm default.html home.htm /IfModule Also be sure to check that you have these lines: AddHandler application/x-httpd-php .php .php4 .php3 .phtml AddHandler application/x-httpd-php-source .phps AddType application/x-httpd-php .php .php4 .php3 .phtml AddType application/x-httpd-php-source .phps Once you've added those lines, just restart Apache. Keep in mind (you, too, archive readers!) that this is httpd 1.3.x-specific, and the syntax won't work on 2.x. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular Expressions
True, but you'll have to change the rexex not to match, 'nacute;' or 'atilde; for example (unless you want it) Thiago Ferreira wrote: you could do it without any function ?php $line = Hola que tal con aacute; con acento y entilde;e \n; echo preg_replace('/([aeioun])(acute|tilde);/i','\1',$line); ? On Nov 6, 2007 2:44 PM, Ezequiel Gutesman [EMAIL PROTECTED] wrote: Maybe this helps ?php $line = preg_replace_callback( '/(aacute;|eacute;|iacute;|oacute;|uacute;|ntilde;)/', create_function( // single quotes are essential here, // or alternative escape all $ as \$ '$matches', 'switch($matches[0]){ case \'aacute;\': return \'a\'; case \'eacute;\': return \'e\'; case \'iacute;\': return \'i\'; case \'oacute;\': return \'o\'; case \'uacute;\': return \'u\'; case \'ntilde;\': return \'n\'; }' ), $line ); echo $line; ? if you want to use this functionality several times: ?php function myReplace($chr) { switch($chr[0]){ case 'aacute;': return 'a'; case 'eacute;': return 'e'; case 'iacute;': return 'i'; case 'oacute;': return 'o'; case 'uacute;': return 'u'; case 'ntilde;': return 'n'; } } $line = Hola que tal con aacute; con acento y entilde;e ; $line = preg_replace_callback( '/(aacute;|eacute;|iacute;|oacute;|uacute;|ntilde;)/', 'myReplace', $line ); echo $line; ? hope this helps. Note that these are pcre (Perl Compatible RegEx). Alberto García Gómez wrote: I'm a mess in regular expressions and I make this code: $link = ereg_replace('ntilde;','n',$link); $link = ereg_replace('aacute;','a',$link); $link = ereg_replace('eacute;','e',$link); $link = ereg_replace('iacute;','i',$link); $link = ereg_replace('oacute;','o',$link); $link = ereg_replace('uacute;','u',$link); I ask if is a way to make those lines into a single one but working as well as this piece. I'm thinking in increase those lines so will be wonderful if I can optimize the code. Este correo ha sido enviado desde el Politécnico de Informática Carlos Marx de Matanzas. La gran batalla se librará en el campo de las ideas -- Ezequiel Gutesman Researcher Corelabs Core Security Technologies http://www.coresecurity.com/corelabs PGP Figerprint: 01E4 0E4F 83F8 2D5D 8050 0449 7156 1DF6 C2B3 34AE -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Ezequiel Gutesman Researcher Corelabs Core Security Technologies http://www.coresecurity.com/corelabs PGP Figerprint: 01E4 0E4F 83F8 2D5D 8050 0449 7156 1DF6 C2B3 34AE -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Won't Access Files Outside Web Root (Leopard/MacOS X 10.5)
On 11/6/07 12:03 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: On 11/6/07, Rahul S. Johari [EMAIL PROTECTED] wrote: I couldn't find an /etc/rd.d or rc3.d on my system at all. I've been manually mounting after each boot, so still looking for an automated mounting solution. look for /etc/fstab -nathan Nathan, Found /etc/fstab.hd ... But it's contents are conspicuous: IGNORE THIS FILE. This file does nothing, contains no useful data, and might go away in future releases. Do not depend on this file or its contents. !!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can I make a process run in background?
Actually, what you are looking for is an eggdrop bot which is written in TCL. PHP in my humble opinion was not designed to handle something like that as it requires realtime processing. Someone correct me if I'm wrong but that isn't what PHP was designed to do was it? There are many eggdrop bots out there and are very easy to setup and administer. On Nov 6, 2007, at 12:05 PM, Luca Paolella wrote: Hi, I'm very grateful for your help (thanks to everybody!), but maybe I didn't explain myself correctly, I'm sorry. What I need is the bot to log onto the server and, being logged as a user, to send some periodic messages on a channel (Bot Hello!) while listening for events and reacting consequentially (User !say Hi Bot Hi), so running two parallel scripts that connect separately won't do. A friend of mine suggested me a solution: he said that maybe two php scripts could share the same connection to the irc server so that while the first one processes the events, the second one acts in background, is it possible? The script already runs via terminal, anyway, on Linux (Debian) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Allowed path in VHosts
Is there some directive that configure a vistual host to only see inside a path eg.: /var/www/users/user1 Este correo ha sido enviado desde el Polit�cnico de Inform�tica Carlos Marx de Matanzas. La gran batalla se librar� en el campo de las ideas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Disabling Functions And Clasess
Can I use -dissable_classes- and -dissable_functions- directives inside Apache virtual host configuration using php_value directive. Este correo ha sido enviado desde el Politécnico de Informática Carlos Marx de Matanzas. La gran batalla se librará en el campo de las ideas
Re: [PHP] PHP Won't Access Files Outside Web Root (Leopard/MacOS X 10.5)
On 11/6/07, Rahul S. Johari [EMAIL PROTECTED] wrote: On 11/6/07 12:03 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: On 11/6/07, Rahul S. Johari [EMAIL PROTECTED] wrote: I couldn't find an /etc/rd.d or rc3.d on my system at all. I've been manually mounting after each boot, so still looking for an automated mounting solution. look for /etc/fstab -nathan Nathan, Found /etc/fstab.hd ... But it's contents are conspicuous: IGNORE THIS FILE. This file does nothing, contains no useful data, and might go away in future releases. Do not depend on this file or its contents. !!! perhaps if you google around on something like mac os x /etc/fstab something useful will turn up. im sure there is an alternative mechanism to mount things at boot time on that system. -nathan
Re: [PHP] Allowed path in VHosts
Alberto García Gómez wrote: Is there some directive that configure a vistual host to only see inside a path eg.: /var/www/users/user1 An apache virtual host will normally not look outside its DocumentRoot, but you can allow it do so. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can I make a process run in background?
Jason Pruim wrote: Actually, what you are looking for is an eggdrop bot which is written in TCL. PHP in my humble opinion was not designed to handle something like that as it requires realtime processing. Someone correct me if I'm wrong but that isn't what PHP was designed to do was it? I would tend to agree with you, but PHP has been made to do a lot of things it was never really designed for. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Disabling Functions And Clasess
On 11/6/07, Alberto García Gómez [EMAIL PROTECTED] wrote: Can I use -dissable_classes- and -dissable_functions- directives inside Apache virtual host configuration using php_value directive. all you have to do is check the doc on php.ini directives. the answer in this case to both directives is no; they can only be set in php.ini. http://us.php.net/manual/en/ini.php -nathan
Re: [PHP] PHP Won't Access Files Outside Web Root (Leopard/MacOS X 10.5)
On 11/6/07 12:57 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: On 11/6/07, Rahul S. Johari [EMAIL PROTECTED] wrote: On 11/6/07 12:03 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: On 11/6/07, Rahul S. Johari [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: I couldn't find an /etc/rd.d or rc3.d on my system at all. I've been manually mounting after each boot, so still looking for an automated mounting solution. look for /etc/fstab -nathan Nathan, Found /etc/fstab.hd ... But it's contents are conspicuous: IGNORE THIS FILE. This file does nothing, contains no useful data, and might go away in future releases. Do not depend on this file or its contents. !!! perhaps if you google around on something like mac os x /etc/fstab something useful will turn up. im sure there is an alternative mechanism to mount things at boot time on that system. -nathan Oh I've been living off of Google since I upgraded to Leopard ;) The problem is, Leopard is so new, there's not so much information out there yet about various services issues coming up with Leopard. Back when I had Panther (10.3.9), it was a quick jump on Google that would rid me of all Worldly Problems. Information is very slowly trickling out about things in Leopard - they just changed SO MANY things in Leopard, it's not even funny. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can I make a process run in background?
On Tue, 2007-11-06 at 18:05 +0100, Luca Paolella wrote: Hi, I'm very grateful for your help (thanks to everybody!), but maybe I didn't explain myself correctly, I'm sorry. What I need is the bot to log onto the server and, being logged as a user, to send some periodic messages on a channel (Bot Hello!) while listening for events and reacting consequentially (User !say Hi Bot Hi), so running two parallel scripts that connect separately won't do. A friend of mine suggested me a solution: he said that maybe two php scripts could share the same connection to the irc server so that while the first one processes the events, the second one acts in background, is it possible? The script already runs via terminal, anyway, on Linux (Debian) This can be done quite easily using shared memory and/or a database to share data between the scripts. Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can I make a process run in background?
On Tue, 2007-11-06 at 19:33 +0100, Per Jessen wrote: Jason Pruim wrote: Actually, what you are looking for is an eggdrop bot which is written in TCL. PHP in my humble opinion was not designed to handle something like that as it requires realtime processing. Someone correct me if I'm wrong but that isn't what PHP was designed to do was it? I would tend to agree with you, but PHP has been made to do a lot of things it was never really designed for. So many more things. It's my first choice for shell scripting especially as ties into web projects since all the code can be shared. Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Won't Access Files Outside Web Root (Leopard/MacOS X 10.5) *SOLVED*
On 11/6/07 12:57 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: perhaps if you google around on something like mac os x /etc/fstab something useful will turn up. im sure there is an alternative mechanism to mount things at boot time on that system. -nathan For whatever reason, when I first attempted this following AppleScript, it didn't work - for whatever reason - coming back to it and trying it again, it simply just Worked! I've set it to run on Login and it's actually working fine. Rebooted my system a couple of times and it automatically mounted the shares with designated permissions each time upon boot up. ~~~ do shell script sudo -u www mount_smbfs -f 0777 -d 0777 //usr:[EMAIL PROTECTED]/Transfer /Library/WebServer/Documents/mysite/mounts/osm password pwd with administrator privileges do shell script sudo -u www mount_smbfs -f 0777 -d 0777 //usr2:[EMAIL PROTECTED]/VOX /Library/WebServer/Documents/mysite/mounts/vox password pwd with administrator privileges activate display dialog Connections to Server Established. -SHARE1 Mounted! -SHARE2 Mounted! ~~~ I guess I can officially consider this case closed with all problems solved! Thanks All! ~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can I make a process run in background?
This can be done quite easily using shared memory and/or a database to share data between the scripts. Really? could you give me a little briefing about this method? Actually, what you are looking for is an eggdrop bot which is written in TCL. PHP in my humble opinion was not designed to handle something like that as it requires realtime processing. Someone correct me if I'm wrong but that isn't what PHP was designed to do was it? There are many eggdrop bots out there and are very easy to setup and administer. Yeah, I know, but as I said in my first message I'm unfortunately tied to php; that's because I need some very specific functions that aren't standard at all (thus I have to script them myself and php is the only language I'm enough familiar with), plus I need to be always able to edit them (so again, I need to know the language) according to the needs. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] More info on timeout problem, with code
Thanks for the comment. I removed the trailing semi-colon in the two areas where it was being sent to mysql_query() and tried the code again. I'm still getting the same basic problem -- it silently aborts somewhere around 22,000 to 26,000 records being processed out of just under 30,000. When I don't build the $insert_query string, I am able to read through the CSV file completely. As odd as this sounds, should I put in some type of delay? Could the system be thinking it's getting flooded by all of the inserts? I didn't know you were on a shared server. I think your first problem is getting your 50+ MB file transfered/uploaded. Maybe it can be FTP'd from authenticated users, then a cronjob can run to check the directory for unprocessed uploaded files, then parse it to create the TRUSTED SQL statement and maybe even use LOAD DATA INFILE. _ Peek-a-boo FREE Tricks Treats for You! http://www.reallivemoms.com?ocid=TXT_TAGHMloc=us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular Expressions
Alberto García Gómez wrote: I'm a mess in regular expressions and I make this code: $link = ereg_replace('ntilde;','n',$link); $link = ereg_replace('aacute;','a',$link); $link = ereg_replace('eacute;','e',$link); $link = ereg_replace('iacute;','i',$link); $link = ereg_replace('oacute;','o',$link); $link = ereg_replace('uacute;','u',$link); I ask if is a way to make those lines into a single one but working as well as this piece. I'm thinking in increase those lines so will be wonderful if I can optimize the code. Este correo ha sido enviado desde el Politécnico de Informática Carlos Marx de Matanzas. La gran batalla se librará en el campo de las ideas ?php $replacements = array( 'ntilde;' = 'n', 'aacute;' = 'a', 'eacute;' = 'e', 'iacute;' = 'i', 'oacute;' = 'o', 'uacute;' = 'u', ); $out = str_replace(array_keys($replacements), array_values($replacements), $in); -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can not run PHP pages in Apache
Thanks. And this did work. Or at least I am able to access php pages. Given your comment about 1.3 vs. 2.2, I upgraded to 2.2. And I now have a different issue. When accessing a PHP page the Apache HTTP Server process crashes or I get a memory error. Any ideas? Daniel Brown-5 wrote: On 11/6/07, SFWahoo [EMAIL PROTECTED] wrote: I have installed Apache 1.3 and PHP 5.2.4. I am now trying to install Zen Cart. When accessing the Zen Cart setup, the PHP files are not read. I simply get a directory listing of files instead of execution of the index.php. Seems I have missed something in the config files. When I run php -v, everything seems to be fine with PHP, I just do not run PHP files. That sounds like your DirectoryIndex directive needs to be updated. Check your httpd.conf file and make sure it looks [something] like this: IfModule mod_dir.c DirectoryIndex index.html index.wml index.cgi index.shtml index.jsp index.js index.jp index.php4 index.php3 index.php index.phtml index.htm default.htm default.html home.htm /IfModule Also be sure to check that you have these lines: AddHandler application/x-httpd-php .php .php4 .php3 .phtml AddHandler application/x-httpd-php-source .phps AddType application/x-httpd-php .php .php4 .php3 .phtml AddType application/x-httpd-php-source .phps Once you've added those lines, just restart Apache. Keep in mind (you, too, archive readers!) that this is httpd 1.3.x-specific, and the syntax won't work on 2.x. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- View this message in context: http://www.nabble.com/Can-not-run-PHP-pages-in-Apache-tf4759553.html#a13616858 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessionvariable
I use at the first page a session variable to set a flag. After a few pages, or if somebody wait too long, the pages have another flag. I noticed that there are often more than one session file exist. How can I avoid that? How can I make sure that for one user is only one session file? bye Ronald -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Won't Access Files Outside Web Root (Leopard/MacOS X 10.5) *SOLVED*
On 11/6/07, Rahul S. Johari [EMAIL PROTECTED] wrote: I guess I can officially consider this case closed with all problems solved! Thanks All! We are the geniuses that are the core PHP community. Hear us roar! -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can I make a process run in background?
On Tue, 2007-11-06 at 20:23 +0100, Luca Paolella wrote: This can be done quite easily using shared memory and/or a database to share data between the scripts. Really? could you give me a little briefing about this method? I'll give an example using the DB as the sharing mechanism. So you have master script: MASTER (waves hello) The MASTER can spawn off any number of child background scripts. These can be CHILD1, CHILD2, CHILD3, ..., CHILDX. When spawning a child script you can pass it command line parameters. One such parameter I suggest would be a UID for the CHILD process assigned by the MASTER. Another such parameter you should probably pass is a UID for the master process. How you generate UIDs is up to you. You could use PIDs but if your script runs for a long time then you may re-encounter a PID down the line. So now themaster knows his childen via the CHILD's UID (CHUID) and the children know the master via the MASTER's UID (MUID). Now all you need is a database table that stores messages (a message can be anything, serialize()'d data comes to mind as a good example). You could have a table as follows: CREATE TABLE messages ( id bigintnot null auto_increment, scriptUidbigintnot null, message BLOB, PRIMARY KEY ( id ), INDEX ( scriptUid ) ); Now your master can insert messages to it's children by inserting a row into the table with scriptUid set to the appropriate CHUID. Similarly, children can send messages back to the master by setting scriptUid to the MUID that spawned them. One such message might be... $message = array ( 'type' = 'childList', 'value = array( 10001, 10002, 10003 ), ); $message = serialize( $message ); This would provide the child with a list of CHUIDs for all the other children. This is the basics. A very simplistic example. When a child retrieves a message it should delete all messages for it's UID less than or equal to the highest ID it received. This way the next retrieval doesn't return previously received messages. Anyways, this is just one way. More complex techniques can be done by having the master listen on a socket and having the children connect to the socket when loaded. Then messages can be passed around via sockets. This is probably preferable since the DB solution requires polling the database for new messages, whereas I believe PHP sockets support wakeup on socket data with wakeup as is standard in C sockets. The shared memory method might be the best solution but I'm not familiar enough with it to say for sure. Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More info on timeout problem, with code
Jon, I can provide you with access to a Linux web box to test your code and database stuff if you'd like. No charge or anything, it's just that I strongly believe the problems are caused by the limits you face with your current web host. If you want to give it a shot, let me know and I'll set it up for you. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Won't Access Files Outside Web Root (Leopard/MacOS X 10.5) *SOLVED*
On 11/6/07 4:07 PM, Daniel Brown [EMAIL PROTECTED] wrote: We are the geniuses that are the core PHP community. Hear us roar! :D You know the funniest thing? As my discussion progressed, and the contributions back forth, the problem became evidently little to do with PHP and a whole lot to do with Mac OS X! And yet, on a PHP mailing list - we Solved it! Diversity in Unity! Of course, I've heard longer, endless, pointless rants in this same very mailing list over the course of last 6 years or so that I've been here. ~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can not run PHP pages in Apache
On 11/6/07, SFWahoo [EMAIL PROTECTED] wrote: Thanks. And this did work. Or at least I am able to access php pages. Given your comment about 1.3 vs. 2.2, I upgraded to 2.2. And I now have a different issue. When accessing a PHP page the Apache HTTP Server process crashes or I get a memory error. Any ideas? Daniel Brown-5 wrote: On 11/6/07, SFWahoo [EMAIL PROTECTED] wrote: I have installed Apache 1.3 and PHP 5.2.4. I am now trying to install Zen Cart. When accessing the Zen Cart setup, the PHP files are not read. I simply get a directory listing of files instead of execution of the index.php. Seems I have missed something in the config files. When I run php -v, everything seems to be fine with PHP, I just do not run PHP files. That sounds like your DirectoryIndex directive needs to be updated. Check your httpd.conf file and make sure it looks [something] like this: IfModule mod_dir.c DirectoryIndex index.html index.wml index.cgi index.shtml index.jsp index.js index.jp index.php4 index.php3 index.php index.phtml index.htm default.htm default.html home.htm /IfModule Also be sure to check that you have these lines: AddHandler application/x-httpd-php .php .php4 .php3 .phtml AddHandler application/x-httpd-php-source .phps AddType application/x-httpd-php .php .php4 .php3 .phtml AddType application/x-httpd-php-source .phps Once you've added those lines, just restart Apache. Keep in mind (you, too, archive readers!) that this is httpd 1.3.x-specific, and the syntax won't work on 2.x. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- View this message in context: http://www.nabble.com/Can-not-run-PHP-pages-in-Apache-tf4759553.html#a13616858 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Did you recompile the module for Apache 2 and the apxs2 module? In general, on a *nix-like system (i.e. - non-Windows), you can't swap a module like PHP from one major version of Apache to another. While a lot will work, most won't, and there can be some serious repercussions, least of all being a segfault. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More info on timeout problem, with code
Jon Westcot wrote: Hi David, et al.: Thanks for the comment. I removed the trailing semi-colon in the two areas where it was being sent to mysql_query() and tried the code again. I'm still getting the same basic problem -- it silently aborts somewhere around 22,000 to 26,000 records being processed out of just under 30,000. When I don't build the $insert_query string, I am able to read through the CSV file completely. What indexes are on this table? When you do an insert, each one has to update the index as well as the data, so maybe that's where all the time is being spent in the database (doubt it's the problem but try dropping all of the indexes on the table). Are you commenting out this whole section? $insert_query = INSERT INTO evall VALUES(; for ($c=0; $c $num; $c++) { if($c 0) { $insert_query .= ,; } $insert_query .= '' . $data[$c] . ''; } $insert_query .= );; Try $insert_query = INSERT INTO evall values (' . implode('\'', $data) . '); so you're not doing a for loop when you don't need to. Also as someone else suggested if this is a csv file you can use LOAD DATA INFILE to directly import it instead of having to create a bunch of insert queries. See http://dev.mysql.com/doc/refman/5.1/en/load-data.html Only do this if you are 100% sure of the data (ie it it sanitized in some other step). As odd as this sounds, should I put in some type of delay? Could the system be thinking it's getting flooded by all of the inserts? Doubt it. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular Expressions
2007/11/6, Alberto García Gómez [EMAIL PROTECTED]: I'm a mess in regular expressions and I make this code: $link = ereg_replace('ntilde;','n',$link); $link = ereg_replace('aacute;','a',$link); $link = ereg_replace('eacute;','e',$link); $link = ereg_replace('iacute;','i',$link); $link = ereg_replace('oacute;','o',$link); $link = ereg_replace('uacute;','u',$link); I ask if is a way to make those lines into a single one but working as well as this piece. I'm thinking in increase those lines so will be wonderful if I can optimize the code. Este correo ha sido enviado desde el Politécnico de Informática Carlos Marx de Matanzas. La gran batalla se librará en el campo de las ideas Use str_replace instead of ereg_replace. You don't need regular expressions there. Your code is good as it is, one line per string replacemente. Don't mess up code readability just for the sake of some lousy optimization, it's not worthy. (in spanish) Usa str_replace en lugar de ereg_replace. No necesitas expresiones regulares en este caso. Tu código está bien así, una línea por reemplazo. No arruines la legibilidad del código solo por una optimización inútil, no vale la pena.
[PHP] php.ini include_path and symlinks
Hi, We run php 5.2.0 + apache 2.2. with apc turned on ( apc.stat also on ). Earlier we did not use the php.ini include_path setting. We relied on some symlinks for our common code so that require_once works correctly. This worked fine and during code releases we flipped the main 'release' symlink atomically, without restarting apache. Later we decided to use php.ini include path to refactor common code more cleanly and it looks like: include_path=.:/some/dir/current:.. Now 'current' above is a symlink. When we push out a new release the current is updated atomically and apache is not restarted. This seems to pick the new changes and I ran some manual tests to confirm. However occasionally I see weird errors where it seems php could be resolving the symlink to the actual dir. at apache startup, and it assumes that old dir. When a new release goes out, we see 'fatal redeclare errors' etc.. Restarting apache (TERM and not USR1) seems to fix it. We could update our install scripts to restart apache, but I am just curious, is this really necessary? Is there anyway to prevent php from not resolving symlinks but use them as it is in the include_path? Thanks, Ravi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular Expressions
On Tue, 2007-11-06 at 23:24 -0300, Martin Alterisio wrote: 2007/11/6, Alberto García Gómez [EMAIL PROTECTED]: I'm a mess in regular expressions and I make this code: $link = ereg_replace('ntilde;','n',$link); $link = ereg_replace('aacute;','a',$link); $link = ereg_replace('eacute;','e',$link); $link = ereg_replace('iacute;','i',$link); $link = ereg_replace('oacute;','o',$link); $link = ereg_replace('uacute;','u',$link); I ask if is a way to make those lines into a single one but working as well as this piece. I'm thinking in increase those lines so will be wonderful if I can optimize the code. ?php $map = array ( 'ntilde;', 'n', 'aacute;', 'a', 'eacute;', 'e', 'iacute;', 'i', 'oacute;', 'o', 'uacute;', 'u', ); $link = str_replace( array_keys( $map ), array_values( $map ), $link ); ? The only way to make it faster is to build the key array and value array separately, but then the association is not so clear. Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.ini include_path and symlinks
On Tue, 2007-11-06 at 18:35 -0800, Ravi Menon wrote: Hi, We run php 5.2.0 + apache 2.2. with apc turned on ( apc.stat also on ). Earlier we did not use the php.ini include_path setting. We relied on some symlinks for our common code so that require_once works correctly. This worked fine and during code releases we flipped the main 'release' symlink atomically, without restarting apache. Later we decided to use php.ini include path to refactor common code more cleanly and it looks like: include_path=.:/some/dir/current:.. Now 'current' above is a symlink. When we push out a new release the current is updated atomically and apache is not restarted. This seems to pick the new changes and I ran some manual tests to confirm. However occasionally I see weird errors where it seems php could be resolving the symlink to the actual dir. at apache startup, and it assumes that old dir. When a new release goes out, we see 'fatal redeclare errors' etc.. Restarting apache (TERM and not USR1) seems to fix it. We could update our install scripts to restart apache, but I am just curious, is this really necessary? Is there anyway to prevent php from not resolving symlinks but use them as it is in the include_path? Are you using a compile cache like eaccelerator or APC etc? Sometimes it's the cache that doesn't realize things have changed. I use a symlink switcher for version releases also and I always flush the eaccelerator directory when I do that. Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular Expressions
Robert Cummings wrote: On Tue, 2007-11-06 at 23:24 -0300, Martin Alterisio wrote: 2007/11/6, Alberto García Gómez [EMAIL PROTECTED]: I'm a mess in regular expressions and I make this code: $link = ereg_replace('ntilde;','n',$link); $link = ereg_replace('aacute;','a',$link); $link = ereg_replace('eacute;','e',$link); $link = ereg_replace('iacute;','i',$link); $link = ereg_replace('oacute;','o',$link); $link = ereg_replace('uacute;','u',$link); I ask if is a way to make those lines into a single one but working as well as this piece. I'm thinking in increase those lines so will be wonderful if I can optimize the code. ?php $map = array ( 'ntilde;', 'n', 'aacute;', 'a', 'eacute;', 'e', 'iacute;', 'i', 'oacute;', 'o', 'uacute;', 'u', one mistake, your commas above, between the index and value, should be a = instead ); $link = str_replace( array_keys( $map ), array_values( $map ), $link ); ? The only way to make it faster is to build the key array and value array separately, but then the association is not so clear. Cheers, Rob. -- Jim Lucas Perseverance is not a long race; it is many short races one after the other Walter Elliot Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More info on timeout problem, with code
Hi Chris: What indexes are on this table? On the import table, there is only one index. And I probably don't even need an index on it since it will be processed sequentially into other tables after it's been imported. When you do an insert, each one has to update the index as well as the data, so maybe that's where all the time is being spent in the database (doubt it's the problem but try dropping all of the indexes on the table). I will try this. Are you commenting out this whole section? $insert_query = INSERT INTO evall VALUES(; for ($c=0; $c $num; $c++) { if($c 0) { $insert_query .= ,; } $insert_query .= '' . $data[$c] . ''; } $insert_query .= );; Only for the point of testing; normally, that code would need to be included to generate the INSERT query. Try $insert_query = INSERT INTO evall values (' . implode('\'', $data) . '); so you're not doing a for loop when you don't need to. Thanks for the suggestion. But, won't the glue part actually need to be something like: '\',\'' That is, I need to close the single quote, place a comma after the field, and then add in another opening quote. One other thing: I suspect I need to use addslashes() to the elements in $data -- is there a way to do this with one statement as you've done above? Also as someone else suggested if this is a csv file you can use LOAD DATA INFILE to directly import it instead of having to create a bunch of insert queries. See http://dev.mysql.com/doc/refman/5.1/en/load-data.html Only do this if you are 100% sure of the data (ie it it sanitized in some other step). Trying to use LOAD DATA INFILE was my initial plan, but that simply didn't work. Turns out that it's because of being on a shared server. I've talked with The Powers That Be about this and they're going to move to a dedicated virtual server; that should give me much more flexibility and control over what I need to update in the various settings and files and things to get past all of the heartburn I've had over the last weeks. As odd as this sounds, should I put in some type of delay? Could the system be thinking it's getting flooded by all of the inserts? Doubt it. Surprisingly enough, when I've used something like usleep(15000), I seem to be able to process more records than when I don't have it at all. ::shrug:: Just clutching at straws. Thanks again for your comments. I appreciate them all! Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gzuncompress() Not Working.
Alright, I think I know the problem. PHP's gzuncompress uses the Adler-32 checksum at the end of the zlib, while Python uses CRC32. Why must you follow the standards, PHP!? Does anyone know of any workaround? On Nov 6, 2007 7:03 AM, [EMAIL PROTECTED] wrote: I left that empty. The decompressed string is about 224 KB, so it shouldn't throw an error. Thanks for the reply! On Nov 6, 2007 12:25 AM, Per Jessen [EMAIL PROTECTED] wrote: Casey wrote: When I try gzuncompress() on the same data (I checked), it returns a Data error. I also tried gzinflate() and many user-created gzdecode () functions, with no luck. Did you specify a correct length for gzuncompress() ? From the manpage: The function will return an error if the uncompressed data is more than the optional parameter length. /Per Jessen, Zürich -- 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] Can I make a process run in background?
Robert Cummings wrote: On Tue, 2007-11-06 at 19:33 +0100, Per Jessen wrote: Jason Pruim wrote: Actually, what you are looking for is an eggdrop bot which is written in TCL. PHP in my humble opinion was not designed to handle something like that as it requires realtime processing. Someone correct me if I'm wrong but that isn't what PHP was designed to do was it? I would tend to agree with you, but PHP has been made to do a lot of things it was never really designed for. So many more things. It's my first choice for shell scripting especially as ties into web projects since all the code can be shared. Same here - it simplifies things tremendously when you have just one scripting/programming language to deal with. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gzuncompress() Not Working.
[EMAIL PROTECTED] wrote: Alright, I think I know the problem. PHP's gzuncompress uses the Adler-32 checksum at the end of the zlib, while Python uses CRC32. Why must you follow the standards, PHP!? Does anyone know of any workaround? Are you saying that you've got compressed data in one format by Python that cannot be uncompressed by PHP because it expects another format? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular Expressions
On Tue, 2007-11-06 at 20:15 -0800, Jim Lucas wrote: Robert Cummings wrote: On Tue, 2007-11-06 at 23:24 -0300, Martin Alterisio wrote: 2007/11/6, Alberto García Gómez [EMAIL PROTECTED]: I'm a mess in regular expressions and I make this code: $link = ereg_replace('ntilde;','n',$link); $link = ereg_replace('aacute;','a',$link); $link = ereg_replace('eacute;','e',$link); $link = ereg_replace('iacute;','i',$link); $link = ereg_replace('oacute;','o',$link); $link = ereg_replace('uacute;','u',$link); I ask if is a way to make those lines into a single one but working as well as this piece. I'm thinking in increase those lines so will be wonderful if I can optimize the code. ?php $map = array ( 'ntilde;', 'n', 'aacute;', 'a', 'eacute;', 'e', 'iacute;', 'i', 'oacute;', 'o', 'uacute;', 'u', one mistake, your commas above, between the index and value, should be a = instead Yeah, I didn't actually test after cutting/pasting and reformatting... was feeling lazy... that'll learn me :) Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gzuncompress() Not Working.
The documentation for zlib says that it expects an Adler-32 checksum at the end of the file. PHP follows this [largely outdated] standard. Python, on the other hand, doesn't, and uses a different checksum, CRC-32. That's why it won't decompress. But I've written my own function and it's working now. :) function fixAdler32($data) { $tempnam = tempnam('/tmp', 'gzfix'); $fh = fopen($tempnam, 'wb'); fwrite($fh, \x1f\x8b\x08\x00\x00\x00\x00\x00 . $data); fclose($fh); $dat = ''; $gz = gzopen($tempnam, 'rb'); if ($gz == false) die('Error opening temporary GZ file.'); do { $dat .= gzread($gz, 10); } while (!feof($gz)); gzclose($gz); unlink($tempnam); return $dat; } On Nov 6, 2007 11:07 PM, Per Jessen [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Alright, I think I know the problem. PHP's gzuncompress uses the Adler-32 checksum at the end of the zlib, while Python uses CRC32. Why must you follow the standards, PHP!? Does anyone know of any workaround? Are you saying that you've got compressed data in one format by Python that cannot be uncompressed by PHP because it expects another format? /Per Jessen, Zürich -- 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