php-general Digest 6 Sep 2009 11:49:16 -0000 Issue 6325
php-general Digest 6 Sep 2009 11:49:16 - Issue 6325 Topics (messages 297734 through 297743): Re: Error message 297734 by: Tommy Pham Re: Who kown this memcache_get_stats function ? 297735 by: hack988 hack988 297736 by: Eddie Drapkin 297737 by: Jonathan Tapicer 297738 by: hack988 hack988 297739 by: Tommy Pham 297740 by: Tommy Pham 297742 by: hack988 hack988 Re: mail attachment 297741 by: Paul M Foster Re: Include Files in HTML 297743 by: Ashley Sheridan Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- - Original Message From: Bruce Dobson bruce_...@yahoo.co.nz To: php-gene...@lists.php.net Sent: Saturday, September 5, 2009 4:19:29 PM Subject: [PHP] Error message Hi folks, I am new on this list and to php. I have just downloaded and gotten php 5.3.0 working with IIS on one computer but my efforts to install it on another What OS? What version of IIS? Did you setup as CGI/FCGI or as ISAPI? computer come up with the error message: 14001 (0x36b1) Can anybody tell me what this relates to? Did you enable file logging in the php.ini? PS: you might want to ask this in php-windows list instead. ;) Regards, Tommy Thanks Bruce ---End Message--- ---BeginMessage--- Nobody Kown this?This is my second question in this mail-list :(.I don't kown why it's no reply by anybody. 2009/9/5 hack988 hack988 hack...@dev.htwap.com: I found memcache_get_stats for memcached in some php code. I'm search it at php.net's function list,but it no matched result :(. I had found explain for Memcache::getStats() at this link http://www.php.net/manual/en/function.memcache-getstats.php In this link,tell me that == Also you can use memcache_get_stats() function. == But I can't find memcache_get_stats function's explain in online manual. Anybody can help me for using this function?Or give an more detail link for this function? ---End Message--- ---BeginMessage--- On Sun, Sep 6, 2009 at 12:16 AM, hack988 hack988hack...@dev.htwap.com wrote: Nobody Kown this?This is my second question in this mail-list :(.I don't kown why it's no reply by anybody. 2009/9/5 hack988 hack988 hack...@dev.htwap.com: I found memcache_get_stats for memcached in some php code. I'm search it at php.net's function list,but it no matched result :(. I had found explain for Memcache::getStats() at this link http://www.php.net/manual/en/function.memcache-getstats.php In this link,tell me that == Also you can use memcache_get_stats() function. == But I can't find memcache_get_stats function's explain in online manual. Anybody can help me for using this function?Or give an more detail link for this function? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Having taken a quick gander at the manual, specifically memcache_connect(), it appears that the memcache extension has a procedural style API similar to the procedural style MySQLi API. $db = mysqli_connect() and mysqli_query($db, ...) vs. $db = new mysqli() and $db-query(), so $memc = memcache_connect() and memcache_get_stats($memc) vs. $memc = new memcache and $memc-get_stats(); Now, on another note, the Memcache extension is pretty old and crusty and doesn't support a lot of the awesome functionality that's been built into Memcached as of late. Specifically, setting/getting a key based on a specific server, CAS (which can be used to prevent race conditions), and a whole bunch of other nice options (like a JSON based serializer for cross-platform compatibility between Memcached servers). Instead, I would suggest you use the newer, shinier, more featureful memcached extension ( http://php.net/memcached http://pecl.php.net/package/memcached ). Despite being so similarly named, the Memcached extension is much better (and I believe faster). The only disadvantage is that it has to be built with libmemcached (so you have to have that installed, which could be a problem) and that it only offers an object oriented API, but neither of those should be an issue. Have a look at PECL/Memcached and I wish you the best of luck in your memcached deployment, It's difficult, but it's a hell of a lot of fun and a completely different way of viewing data in PHP. ---End Message--- ---BeginMessage--- I think that the documentation for memcache_get_stats should be exactly the same as the one given for the method Memcache::getStats except that memcache_get_stats
Re: [PHP] mail attachment
On Sat, Sep 05, 2009 at 06:52:53PM +0200, Grega Leskov??ek wrote: How do I attach a file in mail function or do I have to use PEAR (and if how ...). What are the advantages of PEAR? When do You suggest to use PEAR? You *can* attach something to an email using the mail() function, but the process is complicated, and the mail() function isn't really set up to do this. I believe the usual suggestion for users who ask this question is to use the phpmailer package. It does this more easily. Google for phpmailer. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Who kown this memcache_get_stats function ?
I find some detail manual about memcached procedural style API for php(for example:memcache_get_stats).But now I found detail about this API. 2009/9/6 Tommy Pham tommy...@yahoo.com: - Original Message From: Tommy Pham tommy...@yahoo.com To: PHP General List php-general@lists.php.net Sent: Saturday, September 5, 2009 10:41:39 PM Subject: Re: [PHP] Who kown this memcache_get_stats function ? - Original Message From: hack988 hack988 To: PHP General List Sent: Saturday, September 5, 2009 9:16:51 PM Subject: Re: [PHP] Who kown this memcache_get_stats function ? Nobody Kown this?This is my second question in this mail-list :(.I don't kown why it's no reply by anybody. You sample on it's usage? You mean sample on it's usage? You need to run the daemon first before you can use it. See here: http://www.danga.com/memcached/ I got that link from: http://us2.php.net/manual/en/intro.memcache.php 2009/9/5 hack988 hack988 : I found memcache_get_stats for memcached in some php code. I'm search it at php.net's function list,but it no matched result :(. I had found explain for Memcache::getStats() at this link http://www.php.net/manual/en/function.memcache-getstats.php In this link,tell me that == Also you can use memcache_get_stats() function. == But I can't find memcache_get_stats function's explain in online manual. Anybody can help me for using this function?Or give an more detail link for this function? -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include Files in HTML
On Fri, 2009-09-04 at 18:21 -0500, phphelp -- kbk wrote: On Sep 4, 2009, at 5:03 PM, sono...@fannullone.us wrote: Depends on what you are including. The only tags that can be inside the head are base, link, meta, script, style, and title. Everything else is either body or prologue. I meant PHP includes like this one: ?php @include_once(/home/passwords/login.php); ? We know what you mean. Read the responses more carefully, as they are telling you what you need to know. For simplification: The INCLUDE commands put the contents of the INCLUDed file into this file, just as if as you had typed it in there. Ken It's good to remember that PHP isn't inserted into HTML, but the other way round. PHP can output HTML, but is often used to output many other formats, from images to xml to documents. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File download question
Hi Everyone, I've setup a filedownload which works but i'm having an issue, i've left out but when it downloads it, while it has the correct file it doesn't have a file extension associated with it, I need the .7z extension associated with the filename, can anyone see why that would do this below? I'm sure it's something obvious but i'm new to doing file downloads. Thank you everyone Chris $file = SOMEFILE.7Z; $speed = 60; // i.e. 60 kb/s download rate if(file_exists($file) is_file($file)) { header(Cache-control: private); header(Content-Type: application/octet-stream); header(Content-Length: .filesize($file)); header(Content-Disposition: filename=$file . %20); flush(); $fd = fopen($file, r); while(!feof($fd)) { echo fread($fd, round($speed*1024)); // $speed kb at a time flush(); sleep(1); } fclose ($fd); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File download question
I think that your problem in this line: header(Content-Disposition: filename=$file . %20); I don't know what that %20 is for and you should quote the filename, that line should be something like this: header(Content-Disposition: attachment; filename=\$file\); Considering that $filename already has the 7z extension. Jonathan On Sun, Sep 6, 2009 at 3:19 PM, Chris Paynechris_pa...@danmangames.com wrote: Hi Everyone, I've setup a filedownload which works but i'm having an issue, i've left out but when it downloads it, while it has the correct file it doesn't have a file extension associated with it, I need the .7z extension associated with the filename, can anyone see why that would do this below? I'm sure it's something obvious but i'm new to doing file downloads. Thank you everyone Chris $file = SOMEFILE.7Z; $speed = 60; // i.e. 60 kb/s download rate if(file_exists($file) is_file($file)) { header(Cache-control: private); header(Content-Type: application/octet-stream); header(Content-Length: .filesize($file)); header(Content-Disposition: filename=$file . %20); flush(); $fd = fopen($file, r); while(!feof($fd)) { echo fread($fd, round($speed*1024)); // $speed kb at a time flush(); sleep(1); } fclose ($fd); } -- 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] File download question
That is for IE and its silly FileName[N] rather than FileName here a good old function to download: http://www.devpro.it/code/72.html Regards Date: Sun, 6 Sep 2009 15:43:27 -0300 From: tapi...@gmail.com To: chris_pa...@danmangames.com CC: php-general@lists.php.net Subject: Re: [PHP] File download question I think that your problem in this line: header(Content-Disposition: filename=$file . %20); I don't know what that %20 is for and you should quote the filename, that line should be something like this: header(Content-Disposition: attachment; filename=\$file\); Considering that $filename already has the 7z extension. Jonathan On Sun, Sep 6, 2009 at 3:19 PM, Chris Paynechris_pa...@danmangames.com wrote: Hi Everyone, I've setup a filedownload which works but i'm having an issue, i've left out but when it downloads it, while it has the correct file it doesn't have a file extension associated with it, I need the .7z extension associated with the filename, can anyone see why that would do this below? I'm sure it's something obvious but i'm new to doing file downloads. Thank you everyone Chris $file = SOMEFILE.7Z; $speed = 60; // i.e. 60 kb/s download rate if(file_exists($file) is_file($file)) { header(Cache-control: private); header(Content-Type: application/octet-stream); header(Content-Length: .filesize($file)); header(Content-Disposition: filename=$file . %20); flush(); $fd = fopen($file, r); while(!feof($fd)) { echo fread($fd, round($speed*1024)); // $speed kb at a time flush(); sleep(1); } fclose ($fd); } -- 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 _ More than messages–check out the rest of the Windows Live™. http://www.microsoft.com/windows/windowslive/
[PHP] Sorting an array of sub-arrays based on a sub-array's key
Hey everyone. I have an array that looks like this: $main_array[0] = array('key1' = 'vala'); $main_array[1] = array('key1' = 'valb'); etc. I want to sort the main array based on the value of key1 for each sub-array. I looked at all the array sorting functions, but unless I misunderstood something, I didn't see a direct way to do what I want. If there were a sorting function in which I could pass as an argument the name of a function that compares two elements like qsort in C, I could do it easily. Is there a function like that in PHP? If not, what should I do? Thanks everyone! James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sorting an array of sub-arrays based on a sub-array's key
On Sun, Sep 6, 2009 at 6:45 PM, James Colanninoja...@colannino.org wrote: Hey everyone. I have an array that looks like this: $main_array[0] = array('key1' = 'vala'); $main_array[1] = array('key1' = 'valb'); etc. I want to sort the main array based on the value of key1 for each sub-array. I looked at all the array sorting functions, but unless I misunderstood something, I didn't see a direct way to do what I want. If there were a sorting function in which I could pass as an argument the name of a function that compares two elements like qsort in C, I could do it easily. Is there a function like that in PHP? If not, what should I do? Thanks everyone! James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php http://us3.php.net/uasort -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sorting an array of sub-arrays based on a sub-array's key
Eddie Drapkin wrote: http://us3.php.net/uasort Exactly what I was looking for. Thanks. James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Displaying image paths with spaces
Hey all, I have a CMS system that uses the FCKeditor to allow users to create directories in which to store images. FCK allows users to create directories with spaces in them, and it's pretty deep in the JavaScript code so modifying that is not a simple option, so at this point I'm trying to work from the assumption that the users will continue to be allowed to create directory names with spaces. All that said, the CMS outputs data in two ways. I'll start with the second method because it works and then move on to the problem. What the user has created in the FCKeditor is a path to an image that appears like this: src=/clients/client_118/images//Event%20images/Show%20ads/catspaw1compressed.jpg Notice the '%20' codes for the spaces in the directory names like 'Event images' and 'Show ads'. The first way the code is displayed is with an AJAX call. It's read on the PHP side, echo'd back out to the JavaScript code and inserted into an ID with an innerHTML assignment. This method works. The first way the code is loaded is pure PHP. It's read from the database just as it appears above and then echo'd back to the browser. However, in the browser it appears like this: /clients/client_118/images//Event\ images/Show\ ads/catspaw1compressed.jpg And of course the browser can't display the image with those '\ ' combinations. So my task is to get it to display the image properly on the pure PHP side the same way it does via the AJAX call. I should also say that the code the image path resides in contains a text, etc, so it's a block of content, containing both text and image paths. Is there a way to read and echo this on the PHP side and preserve a properly displayable path like the AJAX call, but that also won't interfere with the rest of the HTML and text code contained within the block of content? I'm stumped on this one, so any help would be greatly, wonderfully, blissfully even... appreciated. Thanks, Skip -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison WI 53703 608.250.2720 http://bigskypenguin.com Those of you who believe in telekinesis, raise my hand. -- Kurt Vonnegut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php