RE: [PHP] Small LAMP install/distro
I can recommend Fedora Core 6, it has more uptodate Apache, PHP and MySQL, than does Red Hat Enterprise 4, which is what the company I consult for installed on their VM-ware environment. We spent a lot of time upgrading everything on the VM Host because the RH Enterprise was so far behind. I run the Fedora 6 on a spare machine at home, and everything that version is far superior, don't even try to convince the corporate types though, they want a corporate name behind things, like there might be someone to blame, other than themselves, if something goes wrong. I've also used Free BSD, Redhat 9, and older versions of Suse, but prefer the Fedora. The MySQL on Fedora 6 has master/slave replication, if you know what that is. Warren -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, June 21, 2007 9:41 PM To: php-general@lists.php.net Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Small LAMP install/distro Yeah.. I'm aware. As I stated in my original email: Ideally I'd like to keep using my traditional Windows apps to do development... I'm comfortable moving around in linux, but the tools and OS I choose to use are all Windows-centric. But instead of installing Apache and PHP and MySQL on my Windows machine at work and at home, as I have in the past, then lose interest in the project I'm working on and have a bunch of servers installed that I'm not using, I'd like to set up a virtual machine to keep all the server/test environment contained out of the way. And while I'm 'comfortable' getting around in linux and know a few tricks, I don't feel that I know it well enough to try to start trimming out a gig or two of stuff and fiddling with swap space settings and all to make my own streamline distro with the apps I want. Especially if one already exists. I'd rather waste my time developing PHP apps that nobody but me will ever use, than fiddling with OS streamlining and configuration. -TG = = = Original message = = = Did you know that VM-ware actually runs under RH linux? Warren -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, June 21, 2007 1:16 PM To: php-general@lists.php.net Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Small LAMP install/distro Yeah, I took a quick look at Damn Small Linux. And have been playing around with Puppy Linux (which is pretty cool too). I may end up using one of those. Wanted to see if there was a distro with everything built into it already (Damn Small seems to have a lot of average user apps and not really developer/small server type stuff) Thanks for the suggestion though, Daniel. (And yes, I top-post. Get the pitchforks!) -TG = = = Original message = = = On 6/21/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Ok, done all my googling and experimenting, now I'm tossing it to you guys. Can anyone recommend a small, no frills, LAMP-centric linux package/distro? What I'm doing is setting up a test/development environment in a VMWare virtual machine to keep things all nice and comparmentalized. It's going to emulate (at least in PHP and MySQL version and configuration) my web host. Ideally I'd like to keep using my traditional Windows apps to do development, but save my work to a Samba share on the virtual machine (so guess toss Samba into that too). Maybe there's better ways to do what I want, but now I'm discovered a challenge that I'd like to overcome. I have something called Grandma's LAMP, which is actually pretty cool. It runs Xubuntu, which I dig, but still takes up 1.5gig (and is config'd for a max of 10gb HD space). It has the full GUI and everything installed. GUI is nice, but not 100% necessary. AMP + Samba is good. And I'm transporting this all around on a 2GB thunbdrive (oh yeah, did I not mention that?). If it was sans-GUI, I don't see why the whole thing couldn't be under 500MB. Thought maybe someone out there had seen a distro pack specifically geared for quick and dirty LAMP + Samba setup. -TG Google for DSL (Damn Small Linux). I've used that a few times myself. Pretty cool. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] open a file in a folder without knowing the filename
2007. 06. 21, csütörtök keltezéssel 20.07-kor Tijnema ezt írta: On 6/21/07, Dan [EMAIL PROTECTED] wrote: Seconded :D Cool, please go to the following url and clickthe button: http://gpcc.tijnema.info/ I clicked, although I don't use gmail - but I might register an account for use with this list if it comes with php code coloring ;) greets Zoltán Németh Tijnema Tijnema [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 6/21/07, Daniel Brown [EMAIL PROTECTED] wrote: On 6/21/07, Tijnema [EMAIL PROTECTED] wrote: I like that disclaimer :) I write a lot of code for this list in my mail.. Yeah, I think I use the Gmail PHP IDE more than I use ViM! ;-P -- Daniel P. Brown Let's send a future request to google, we want PHP color coding in Gmail!!! :) Tijnema -- 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] Encoding of PHP files
What encoding should a PHP file itself have (so not it's output setting). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Encoding of PHP files
What encoding should a PHP file itself have (so not it's output setting). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] open a file in a folder without knowing the filename
On 6/22/07, Zoltán Németh [EMAIL PROTECTED] wrote: 2007. 06. 21, csütörtök keltezéssel 20.07-kor Tijnema ezt írta: On 6/21/07, Dan [EMAIL PROTECTED] wrote: Seconded :D Cool, please go to the following url and clickthe button: http://gpcc.tijnema.info/ I clicked, although I don't use gmail - but I might register an account for use with this list if it comes with php code coloring ;) greets Zoltán Németh Thanks for your vote!, the counter is at 44 right now :) Tijnema Tijnema Tijnema [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 6/21/07, Daniel Brown [EMAIL PROTECTED] wrote: On 6/21/07, Tijnema [EMAIL PROTECTED] wrote: I like that disclaimer :) I write a lot of code for this list in my mail.. Yeah, I think I use the Gmail PHP IDE more than I use ViM! ;-P -- Daniel P. Brown Let's send a future request to google, we want PHP color coding in Gmail!!! :) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Small LAMP install/distro
On 6/22/07, Warren Vail [EMAIL PROTECTED] wrote: I can recommend Fedora Core 6, it has more uptodate Apache, PHP and MySQL, than does Red Hat Enterprise 4, which is what the company I consult for installed on their VM-ware environment. We spent a lot of time upgrading everything on the VM Host because the RH Enterprise was so far behind. I run the Fedora 6 on a spare machine at home, and everything that version is far superior, don't even try to convince the corporate types though, they want a corporate name behind things, like there might be someone to blame, other than themselves, if something goes wrong. I've also used Free BSD, Redhat 9, and older versions of Suse, but prefer the Fedora. The MySQL on Fedora 6 has master/slave replication, if you know what that is. Warren Yes, Fedora Core is a very good choice, I used it for a few years before I started writing my own Linux.. Tijnema ps. Please don't top post! -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, June 21, 2007 9:41 PM To: php-general@lists.php.net Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Small LAMP install/distro Yeah.. I'm aware. As I stated in my original email: Ideally I'd like to keep using my traditional Windows apps to do development... I'm comfortable moving around in linux, but the tools and OS I choose to use are all Windows-centric. But instead of installing Apache and PHP and MySQL on my Windows machine at work and at home, as I have in the past, then lose interest in the project I'm working on and have a bunch of servers installed that I'm not using, I'd like to set up a virtual machine to keep all the server/test environment contained out of the way. And while I'm 'comfortable' getting around in linux and know a few tricks, I don't feel that I know it well enough to try to start trimming out a gig or two of stuff and fiddling with swap space settings and all to make my own streamline distro with the apps I want. Especially if one already exists. I'd rather waste my time developing PHP apps that nobody but me will ever use, than fiddling with OS streamlining and configuration. -TG = = = Original message = = = Did you know that VM-ware actually runs under RH linux? Warren -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, June 21, 2007 1:16 PM To: php-general@lists.php.net Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Small LAMP install/distro Yeah, I took a quick look at Damn Small Linux. And have been playing around with Puppy Linux (which is pretty cool too). I may end up using one of those. Wanted to see if there was a distro with everything built into it already (Damn Small seems to have a lot of average user apps and not really developer/small server type stuff) Thanks for the suggestion though, Daniel. (And yes, I top-post. Get the pitchforks!) -TG = = = Original message = = = On 6/21/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Ok, done all my googling and experimenting, now I'm tossing it to you guys. Can anyone recommend a small, no frills, LAMP-centric linux package/distro? What I'm doing is setting up a test/development environment in a VMWare virtual machine to keep things all nice and comparmentalized. It's going to emulate (at least in PHP and MySQL version and configuration) my web host. Ideally I'd like to keep using my traditional Windows apps to do development, but save my work to a Samba share on the virtual machine (so guess toss Samba into that too). Maybe there's better ways to do what I want, but now I'm discovered a challenge that I'd like to overcome. I have something called Grandma's LAMP, which is actually pretty cool. It runs Xubuntu, which I dig, but still takes up 1.5gig (and is config'd for a max of 10gb HD space). It has the full GUI and everything installed. GUI is nice, but not 100% necessary. AMP + Samba is good. And I'm transporting this all around on a 2GB thunbdrive (oh yeah, did I not mention that?). If it was sans-GUI, I don't see why the whole thing couldn't be under 500MB. Thought maybe someone out there had seen a distro pack specifically geared for quick and dirty LAMP + Samba setup. -TG Google for DSL (Damn Small Linux). I've used that a few times myself. Pretty cool. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Vote for PHP Color Coding in Gmail! -
Re: [PHP] PHP Color Coding in Gmail (was: open a file in a folder without knowing the filename)
On 6/22/07, Greg Donald [EMAIL PROTECTED] wrote: On 6/21/07, Tijnema [EMAIL PROTECTED] wrote: Cool, please go to the following url and clickthe button: http://gpcc.tijnema.info/ Where's the 'no' option ? I call shenanigans. -- Greg Donald Close the window ;) Tijnema -- Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] open a file in a folder without knowing the filename
On 6/22/07, Christian Hänsel [EMAIL PROTECTED] wrote: Tijnema [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] On 6/22/07, Zoltán Németh [EMAIL PROTECTED] wrote: 2007. 06. 21, csütörtök keltezéssel 20.07-kor Tijnema ezt írta: On 6/21/07, Dan [EMAIL PROTECTED] wrote: Seconded :D Cool, please go to the following url and clickthe button: http://gpcc.tijnema.info/ I clicked, although I don't use gmail - but I might register an account for use with this list if it comes with php code coloring ;) greets Zoltán Németh Thanks for your vote!, the counter is at 44 right now :) Tijnema Tijnema Tijnema [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 6/21/07, Daniel Brown [EMAIL PROTECTED] wrote: On 6/21/07, Tijnema [EMAIL PROTECTED] wrote: I like that disclaimer :) I write a lot of code for this list in my mail.. Yeah, I think I use the Gmail PHP IDE more than I use ViM! ;-P -- Daniel P. Brown Let's send a future request to google, we want PHP color coding in Gmail!!! :) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info Hi guys, Tijnema, I have put up a link on my website for the german speaking folks so they can vote, too :o) The URL is http://www.chftp.com . I hope you're oka with that :o) Cheers, and all the best! Chris Thanks, the more people know about, the more votes we get :) Tijnema -- Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] open a file in a folder without knowing the filename
Tijnema [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] On 6/22/07, Zoltán Németh [EMAIL PROTECTED] wrote: 2007. 06. 21, csütörtök keltezéssel 20.07-kor Tijnema ezt írta: On 6/21/07, Dan [EMAIL PROTECTED] wrote: Seconded :D Cool, please go to the following url and clickthe button: http://gpcc.tijnema.info/ I clicked, although I don't use gmail - but I might register an account for use with this list if it comes with php code coloring ;) greets Zoltán Németh Thanks for your vote!, the counter is at 44 right now :) Tijnema Tijnema Tijnema [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 6/21/07, Daniel Brown [EMAIL PROTECTED] wrote: On 6/21/07, Tijnema [EMAIL PROTECTED] wrote: I like that disclaimer :) I write a lot of code for this list in my mail.. Yeah, I think I use the Gmail PHP IDE more than I use ViM! ;-P -- Daniel P. Brown Let's send a future request to google, we want PHP color coding in Gmail!!! :) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info Hi guys, Tijnema, I have put up a link on my website for the german speaking folks so they can vote, too :o) The URL is http://www.chftp.com . I hope you're oka with that :o) Cheers, and all the best! Chris - I submit my stuff @ weberdev.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Encoding of PHP files
Guus Ellenkamp wrote: What encoding should a PHP file itself have (so not it's output setting). Plain ASCII AFAIK. -- Richard Heyes 0844 801 1072 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] func_$var() in PHP4?
Hi all, How can I get this in PHP4? I used this in PHP5: ?php class ABC { function func_a() { return a; } function func_b() { return b; } } $abc = new ABC(); $var = a; $result = $abc-func_$var(); // Line 17 ? In PHP5 $result contains a here, but in PHP4 I get this error: Parse error: syntax error, unexpected T_VARIABLE in //test.php on line 17. Does anyone know how to accomplish this with PHP4? Thanks, Tijnema -- Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] func_$var() in PHP4?
Tijnema wrote: Hi all, How can I get this in PHP4? I used this in PHP5: ?php class ABC { function func_a() { return a; } function func_b() { return b; } } $abc = new ABC(); $var = a; $result = $abc-func_$var(); // Line 17 ? In PHP5 $result contains a here, but in PHP4 I get this error: Parse error: syntax error, unexpected T_VARIABLE in //test.php on line 17. Does anyone know how to accomplish this with PHP4? $abc = new ABC(); $var = a; // -- shouldn't this have quotes?? $f = 'func_'.$a; $result = $abc-$f(); // Line 17 -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP calling an ISAPI Extension
On 6/20/07, Tijnema [EMAIL PROTECTED] wrote: On 6/19/07, Dan [EMAIL PROTECTED] wrote: Whoops, it turned out just to be a line wrapping problem, it was putting an extra space in. I have it working now, but after every request I get back the returning header in my result to it looks like this: HTTP/1.1 200 OK Content-Length: 184 Content-Type: text/html Server: Microsoft-IIS/7.0 Content: Date: Tue, 19 Jun 2007 17:20:04 GMT The resulting page I really wished to be returned. How do I get this not to set the return header in the $result? Or shoudl I just somehow get rid of the header after I get it? I don't know how long it is so I can't do a substring. Ideas? It has to do something with the way the things are send across the internet, in packages. The manual of fread says that it will read until EOF, the given length or the end of a package... try this code: $post_data = name=wowlikes=true; $fp = fsockopen(localhost,8080); fwrite($fp,POST /Project1.dll HTTP/1.1\r\nHost:localhost\r\nContent-Length:.strlen($post_data).\r\n\r\n.$post_data); $line = fgets($fp); $length = 0; while($line != \r\n) { if(strtolower(substr($line,0,15)) == content-length:) { $length = (int)substr($line,15); } } $result = fread($fp,$length); while(strlen($result) != $length) { $result .= fread($fp,$length-strlen($result)); } echo $result; Ok, above code is untested, and i just written it in gmail, so might be stupid syntax error in it or such. Tijnema Like I said, there might be stupid bugs in, this code is better: $post_data = name=wowlikes=true; $fp = fsockopen(localhost,8080); fwrite($fp,POST /Project1.dll HTTP/1.1\r\nHost:localhost\r\nContent-Length:.strlen($post_data).\r\n\r\n.$post_data); $line = fgets($fp); $length = 0; while($line != \r\n) { if(strtolower(substr($line,0,15)) == content-length:) { $length = (int)substr($line,15); $line = fgets($fp); } } $result = fread($fp,$length); while(strlen($result) != $length) { $result .= fread($fp,$length-strlen($result)); } echo $result; Dan [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I modified your code to work with what I'm doing and this is what I got: $post_data = name=wowlikes=true; $fp = fsockopen(localhost,8080); fwrite($fp,POST /Project1.dll HTTP/1.1\r\nHost: localhost\r\nContent-Length: .strlen($post_data).\r\n\r\n.$post_data); $result = fread($fp,102400); // Reads 100KB, change if you need more echo $result; Now when I try that I get a Bad Request invalid header name error. I have an IIS server running localy on port 8080, the Project1.dll is in the root directory, it contains two input components 1 a textfield to type your name, the other a checkbox called likes. What's wrong? Here's it's code: html head titleLearning ISAPI/title /head h3Learning ISAPI!/h3 form name=isapiform method=POST action=/Project1.dll strongPlease enter the following information/strong brName: input type=text name=name brinput type=checkbox name=likes value=true checked I like ISAPI!p input type=submit value=View Output /form /html Tijnema [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 6/19/07, Jim Lucas [EMAIL PROTECTED] wrote: Dan wrote: I wish I could, I can't count on the script being on a linux machine. I also can't expect people to rebuild PHP with the curl library just to use my script. Is there any other way to do a post to a page from a php function? - Daniel Jim Lucas [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dan wrote: I would normaly do it with an AJAX call but I need to do a post from WITHIN a PHP function, so when it's doing php stuff ex. function something() { echo 'whatever'; $response = post some data to a ISAPI Extension eg. post to http://domain.com/scripts/app.dll return $response . other data; } Jay Blanchard [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] [snip] I'm in need of a way to contact an ISAPI Extension from a PHP function. Does anyone know how I would be able to do this? Usually you would post a page to their URL/actionname. Can I do a POST from a PHP function without reloading the page, and get a result back? That's one tall order. Anyone want to give it a shot? [/snip] Do the POST with an AJAX call perform an ajax call the a php script that calls curl to do a post to the ISAPI extension -- 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 The only method that I am aware of is the fsockopen method you mention in your other email -- Jim Lucas Yes, and what's wrong with it? ?php $post_data = form_a=1form_b=4; $fp = fsockopen(www.domain.com,80); fwrite($fp,POST /scripts/app.dll HTTP/1.1\r\nHost:
Re: [PHP] func_$var() in PHP4?
On 6/22/07, Stut [EMAIL PROTECTED] wrote: Tijnema wrote: Hi all, How can I get this in PHP4? I used this in PHP5: ?php class ABC { function func_a() { return a; } function func_b() { return b; } } $abc = new ABC(); $var = a; $result = $abc-func_$var(); // Line 17 ? In PHP5 $result contains a here, but in PHP4 I get this error: Parse error: syntax error, unexpected T_VARIABLE in //test.php on line 17. Does anyone know how to accomplish this with PHP4? $abc = new ABC(); $var = a; // -- shouldn't this have quotes?? Yes, forgot it when typing this code in gmail, that's why we need PHP Color Coding ;) $f = 'func_'.$a; $result = $abc-$f(); // Line 17 -Stut Thanks, this code works :) Tijnema -- Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Encoding of PHP files
Richard Heyes wrote: Guus Ellenkamp wrote: What encoding should a PHP file itself have (so not it's output setting). Plain ASCII AFAIK. huh? I generally save my files in the same encoding as the output encoding of the site, this is so that literal strings are output correctly. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Small LAMP install/distro
First, funny that you say that from a Gmail account, where top-posting is encouraged by the mail system. Second, and not to get into a big discussion about top vs bottom posting, but I top-post because typically if I'm involved in a conversation, I know what's been said already and don't want to scroll past a ton of it to get to the meat. To me, an original message is included in a reply as a quick reference as to what's being replied to and a reminder of what's been said. The people top-posting probably screws the most are the daily digest readers. But even then, if a reply is properly trimmed, then it shouldn't matter if it's top or bottom posted. Doesn't help that ePrompter (little app I use to check many pop3 and web based emails) has primative original email handling where it won't indent with or anything, pretty much forcing you to top-post if you use it to reply. I prefer top posting and don't know why there's so much animosity against it. When I open an email, the first thing I want to see is what someone said in that email. If I need a reminder of what was already said, or clarification on what they're replying to exactly, then I can scroll down. -TG = = = Original message = = = ps. Please don't top post! Tijnema ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Small LAMP install/distro
[EMAIL PROTECTED] wrote: Thanks for the suggestions.. but again, the question wasn't what distro of linux to use. And I don't mind upgrading things. The question is what would someone recommend for a really small distro of linux preferably with the bare essentials + apache, mysql, php and samba. Failing that, I'll just grab one of the small linux distros out there and install the stuff I need manually. I just don't know if some of those small distros are missing anything that would make installing AMP+Samba tricky. Anyway, I'll figure it out. It's not a huge priority, but something that'd make my hobby development a lot easier. -TG = = = Original message = = = I can recommend Fedora Core 6, it has more uptodate Apache, PHP and MySQL, than does Red Hat Enterprise 4, which is what the company I consult for installed on their VM-ware environment. We spent a lot of time upgrading everything on the VM Host because the RH Enterprise was so far behind. I run the Fedora 6 on a spare machine at home, and everything that version is far superior, don't even try to convince the corporate types though, they want a corporate name behind things, like there might be someone to blame, other than themselves, if something goes wrong. I've also used Free BSD, Redhat 9, and older versions of Suse, but prefer the Fedora. The MySQL on Fedora 6 has master/slave replication, if you know what that is. Warren ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. I would install Fedora Core 6. When asked which packages to install, uncheck everything. Then, once you have the install complete, using yum install httpd php mysql samba Here is my current running packages for the above programs httpd-2.2.4-2.fc6 libdbi-dbd-mysql-0.8.1a-1.2.2 mysql-5.0.27-1.fc6 mysql-connector-odbc-3.51.12-2.2 mysql-server-5.0.27-1.fc6 php-5.1.6-3.6.fc6 php-cli-5.1.6-3.6.fc6 php-common-5.1.6-3.6.fc6 php-mbstring-5.1.6-3.6.fc6 php-mysql-5.1.6-3.6.fc6 php-pdo-5.1.6-3.6.fc6 php-pear-1.4.9-4 php-pgsql-5.1.6-3.6.fc6 samba-3.0.24-7.fc6 samba-client-3.0.24-7.fc6 samba-common-3.0.24-7.fc6 system-config-samba-1.2.35-1.1 don't install the devel packages of anything all of this installed on top of the base install should be well under 1g make sure and run 'yum update' seems like there are updates every couple hours. -- 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] Small LAMP install/distro
My thoughts exactly, TG. I was just thinking about that this morning, in fact --- exactly the stuff you said. That aside, I started using a DSL/Knoppix distro to modify to automatically install a server environment as opposed to the desktop environment. As such, without the need for a GUI, et cetera, it should be even smaller than the 50MB ISO it is now, and will be even more embed-able. I'm only working on it in my spare time, so it may not be ready for use when you need it, but if I keep moving forward with it, I'll keep you posted if you'd like I'll even write the updates up top here. On 6/22/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: First, funny that you say that from a Gmail account, where top-posting is encouraged by the mail system. Second, and not to get into a big discussion about top vs bottom posting, but I top-post because typically if I'm involved in a conversation, I know what's been said already and don't want to scroll past a ton of it to get to the meat. To me, an original message is included in a reply as a quick reference as to what's being replied to and a reminder of what's been said. The people top-posting probably screws the most are the daily digest readers. But even then, if a reply is properly trimmed, then it shouldn't matter if it's top or bottom posted. Doesn't help that ePrompter (little app I use to check many pop3 and web based emails) has primative original email handling where it won't indent with or anything, pretty much forcing you to top-post if you use it to reply. I prefer top posting and don't know why there's so much animosity against it. When I open an email, the first thing I want to see is what someone said in that email. If I need a reminder of what was already said, or clarification on what they're replying to exactly, then I can scroll down. -TG = = = Original message = = = ps. Please don't top post! Tijnema ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Small LAMP install/distro
Excellent information Jim! Thanks a ton! I really wish I knew linux more intimately so I knew what was a vital organ and what was an appendix :) Your suggestions sound like exactly what I'm looking for. Greatly appreciated! Actually.. one question. Won't it try to set up a swap partition? Or will what you recommend keep that to a minimum too? Thanks again.. finally some useful information to a simple question. hah (not that I don't appreciate the advice that's been given so far.. it's just not what I was looking for) -TG = = = Original message = = = I would install Fedora Core 6. When asked which packages to install, uncheck everything. Then, once you have the install complete, using yum install ~httpd ~php ~mysql ~samba Here is my current running packages for the above programs httpd-2.2.4-2.fc6 libdbi-dbd-mysql-0.8.1a-1.2.2 mysql-5.0.27-1.fc6 mysql-connector-odbc-3.51.12-2.2 mysql-server-5.0.27-1.fc6 php-5.1.6-3.6.fc6 php-cli-5.1.6-3.6.fc6 php-common-5.1.6-3.6.fc6 php-mbstring-5.1.6-3.6.fc6 php-mysql-5.1.6-3.6.fc6 php-pdo-5.1.6-3.6.fc6 php-pear-1.4.9-4 php-pgsql-5.1.6-3.6.fc6 samba-3.0.24-7.fc6 samba-client-3.0.24-7.fc6 samba-common-3.0.24-7.fc6 system-config-samba-1.2.35-1.1 don't install the devel packages of anything all of this installed on top of the base install should be well under 1g make sure and run 'yum update' seems like there are updates every couple hours. -- 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 ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Small LAMP install/distro
[EMAIL PROTECTED] wrote: Excellent information Jim! Thanks a ton! I really wish I knew linux more intimately so I knew what was a vital organ and what was an appendix :) Your suggestions sound like exactly what I'm looking for. Greatly appreciated! Actually.. one question. Won't it try to set up a swap partition? Or will what you recommend keep that to a minimum too? Thanks again.. finally some useful information to a simple question. hah (not that I don't appreciate the advice that's been given so far.. it's just not what I was looking for) -TG = = = Original message = = = I would install Fedora Core 6. When asked which packages to install, uncheck everything. Then, once you have the install complete, using yum install ~httpd ~php ~mysql ~samba Here is my current running packages for the above programs httpd-2.2.4-2.fc6 libdbi-dbd-mysql-0.8.1a-1.2.2 mysql-5.0.27-1.fc6 mysql-connector-odbc-3.51.12-2.2 mysql-server-5.0.27-1.fc6 php-5.1.6-3.6.fc6 php-cli-5.1.6-3.6.fc6 php-common-5.1.6-3.6.fc6 php-mbstring-5.1.6-3.6.fc6 php-mysql-5.1.6-3.6.fc6 php-pdo-5.1.6-3.6.fc6 php-pear-1.4.9-4 php-pgsql-5.1.6-3.6.fc6 samba-3.0.24-7.fc6 samba-client-3.0.24-7.fc6 samba-common-3.0.24-7.fc6 system-config-samba-1.2.35-1.1 don't install the devel packages of anything all of this installed on top of the base install should be well under 1g make sure and run 'yum update' seems like there are updates every couple hours. I have never tried setting up an install without one. I'm sure that it can be used without one though, you might just be limited on what you can do with it. But what it sounds like you are wanting to do with it, it won't matter. If you are running this through VM Ware, you will allot it a given amount of hard drive space. To the installer, that will look like one large hard drive, that you can partition and allocate to your hearts desire. Meaning, that you should be able to have a swap file or not. Just a matter of creating the partition for it or not. Maybe I'm misunderstanding what your intentions are??? If so, please explain further. -- 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] Encoding of PHP files
Jochem Maas wrote: Richard Heyes wrote: Guus Ellenkamp wrote: What encoding should a PHP file itself have (so not it's output setting). Plain ASCII AFAIK. huh? I generally save my files in the same encoding as the output encoding of the site, this is so that literal strings are output correctly. I don't know - I'm English. -- Richard Heyes 0844 801 1072 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Small LAMP install/distro
Don't you punks read the archives?? http://marc.info/?l=php-generalm=106579709910174w=2 http://marc.info/?l=php-generalm=107902806617669w=2 http://marc.info/?l=php-generalm=109556769132522w=2 There's always someone who gets their nickers all bunched up with respect to top posting :B Cheers, Rob. On Fri, 2007-06-22 at 11:15 -0400, Daniel Brown wrote: My thoughts exactly, TG. I was just thinking about that this morning, in fact --- exactly the stuff you said. That aside, I started using a DSL/Knoppix distro to modify to automatically install a server environment as opposed to the desktop environment. As such, without the need for a GUI, et cetera, it should be even smaller than the 50MB ISO it is now, and will be even more embed-able. I'm only working on it in my spare time, so it may not be ready for use when you need it, but if I keep moving forward with it, I'll keep you posted if you'd like I'll even write the updates up top here. On 6/22/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: First, funny that you say that from a Gmail account, where top-posting is encouraged by the mail system. Second, and not to get into a big discussion about top vs bottom posting, but I top-post because typically if I'm involved in a conversation, I know what's been said already and don't want to scroll past a ton of it to get to the meat. To me, an original message is included in a reply as a quick reference as to what's being replied to and a reminder of what's been said. The people top-posting probably screws the most are the daily digest readers. But even then, if a reply is properly trimmed, then it shouldn't matter if it's top or bottom posted. Doesn't help that ePrompter (little app I use to check many pop3 and web based emails) has primative original email handling where it won't indent with or anything, pretty much forcing you to top-post if you use it to reply. I prefer top posting and don't know why there's so much animosity against it. When I open an email, the first thing I want to see is what someone said in that email. If I need a reminder of what was already said, or clarification on what they're replying to exactly, then I can scroll down. -TG = = = Original message = = = ps. Please don't top post! Tijnema ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Small LAMP install/distro
Thanks for the suggestions.. but again, the question wasn't what distro of linux to use. And I don't mind upgrading things. The question is what would someone recommend for a really small distro of linux preferably with the bare essentials + apache, mysql, php and samba. Failing that, I'll just grab one of the small linux distros out there and install the stuff I need manually. I just don't know if some of those small distros are missing anything that would make installing AMP+Samba tricky. Anyway, I'll figure it out. It's not a huge priority, but something that'd make my hobby development a lot easier. -TG = = = Original message = = = I can recommend Fedora Core 6, it has more uptodate Apache, PHP and MySQL, than does Red Hat Enterprise 4, which is what the company I consult for installed on their VM-ware environment. We spent a lot of time upgrading everything on the VM Host because the RH Enterprise was so far behind. I run the Fedora 6 on a spare machine at home, and everything that version is far superior, don't even try to convince the corporate types though, they want a corporate name behind things, like there might be someone to blame, other than themselves, if something goes wrong. I've also used Free BSD, Redhat 9, and older versions of Suse, but prefer the Fedora. The MySQL on Fedora 6 has master/slave replication, if you know what that is. Warren ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Small LAMP install/distro
Jim Lucas wrote: [EMAIL PROTECTED] wrote: Excellent information Jim! Thanks a ton! I really wish I knew linux more intimately so I knew what was a vital organ and what was an appendix :) one other thing. fedore + yum will do all the work for you with regards to decencies and system requirements. The reason I de-select everything from the installer, is that it likes to install a bunch of stuff that I will never you. Plus it is just more crap to try and keep up-to-date and happy. Then, I only install exactly what I need. But one nice thing is, is that the package manager (rpm) is rather handy. You can install stuff, test with it, build with it, then remove it when it is no longer needed. You might check into Fedora Core 7. It was just released at the first of this month. Fedora put themselves on a 5 month version window. So, version 8 is going to be out in November. You can check the website for details on that. http://fedoraproject.org/wiki/ This will give you all the info you need. Your suggestions sound like exactly what I'm looking for. Greatly appreciated! Actually.. one question. Won't it try to set up a swap partition? Or will what you recommend keep that to a minimum too? you can choose to customize the partition process, and at that point, you can create a 100meg swap if you want. Thanks again.. finally some useful information to a simple question. hah (not that I don't appreciate the advice that's been given so far.. it's just not what I was looking for) -TG = = = Original message = = = I would install Fedora Core 6. When asked which packages to install, uncheck everything. Then, once you have the install complete, using yum install ~httpd ~php ~mysql ~samba Here is my current running packages for the above programs httpd-2.2.4-2.fc6 libdbi-dbd-mysql-0.8.1a-1.2.2 mysql-5.0.27-1.fc6 mysql-connector-odbc-3.51.12-2.2 mysql-server-5.0.27-1.fc6 php-5.1.6-3.6.fc6 php-cli-5.1.6-3.6.fc6 php-common-5.1.6-3.6.fc6 php-mbstring-5.1.6-3.6.fc6 php-mysql-5.1.6-3.6.fc6 php-pdo-5.1.6-3.6.fc6 php-pear-1.4.9-4 php-pgsql-5.1.6-3.6.fc6 samba-3.0.24-7.fc6 samba-client-3.0.24-7.fc6 samba-common-3.0.24-7.fc6 system-config-samba-1.2.35-1.1 don't install the devel packages of anything all of this installed on top of the base install should be well under 1g make sure and run 'yum update' seems like there are updates every couple hours. I have never tried setting up an install without one. I'm sure that it can be used without one though, you might just be limited on what you can do with it. But what it sounds like you are wanting to do with it, it won't matter. If you are running this through VM Ware, you will allot it a given amount of hard drive space. To the installer, that will look like one large hard drive, that you can partition and allocate to your hearts desire. Meaning, that you should be able to have a swap file or not. Just a matter of creating the partition for it or not. Maybe I'm misunderstanding what your intentions are??? If so, please explain further. -- 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] Small LAMP install/distro
A: Because it breaks the logical sequence of discussion. Q: Why is top posting bad? This explains everything ^^^ On 6/22/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: First, funny that you say that from a Gmail account, where top-posting is encouraged by the mail system. All email clients I know reply at top, but one single click and it's done :) And it's not only top posting, it's also good to comment at specific parts of somebody's else reply, and write your comment under that, and not at the top of your message. Second, and not to get into a big discussion about top vs bottom posting, but I top-post because typically if I'm involved in a conversation, I know what's been said already and don't want to scroll past a ton of it to get to the meat. To me, an original message is included in a reply as a quick reference as to what's being replied to and a reminder of what's been said. Yes, but if we have quite long topics, and you refer to some piece of tekst in the middle of it, then we need to guess where you are talking about? The people top-posting probably screws the most are the daily digest readers. But even then, if a reply is properly trimmed, then it shouldn't matter if it's top or bottom posted. Doesn't help that ePrompter (little app I use to check many pop3 and web based emails) has primative original email handling where it won't indent with or anything, pretty much forcing you to top-post if you use it to reply. All i can say: Get a decent mail client. I prefer top posting and don't know why there's so much animosity against it. When I open an email, the first thing I want to see is what someone said in that email. If I need a reminder of what was already said, or clarification on what they're replying to exactly, then I can scroll down. -TG Maybe for you, but when I open a thread, it's nice to start reading from the beginning of the thread huh? And when you didn't read the whole thread, and you see a message from someone so that you know where he's replying to? If you're top posting then everyone would need to scroll down first, and then read the post from bottom to top :S Tijnema = = = Original message = = = ps. Please don't top post! Tijnema ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with matrix
On 6/22/07, Andres Rojas [EMAIL PROTECTED] wrote: Hi all, I'm new in PHP programming and I have a problem with this script. I need to read a large file around 2Mb and several lines (28000). All start Ok, but suddenly the script stop without message error. ?php $fichero=62007lg.txt; $buffer = file($fichero); $lineas = count($buffer); foreach($buffer as $linea){ list($day, $month, $year, $hour, $min, $temp, $hum, $dew, $baro, $wind, $gust, $wdir, $rlastm, $rdai, $rmon, $ryear, $heat)=sscanf($linea,%d %d %d %d %d %f %d %f %f %d %d %d %f %f %f %f %f \n); $mday[]=$day; $mmonth[]=$month; $myear[]=$year; $mhour[]=$hour; $mmin[]=$min; $mtemp[]=$temp; $mhum[]=$hum; $mdew[]=$dew; $mbaro[]=$baro; $mwind[]=$wind; $mgust[]=$gust; $mwdir[]=$wdir; $mrlastm[]=$rlastm; $mdai[]=$rdai; $mrmon[]=$rmon; $mryear[]=$ryear; $mheat[]=$heat; echo$day $month $year $hour $min $temp $hum $dew $baro $wind $gust $wdir $rlastm $rdai $rmon $ryear $heat br; } ? If only I print the variable $buffer all it's ok, but when I try to fill all the matrix the script doesn't work. If I reduce the number of matrix only a 3 o 4 it's Ok, but If I increase number of this matrix the script crash again. Perhaps it's a problem of memory of server, but my service provider say me that this is not the problem. Thank you very much I don't know where the problem is, but I would use explode instead of sscanf, so try if this code works: ?php $fichero=62007lg.txt; $buffer = file($fichero,FILE_IGNORE_NEW_LINES); // Remove new lines in array $lineas = count($buffer); foreach($buffer as $linea){ $array = explode( ,$linea); $mday[]=$array[0]; $mmonth[]=$array[1]; $myear[]=$array[2]; $mhour[]=$array[3]; $mmin[]=$array[4]; $mtemp[]=$array[5]; $mhum[]=$array[6]; $mdew[]=$array[7]; $mbaro[]=$array[8]; $mwind[]=$array[9]; $mgust[]=$array[10]; $mwdir[]=$array[11]; $mrlastm[]=$array[12]; $mdai[]=$array[13]; $mrmon[]=$array[14]; $mryear[]=$array[15]; $mheat[]=$array[16]; echo$array[0] $array[1] $array[2] $array[3] $array[4] $array[5] $array[6] $array[7] $array[8] $array[9] $array[10] $array[11] $array[12] $array[13] $array[14] $array[15] $array[16] br; } ? Tijnema -- Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Small LAMP install/distro
[EMAIL PROTECTED] wrote: Excellent information Jim! Thanks a ton! I really wish I knew linux more intimately so I knew what was a vital organ and what was an appendix :) Your suggestions sound like exactly what I'm looking for. Greatly appreciated! Actually.. one question. Won't it try to set up a swap partition? Or will what you recommend keep that to a minimum too? Thanks again.. finally some useful information to a simple question. hah (not that I don't appreciate the advice that's been given so far.. it's just not what I was looking for) -TG = = = Original message = = = I would install Fedora Core 6. When asked which packages to install, uncheck everything. Then, once you have the install complete, using yum install ~httpd ~php ~mysql ~samba Here is my current running packages for the above programs httpd-2.2.4-2.fc6 libdbi-dbd-mysql-0.8.1a-1.2.2 mysql-5.0.27-1.fc6 mysql-connector-odbc-3.51.12-2.2 mysql-server-5.0.27-1.fc6 php-5.1.6-3.6.fc6 php-cli-5.1.6-3.6.fc6 php-common-5.1.6-3.6.fc6 php-mbstring-5.1.6-3.6.fc6 php-mysql-5.1.6-3.6.fc6 php-pdo-5.1.6-3.6.fc6 php-pear-1.4.9-4 php-pgsql-5.1.6-3.6.fc6 samba-3.0.24-7.fc6 samba-client-3.0.24-7.fc6 samba-common-3.0.24-7.fc6 system-config-samba-1.2.35-1.1 don't install the devel packages of anything all of this installed on top of the base install should be well under 1g make sure and run 'yum update' seems like there are updates every couple hours. Also, just noticed this page for the first time. http://fedoraproject.org/wiki/FedoraLiveCD Look at option 8 -- 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] fsockopen problems
On 6/22/07, Ray [EMAIL PROTECTED] wrote: hello, I'm having some problems with fsockopen and was hopping for some help. I try to connect to a host via fsockopen and I get getaddrinfo failed errors, but if I try fsockopen with google, everything works. sample test code $fp=fsockopen('apps.subname.domain.com/xml_2.4/xml.php',80,$errno, $errstr); var_dump($errno); var_dump($errstr); $fp=fsockopen(000.00.00.000/xml_2.4/xml.php,80,$errno, $errstr); var_dump($errno); var_dump($errstr); $fp=fsockopen('www.google.ca',80,$errno, $errstr); var_dump($errno); var_dump($errstr); (sorry for sanitizing, not my choice.) I can ping the host from the server, and going to this site in a browser gives the expected output. Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: hostname nor servname provided, or not known in /usr/local/www/apache22/data/index.php on line 119 Warning: fsockopen() [function.fsockopen]: unable to connect to apps.subname.domain.com/xml_2.4/xml.php:80 (Unknown error) in /usr/local/www/apache22/data/index.php on line 119 int(0) string(0) [note no error for google. should be here] Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: hostname nor servname provided, or not known in /usr/local/www/apache22/data/index.php on line 122 Warning: fsockopen() [function.fsockopen]: unable to connect to 000.00.00.000/xml_2.4/xml.php:80 (Unknown error) in /usr/local/www/apache22/data/index.php on line 122 int(0) string(0) int(0) string(0) With fsockopen you connect to a host, not to the host with full path... This would work fine: $fp=fsockopen('apps.subname.domain.com',80,$errno, $errstr); var_dump($errno); var_dump($errstr); Now you probably want to get that file, so you should do a fwrite: fwrite($fp,GET /xml_2.4/xml.php HTTP/1.1\r\nHost: apps.subname.domain.com\r\n\r\n); *note: All above should be on one single line Then, after you made a request, you can get the data with fread: $data = fread($fp,102400); // 100KB of data max This returns the page, including the headers! If you only want data, you're better off using file_get_contents function, like this: $data = file_get_contents('apps.subname.domain.com/xml_2.4/xml.php); Hope this helps ;) Tijnema -- Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] working with a pdf file and a mysql query
I have created a pdf form with php that prints out one record using php_show_xy statements but when I try to print out a query with multiple lines of data I get an error that reads Fatal error: Uncaught exception 'PDFlibException' with message 'Function must not be called in 'object' scope' in C:\xampp\htdocs\payment\html\php code\dayrpt.php:60 Stack trace: #0 C:\xampp\htdocs\payment\html\php code\dayrpt.php(60): pdf_show_xy() #1 {main} thrown in C:\xampp\htdocs\payment\html\php code\dayrpt.php on line 60 This is the code I am trying, it works with just 1 item to return but not with 2 or more items, to use any suggestions would be helpful. $linenum = '600'; while ($row = mysql_fetch_assoc($result)) { PDF_show_xy($pdf, $row['patname'] ,80,$linenum); PDF_show_xy($pdf, $row['pmtdate'] , 225, $linenum); PDF_show_xy($pdf, $row['checkamt'], 300,$linenum); PDF_show_xy($pdf, $row['cashamt'], 375,$linenum); Pdf_show_xy($pdf, $row['ccamt'], 450, $linenum); $total = $row['checkamt'] + $row['cashamt'] + $row['ccamt']; PDF_show_xy($pdf, $total,525,$linenum); $linenum = $linenum - '10'; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problems with matrix
Hi all, I'm new in PHP programming and I have a problem with this script. I need to read a large file around 2Mb and several lines (28000). All start Ok, but suddenly the script stop without message error. ?php $fichero=62007lg.txt; $buffer = file($fichero); $lineas = count($buffer); foreach($buffer as $linea){ list($day, $month, $year, $hour, $min, $temp, $hum, $dew, $baro, $wind, $gust, $wdir, $rlastm, $rdai, $rmon, $ryear, $heat)=sscanf($linea,%d %d %d %d %d %f %d %f %f %d %d %d %f %f %f %f %f \n); $mday[]=$day; $mmonth[]=$month; $myear[]=$year; $mhour[]=$hour; $mmin[]=$min; $mtemp[]=$temp; $mhum[]=$hum; $mdew[]=$dew; $mbaro[]=$baro; $mwind[]=$wind; $mgust[]=$gust; $mwdir[]=$wdir; $mrlastm[]=$rlastm; $mdai[]=$rdai; $mrmon[]=$rmon; $mryear[]=$ryear; $mheat[]=$heat; echo$day $month $year $hour $min $temp $hum $dew $baro $wind $gust $wdir $rlastm $rdai $rmon $ryear $heat br; } ? If only I print the variable $buffer all it's ok, but when I try to fill all the matrix the script doesn't work. If I reduce the number of matrix only a 3 o 4 it's Ok, but If I increase number of this matrix the script crash again. Perhaps it's a problem of memory of server, but my service provider say me that this is not the problem. Thank you very much -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ftp_get() problem
New to php and this list. Googled a lot and scoured newsgroups to no avail. So now I'm here looking for an answer. Here's my offending line: $gotFile = ftp_get( $connection, $destination, $source, FTP_BINARY ); Just prior to execution all parameters have valid values. The following error is reported: Warning: ftp_get() [function.ftp-get]: Error opening iPhoneRingTone.mp3 in /Users/b1ueskyz/Sites/pmcRoutines.php on line 91 Using the same parameters I am able to successfully ftp_put(), ftp_rename(), and ftp_delete()the file. I just can't 'get' it. Any help or direction is greatly appreciated. -Phil Curry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ftp_get() problem
On 6/22/07, Phil Curry [EMAIL PROTECTED] wrote: New to php and this list. Googled a lot and scoured newsgroups to no avail. So now I'm here looking for an answer. Here's my offending line: $gotFile = ftp_get( $connection, $destination, $source, FTP_BINARY ); Just prior to execution all parameters have valid values. The following error is reported: Warning: ftp_get() [function.ftp-get]: Error opening iPhoneRingTone.mp3 in /Users/b1ueskyz/Sites/pmcRoutines.php on line 91 Using the same parameters I am able to successfully ftp_put(), ftp_rename(), and ftp_delete()the file. I just can't 'get' it. Any help or direction is greatly appreciated. -Phil Curry When you go to this server with some FTP software (or just your browser), and log in etc. Can you download the file then? Seems like a permission problem to me... Tijnema -- Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strange Fatal Error Possibly Memory
Tijnema [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 6/21/07, Dan [EMAIL PROTECTED] wrote: I'm using Delphi4PHP so a lot of the code is prewritten components, libraries, etc. Here's some code that I can post without giving away too much. As you can see it's not your typical PHP, it is using a ton of specific functions. snip Nah, the code is probably in the Delphi4PHP code, I found this forum topic, which might help you: http://forums.delphi-php.net/showthread.php?s=7914eb00a6869351f1734d447e6c6faat=401 Tijnema I'm checked and renamed any and all functions that sound like they would even remotely conflict with some other PHP function by putting the name of the program on the end. I also after looking for a while found that if you call a function but spell the function incorrectly when you're calling it you can get the same fatal error. I also checked every PHP call and they are all spelled correctly. I also looked through all my file access code and made sure that the handlers always closed. Is there some way to track down where this Fatal Error is coming from? I know you can't catch them like exceptions but there must be SOME way of debugging them. Right? - Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] working with a pdf file and a mysql query
On 6/22/07, Mike Ryan [EMAIL PROTECTED] wrote: I have created a pdf form with php that prints out one record using php_show_xy statements but when I try to print out a query with multiple lines of data I get an error that reads Fatal error: Uncaught exception 'PDFlibException' with message 'Function must not be called in 'object' scope' in C:\xampp\htdocs\payment\html\php code\dayrpt.php:60 Stack trace: #0 C:\xampp\htdocs\payment\html\php code\dayrpt.php(60): pdf_show_xy() #1 {main} thrown in C:\xampp\htdocs\payment\html\php code\dayrpt.php on line 60 This is the code I am trying, it works with just 1 item to return but not with 2 or more items, to use any suggestions would be helpful. $linenum = '600'; while ($row = mysql_fetch_assoc($result)) { PDF_show_xy($pdf, $row['patname'] ,80,$linenum); PDF_show_xy($pdf, $row['pmtdate'] , 225, $linenum); PDF_show_xy($pdf, $row['checkamt'], 300,$linenum); PDF_show_xy($pdf, $row['cashamt'], 375,$linenum); Pdf_show_xy($pdf, $row['ccamt'], 450, $linenum); $total = $row['checkamt'] + $row['cashamt'] + $row['ccamt']; PDF_show_xy($pdf, $total,525,$linenum); $linenum = $linenum - '10'; } Did you check for the return values of those PDF_show_xy functions? You should check if they were succesfull or not Tijnema -- Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strange Fatal Error Possibly Memory
On 6/22/07, Dan [EMAIL PROTECTED] wrote: Tijnema [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 6/21/07, Dan [EMAIL PROTECTED] wrote: I'm using Delphi4PHP so a lot of the code is prewritten components, libraries, etc. Here's some code that I can post without giving away too much. As you can see it's not your typical PHP, it is using a ton of specific functions. snip Nah, the code is probably in the Delphi4PHP code, I found this forum topic, which might help you: http://forums.delphi-php.net/showthread.php?s=7914eb00a6869351f1734d447e6c6faat=401 Tijnema I'm checked and renamed any and all functions that sound like they would even remotely conflict with some other PHP function by putting the name of the program on the end. I also after looking for a while found that if you call a function but spell the function incorrectly when you're calling it you can get the same fatal error. I also checked every PHP call and they are all spelled correctly. I also looked through all my file access code and made sure that the handlers always closed. Is there some way to track down where this Fatal Error is coming from? I know you can't catch them like exceptions but there must be SOME way of debugging them. Right? - Daniel If you have access to the PHP CLI, you could try running strace or gdb on it (strace is more usefull here I think), and see what happens inside of PHP. Tijnema -- Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ftp_get() problem
On 6/22/07, Phil Curry [EMAIL PROTECTED] wrote: Oops forgot that part. Yes If I use an ftp client or just command line ftp I can get the file. That's why I thought it must be my code. -Phil Curry And what about the local file? Does PHP has the rights to create the local file? Does this work: file_put_contents($destination, Test string to write); You could also try to set $destination to somewhere in /tmp, because it's 99% guaranteed that PHP has write access there :) Tijnema ps. Please don't top post On Jun 22, 2007, at 10:19 AM, Tijnema wrote: On 6/22/07, Phil Curry [EMAIL PROTECTED] wrote: New to php and this list. Googled a lot and scoured newsgroups to no avail. So now I'm here looking for an answer. Here's my offending line: $gotFile = ftp_get( $connection, $destination, $source, FTP_BINARY ); Just prior to execution all parameters have valid values. The following error is reported: Warning: ftp_get() [function.ftp-get]: Error opening iPhoneRingTone.mp3 in /Users/b1ueskyz/Sites/pmcRoutines.php on line 91 Using the same parameters I am able to successfully ftp_put(), ftp_rename(), and ftp_delete()the file. I just can't 'get' it. Any help or direction is greatly appreciated. -Phil Curry When you go to this server with some FTP software (or just your browser), and log in etc. Can you download the file then? Seems like a permission problem to me... Tijnema -- Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info -- Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fsockopen problems
On Friday 22 June 2007 10:59 am, Tijnema wrote: On 6/22/07, Ray [EMAIL PROTECTED] wrote: hello, I'm having some problems with fsockopen and was hopping for some help. I try to connect to a host via fsockopen and I get getaddrinfo failed errors, but if I try fsockopen with google, everything works. sample test code $fp=fsockopen('apps.subname.domain.com/xml_2.4/xml.php',80,$errno, $errstr); var_dump($errno); var_dump($errstr); $fp=fsockopen(000.00.00.000/xml_2.4/xml.php,80,$errno, $errstr); var_dump($errno); var_dump($errstr); $fp=fsockopen('www.google.ca',80,$errno, $errstr); var_dump($errno); var_dump($errstr); (sorry for sanitizing, not my choice.) I can ping the host from the server, and going to this site in a browser gives the expected output. Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: hostname nor servname provided, or not known in /usr/local/www/apache22/data/index.php on line 119 Warning: fsockopen() [function.fsockopen]: unable to connect to apps.subname.domain.com/xml_2.4/xml.php:80 (Unknown error) in /usr/local/www/apache22/data/index.php on line 119 int(0) string(0) [note no error for google. should be here] Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: hostname nor servname provided, or not known in /usr/local/www/apache22/data/index.php on line 122 Warning: fsockopen() [function.fsockopen]: unable to connect to 000.00.00.000/xml_2.4/xml.php:80 (Unknown error) in /usr/local/www/apache22/data/index.php on line 122 int(0) string(0) int(0) string(0) With fsockopen you connect to a host, not to the host with full path... This would work fine: $fp=fsockopen('apps.subname.domain.com',80,$errno, $errstr); var_dump($errno); var_dump($errstr); Now you probably want to get that file, so you should do a fwrite: fwrite($fp,GET /xml_2.4/xml.php HTTP/1.1\r\nHost: apps.subname.domain.com\r\n\r\n); *note: All above should be on one single line Then, after you made a request, you can get the data with fread: $data = fread($fp,102400); // 100KB of data max This returns the page, including the headers! If you only want data, you're better off using file_get_contents function, like this: $data = file_get_contents('apps.subname.domain.com/xml_2.4/xml.php); Hope this helps ;) Tijnema Thanks, that does help. Thats exactly what I was looking for. Ray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with matrix
On Fri, 22 Jun 2007 18:09:02 +0100 Tijnema wrote: On 6/22/07, Andres Rojas [EMAIL PROTECTED] wrote: Hi all, I'm new in PHP programming and I have a problem with this script. I need to read a large file around 2Mb and several lines (28000). All start Ok, but suddenly the script stop without message error. ?php $fichero=62007lg.txt; $buffer = file($fichero); $lineas = count($buffer); foreach($buffer as $linea){ list($day, $month, $year, $hour, $min, $temp, $hum, $dew, $baro, $wind, $gust, $wdir, $rlastm, $rdai, $rmon, $ryear, $heat)=sscanf($linea,%d %d %d %d %d %f %d %f %f %d %d %d %f %f %f %f %f \n); $mday[]=$day; $mmonth[]=$month; $myear[]=$year; $mhour[]=$hour; $mmin[]=$min; $mtemp[]=$temp; $mhum[]=$hum; $mdew[]=$dew; $mbaro[]=$baro; $mwind[]=$wind; $mgust[]=$gust; $mwdir[]=$wdir; $mrlastm[]=$rlastm; $mdai[]=$rdai; $mrmon[]=$rmon; $mryear[]=$ryear; $mheat[]=$heat; echo$day $month $year $hour $min $temp $hum $dew $baro $wind $gust $wdir $rlastm $rdai $rmon $ryear $heat br; } ? If only I print the variable $buffer all it's ok, but when I try to fill all the matrix the script doesn't work. If I reduce the number of matrix only a 3 o 4 it's Ok, but If I increase number of this matrix the script crash again. Perhaps it's a problem of memory of server, but my service provider say me that this is not the problem. Thank you very much I don't know where the problem is, but I would use explode instead of sscanf, so try if this code works: ?php $fichero=62007lg.txt; $buffer = file($fichero,FILE_IGNORE_NEW_LINES); // Remove new lines in array $lineas = count($buffer); foreach($buffer as $linea){ $array = explode( ,$linea); $mday[]=$array[0]; $mmonth[]=$array[1]; $myear[]=$array[2]; $mhour[]=$array[3]; $mmin[]=$array[4]; $mtemp[]=$array[5]; $mhum[]=$array[6]; $mdew[]=$array[7]; $mbaro[]=$array[8]; $mwind[]=$array[9]; $mgust[]=$array[10]; $mwdir[]=$array[11]; $mrlastm[]=$array[12]; $mdai[]=$array[13]; $mrmon[]=$array[14]; $mryear[]=$array[15]; $mheat[]=$array[16]; echo$array[0] $array[1] $array[2] $array[3] $array[4] $array[5] $array[6] $array[7] $array[8] $array[9] $array[10] $array[11] $array[12] $array[13] $array[14] $array[15] $array[16] br; } ? Tijnema Thanks Tijnema for your code, but I have the same problem, the echo doesn´t print all the values and stop without error message, why? perhaps the file it's too long? -- Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ftp_get() Pt2
Oops. Forgot to mention If I use an ftp client of ftp from the command line, I can 'get' the file. This is why I thought it was my code. Thanks. -Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Small LAMP install/distro
Thanks again for the info, Jim. will look into the 'install to flash drive' information. Technically that's not what I'm doing, just want to store the virtual machine on the flash drive, but the installation instructions should be tight enough to be pertinent still. I think you got close enough understanding to what I'm trying to do. :) = = = Original message = = = I have never tried setting up an install without one. I'm sure that it can be used without one though, you might just be limited on what you can do with it. But what it sounds like you are wanting to do with it, it won't matter. If you are running this through VM Ware, you will allot it a given amount of hard drive space. To the installer, that will look like one large hard drive, that you can partition and allocate to your hearts desire. Meaning, that you should be able to have a swap file or not. Just a matter of creating the partition for it or not. Maybe I'm misunderstanding what your intentions are??? If so, please explain further. -- 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 ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Small LAMP install/distro
logic is subjective. When I read Because it breaks the logical sequence of discussion., I already knew what you were talking about without having to read the question.. because I knew what was being discussed in this thread. If it wasn't an answer to my original question, then it was about top-posting vs bottom-posting. To me, A: then Q:, in this context, makes perfect sense and is therefore 'logical'. If people have a problem with determining context and having short term memory loss, then I don't know what to say. Hmm.. maybe that's a good question to put on our job interview list for prospective new programmers. Do you have an opinion on top posting vs bottom posting? just to see how they answer. Bottom posting makes sense if you're using papyrus scrolls. Or are forced into a linear discussion format for some reason. Email is a little more flexible than that. Does it confuse you reading my messages like this? Do you find yourself drifting to the bottom before the top makes any sense at all? I'm guessing not. Answer this, did you even look at or read your 'original message' below before comprehending my message up here? Probably not, because you already know what was said and what I'm responding to. Tell me I'm wrong. It's an exceedingly silly conversation and is probably on a list of 'holy wars' somewhere. I just don't get why 'top posting' is so bad. If it's all for the sake of 'logic' then how come it seems perfectly logical to me but is still somehow 'illogical' or 'breaks logical flow'? Anyway.. I'm sure there'll be more silly debate later. -TG PS. Don't read below. It break's logical flow. You might sprain something. = = = Original message = = = A: Because it breaks the logical sequence of discussion. Q: Why is top posting bad? This explains everything ^^^ ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] fsockopen problems
hello, I'm having some problems with fsockopen and was hopping for some help. I try to connect to a host via fsockopen and I get getaddrinfo failed errors, but if I try fsockopen with google, everything works. sample test code $fp=fsockopen('apps.subname.domain.com/xml_2.4/xml.php',80,$errno, $errstr); var_dump($errno); var_dump($errstr); $fp=fsockopen(000.00.00.000/xml_2.4/xml.php,80,$errno, $errstr); var_dump($errno); var_dump($errstr); $fp=fsockopen('www.google.ca',80,$errno, $errstr); var_dump($errno); var_dump($errstr); (sorry for sanitizing, not my choice.) I can ping the host from the server, and going to this site in a browser gives the expected output. Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: hostname nor servname provided, or not known in /usr/local/www/apache22/data/index.php on line 119 Warning: fsockopen() [function.fsockopen]: unable to connect to apps.subname.domain.com/xml_2.4/xml.php:80 (Unknown error) in /usr/local/www/apache22/data/index.php on line 119 int(0) string(0) [note no error for google. should be here] Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: hostname nor servname provided, or not known in /usr/local/www/apache22/data/index.php on line 122 Warning: fsockopen() [function.fsockopen]: unable to connect to 000.00.00.000/xml_2.4/xml.php:80 (Unknown error) in /usr/local/www/apache22/data/index.php on line 122 int(0) string(0) int(0) string(0) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strange Fatal Error Possibly Memory
Actually I went through and commented out all my code, releasing functions from the huge comment as I ran the code and didn't see the error. I came down to two functions which has function names that apparently were STILL bad, I don't know what names are reserved in D4PHP so I guess I'll have to be more carefull from now on. They're now Cat and Dog, yeah but it works. - Dan Tijnema [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 6/22/07, Dan [EMAIL PROTECTED] wrote: Tijnema [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 6/21/07, Dan [EMAIL PROTECTED] wrote: I'm using Delphi4PHP so a lot of the code is prewritten components, libraries, etc. Here's some code that I can post without giving away too much. As you can see it's not your typical PHP, it is using a ton of specific functions. snip Nah, the code is probably in the Delphi4PHP code, I found this forum topic, which might help you: http://forums.delphi-php.net/showthread.php?s=7914eb00a6869351f1734d447e6c6faat=401 Tijnema I'm checked and renamed any and all functions that sound like they would even remotely conflict with some other PHP function by putting the name of the program on the end. I also after looking for a while found that if you call a function but spell the function incorrectly when you're calling it you can get the same fatal error. I also checked every PHP call and they are all spelled correctly. I also looked through all my file access code and made sure that the handlers always closed. Is there some way to track down where this Fatal Error is coming from? I know you can't catch them like exceptions but there must be SOME way of debugging them. Right? - Daniel If you have access to the PHP CLI, you could try running strace or gdb on it (strace is more usefull here I think), and see what happens inside of PHP. Tijnema -- Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Small LAMP install/distro
[EMAIL PROTECTED] wrote: logic is subjective. When I read Because it breaks the logical sequence of discussion., I already knew what you were talking about without having to read the question.. because I knew what was being discussed in this thread. If it wasn't an answer to my original question, then it was about top-posting vs bottom-posting. I was going to stay out of this discussion because I've seen it all before so many times that I'm bored of it now, but this comment hit one of my buttons. This is an incredibly selfish attitude for several reasons... 1) Not all of us keep up with the list in real time. In fact, I'd put money on it being a very small percentage of the subscribers. Top posting means it requires more effort to remember where a thread had gotten to. 2) This also applies to the archives. This list gets archived on a lot of sites, and if you hit one particular message from a search engine you will have the same problem. By responding inside the email to which you are responding, you are aligning your comments in an appropriate context. By top posting you are making it more difficult for people to understand the context. 3) This is basically the same as point 1, but I think it's still worth making. I don't know about anyone else, but this is 1 of 14 lists I subscribe to. Keeping track of what's happening in all current threads in all those lists is not possible, and it helps a great deal if context is built into the messages. In my opinion these are the reasons why top posting is bad etiquette. It devalues the usefulness of the discussion. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] generate an etag header that apache can subsequently use, how?
I have an image.php script that generates images on the fly, way back when this didn't even cache it's result! over time it's got better and better so that now it caches resampled images and outputs Last-Modified headers so that it can send subsequent requests and send out a 304 if appropriate. but ... I need more speed ... so I changed the way in which the cached files were named, setup apache Rewrite rules to serve images directly from the cache of resampled images (stored in /dev/shm) and offered up urls in the form /cache/foo.jpg rather than /image.php?f=foo.jpg - this works fine and apache automatically sends out Etag headers when it serves up the resampled files from the cache, additionally handing out a 304 when it receives a valid Etag in a request. when a cached, resampled image does not exist an apache Rewrite rule will call image.php which will generate the image and output it... BUT it won't generate an Etag header which means that on the second request to an image it will downloaded again because apache does not find an Etag header. I'd like to be able to generate an Etag header in php that matches what Apache generates, I ended up in the apache source code here: http://svn.apache.org/viewvc/httpd/httpd/branches/2.0.x/modules/http/http_protocol.c?view=markup specifically this function, which is used to create each of various 'bits' of the Etag apache generates (by default: Inode, FileSize and FileModificationTime are used but this can be controlled with the FileEtag apache directive): static char *etag_ulong_to_hex(char *next, unsigned long u) { int printing = 0; int shift = sizeof(unsigned long) * 8 - 4; do { unsigned long next_digit = ((u shift) (unsigned long)0xf); if (next_digit) { *next++ = HEX_DIGITS[next_digit]; printing = 1; } else if (printing) { *next++ = HEX_DIGITS[next_digit]; } shift -= 4; } while (shift); *next++ = HEX_DIGITS[u (unsigned long)0xf]; return next; } I have been trying to translate what this does to php code without any luck, dechex() it is not! basically I don't really understand what this function is doing. can anyone help? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Color Coding in Gmail (was: open a file in a folder without knowing the filename)
On 6/21/07, Tijnema [EMAIL PROTECTED] wrote: On 6/21/07, Justin P. Goldberg [EMAIL PROTECTED] wrote: Matt Cutts blogged about color-coding messages in his inbox like Mutt does, http://www.mattcutts.com/blog/keep-it-coming-gmail/ and the solution he found, http://www.mattcutts.com/blog/other-googlers-you-should-read/ This doesn't do what you want though. I think a firefox addon or greasemonkey script would do this better. Yes, and what about the IE users? Server side implementation is a lot better here I think, but that's up to google... Google wouldn't add this feature. What percent of gmail users would use it? 1 in 1000? Google implements features that twenty percent of users use, on the web search at least, and roll them out on comcast users first; I couldn't find the interview where I saw that though. I wish someone would come up with something like google docs, but just for coding though. That would be cool, especially if it could edit files over ftp/sftp and webdav. You mean just a webbased editor? Yes. Not too hard to create, but where to store the files? I don't have a few TB left for such things ;) They would be stored online. Besides, it would be text files. The editor itself would not be too hard to create and seems quite good idea to me, maybe i'll start write something when I have some time :) Well you could support it through google ads or selling ad space. Start small. Tijnema On 6/21/07, Tijnema [EMAIL PROTECTED] wrote: On 6/21/07, Tijnema [EMAIL PROTECTED] wrote: On 6/21/07, Dan [EMAIL PROTECTED] wrote: Seconded :D Cool, please go to the following url and clickthe button: http://gpcc.tijnema.info/ Tijnema Go, go, go people :) 5 users have clicked yet :) Tijnema Tijnema [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 6/21/07, Daniel Brown [EMAIL PROTECTED] wrote: On 6/21/07, Tijnema [EMAIL PROTECTED] wrote: I like that disclaimer :) I write a lot of code for this list in my mail.. Yeah, I think I use the Gmail PHP IDE more than I use ViM! ;-P -- Daniel P. Brown Let's send a future request to google, we want PHP color coding in Gmail!!! :) Tijnema -- 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 -- Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info
[PHP] Re: generate an etag header that apache can subsequently use, how?
hey Jochem, as far as I can see, this should work for you: ?php $stats = stat('/dev/shm/file'); $etag = sprintf('%x-%x-%x', $stats['ino'], $stats['size'], $stats['mtime']); // lowercase hexadecimal numbers separated by dashes header('Etag: '.$etag); ? Assuming your apache is configured to use the inode, modification time and filesize in its etag. The function you attached simply converts integers of type long to hexadecimal strings. It is not the actual function creating the etag itself. - Tul Jochem Maas wrote: I have an image.php script that generates images on the fly, way back when this didn't even cache it's result! over time it's got better and better so that now it caches resampled images and outputs Last-Modified headers so that it can send subsequent requests and send out a 304 if appropriate. but ... I need more speed ... so I changed the way in which the cached files were named, setup apache Rewrite rules to serve images directly from the cache of resampled images (stored in /dev/shm) and offered up urls in the form /cache/foo.jpg rather than /image.php?f=foo.jpg - this works fine and apache automatically sends out Etag headers when it serves up the resampled files from the cache, additionally handing out a 304 when it receives a valid Etag in a request. when a cached, resampled image does not exist an apache Rewrite rule will call image.php which will generate the image and output it... BUT it won't generate an Etag header which means that on the second request to an image it will downloaded again because apache does not find an Etag header. I'd like to be able to generate an Etag header in php that matches what Apache generates, I ended up in the apache source code here: http://svn.apache.org/viewvc/httpd/httpd/branches/2.0.x/modules/http/http_protocol.c?view=markup specifically this function, which is used to create each of various 'bits' of the Etag apache generates (by default: Inode, FileSize and FileModificationTime are used but this can be controlled with the FileEtag apache directive): static char *etag_ulong_to_hex(char *next, unsigned long u) { int printing = 0; int shift = sizeof(unsigned long) * 8 - 4; do { unsigned long next_digit = ((u shift) (unsigned long)0xf); if (next_digit) { *next++ = HEX_DIGITS[next_digit]; printing = 1; } else if (printing) { *next++ = HEX_DIGITS[next_digit]; } shift -= 4; } while (shift); *next++ = HEX_DIGITS[u (unsigned long)0xf]; return next; } I have been trying to translate what this does to php code without any luck, dechex() it is not! basically I don't really understand what this function is doing. can anyone help? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Color Coding in Gmail (was: open a file in a folder without knowing the filename)
On 6/22/07, Justin P. Goldberg [EMAIL PROTECTED] wrote: On 6/21/07, Tijnema [EMAIL PROTECTED] wrote: On 6/21/07, Justin P. Goldberg [EMAIL PROTECTED] wrote: Matt Cutts blogged about color-coding messages in his inbox like Mutt does, http://www.mattcutts.com/blog/keep-it-coming-gmail/ and the solution he found, http://www.mattcutts.com/blog/other-googlers-you-should-read/ This doesn't do what you want though. I think a firefox addon or greasemonkey script would do this better. Yes, and what about the IE users? Server side implementation is a lot better here I think, but that's up to google... Google wouldn't add this feature. What percent of gmail users would use it? 1 in 1000? Google implements features that twenty percent of users use, on the web search at least, and roll them out on comcast users first; I couldn't find the interview where I saw that though. That's for the web search, this is gmail ;) I wish someone would come up with something like google docs, but just for coding though. That would be cool, especially if it could edit files over ftp/sftp and webdav. You mean just a webbased editor? Yes. Not too hard to create, but where to store the files? I don't have a few TB left for such things ;) They would be stored online. Besides, it would be text files. An average script file on my PC is 5Kb, let's say about 1000 users with each 100 scripts, that would be 1000 * 1000 * 5 = 50 Kb = 500Mb Not too much, but what would it cost? more than google will pay for the ads... The editor itself would not be too hard to create and seems quite good idea to me, maybe i'll start write something when I have some time :) Well you could support it through google ads or selling ad space. Start small. I have had Google ads on a site, which had 30.000 page visits, and that way I got $11 IIRC. (3 large sky scrapers) Seems quite impossible to pay it from ads only... Tijnema Tijnema On 6/21/07, Tijnema [EMAIL PROTECTED] wrote: On 6/21/07, Tijnema [EMAIL PROTECTED] wrote: On 6/21/07, Dan [EMAIL PROTECTED] wrote: Seconded :D Cool, please go to the following url and clickthe button: http://gpcc.tijnema.info/ Tijnema Go, go, go people :) 5 users have clicked yet :) Tijnema Tijnema [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 6/21/07, Daniel Brown [EMAIL PROTECTED] wrote: On 6/21/07, Tijnema [EMAIL PROTECTED] wrote: I like that disclaimer :) I write a lot of code for this list in my mail.. Yeah, I think I use the Gmail PHP IDE more than I use ViM! ;-P -- Daniel P. Brown Let's send a future request to google, we want PHP color coding in Gmail!!! :) Tijnema -- 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 -- Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info -- Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP calling an ISAPI Extension
On 6/22/07, FrozenDice [EMAIL PROTECTED] wrote: I came up with a what I presume to be quicker way of doing this by knowing the format. Since the headers always have \r\n after each line, then a blank line before the content I made this little bit of code. $explodedResult = explode(\r\n, $result); for($i = 0; $i = count($explodedResult); $i++) { if($explodedResult[$i] == ) { return $explodedResult[($i + 1)]; } } - Dan Yes, it is faster, but sometimes, when loading big sites, not all data is send at once, and then you need to get the content-length from the header and read that many bytes. That's why i've written a little bit longer code :) Tijnema On 6/22/07, FrozenDice [EMAIL PROTECTED] wrote: I've read through that code a few times and I still don't understand at all what's going on. Could you explain it? - Dan On 6/22/07, Tijnema [EMAIL PROTECTED] wrote: On 6/20/07, Tijnema [EMAIL PROTECTED] wrote: On 6/19/07, Dan [EMAIL PROTECTED] wrote: Whoops, it turned out just to be a line wrapping problem, it was putting an extra space in. I have it working now, but after every request I get back the returning header in my result to it looks like this: HTTP/1.1 200 OK Content-Length: 184 Content-Type: text/html Server: Microsoft-IIS/7.0 Content: Date: Tue, 19 Jun 2007 17:20:04 GMT The resulting page I really wished to be returned. How do I get this not to set the return header in the $result? Or shoudl I just somehow get rid of the header after I get it? I don't know how long it is so I can't do a substring. Ideas? It has to do something with the way the things are send across the internet, in packages. The manual of fread says that it will read until EOF, the given length or the end of a package... try this code: $post_data = name=wowlikes=true; $fp = fsockopen(localhost,8080); fwrite($fp,POST /Project1.dll HTTP/1.1\r\nHost:localhost\r\nContent-Length:.strlen($post_data).\r\n\r\n.$post_data); $line = fgets($fp); $length = 0; while($line != \r\n) { if(strtolower(substr($line,0,15)) == content-length:) { $length = (int)substr($line,15); } } $result = fread($fp,$length); while(strlen($result) != $length) { $result .= fread($fp,$length-strlen($result)); } echo $result; Ok, above code is untested, and i just written it in gmail, so might be stupid syntax error in it or such. Tijnema Like I said, there might be stupid bugs in, this code is better: $post_data = name=wowlikes=true; $fp = fsockopen(localhost,8080); fwrite($fp,POST /Project1.dll HTTP/1.1\r\nHost:localhost\r\nContent-Length:.strlen($post_data).\r\n\r\n.$post_data); $line = fgets($fp); $length = 0; while($line != \r\n) { if(strtolower(substr($line,0,15)) == content-length:) { $length = (int)substr($line,15); $line = fgets($fp); } } $result = fread($fp,$length); while(strlen($result) != $length) { $result .= fread($fp,$length-strlen($result)); } echo $result; Dan [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I modified your code to work with what I'm doing and this is what I got: $post_data = name=wowlikes=true; $fp = fsockopen(localhost,8080); fwrite($fp,POST /Project1.dll HTTP/1.1\r\nHost: localhost\r\nContent-Length: .strlen($post_data).\r\n\r\n.$post_data); $result = fread($fp,102400); // Reads 100KB, change if you need more echo $result; Now when I try that I get a Bad Request invalid header name error. I have an IIS server running localy on port 8080, the Project1.dll is in the root directory, it contains two input components 1 a textfield to type your name, the other a checkbox called likes. What's wrong? Here's it's code: html head titleLearning ISAPI/title /head h3Learning ISAPI!/h3 form name=isapiform method=POST action=/Project1.dll strongPlease enter the following information/strong brName: input type=text name=name brinput type=checkbox name=likes value=true checked I like ISAPI!p input type=submit value=View Output /form /html Tijnema [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 6/19/07, Jim Lucas [EMAIL PROTECTED] wrote: Dan wrote: I wish I could, I can't count on the script being on a linux machine. I also can't expect people to rebuild PHP with the curl library just to use my script. Is there any other way to do a post to a page from a php function? - Daniel Jim Lucas [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dan wrote: I would normaly do it with an AJAX call
Re: [PHP] Small LAMP install/distro
On 6/22/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: logic is subjective. When I read Because it breaks the logical sequence of discussion., I already knew what you were talking about without having to read the question.. because I knew what was being discussed in this thread. If it wasn't an answer to my original question, then it was about top-posting vs bottom-posting. To me, A: then Q:, in this context, makes perfect sense and is therefore 'logical'. If people have a problem with determining context and having short term memory loss, then I don't know what to say. Hmm.. maybe that's a good question to put on our job interview list for prospective new programmers. Do you have an opinion on top posting vs bottom posting? just to see how they answer. Bottom posting makes sense if you're using papyrus scrolls. Or are forced into a linear discussion format for some reason. Email is a little more flexible than that. Does it confuse you reading my messages like this? Do you find yourself drifting to the bottom before the top makes any sense at all? I'm guessing not. Answer this, did you even look at or read your 'original message' below before comprehending my message up here? Probably not, because you already know what was said and what I'm responding to. Tell me I'm wrong. Yes, you're wrong, I know you are talking about top posting, but to which part of my reply does this refer? I came to know that when I was at the end of your reply and I the part of the reply you were refering to... It's an exceedingly silly conversation and is probably on a list of 'holy wars' somewhere. I just don't get why 'top posting' is so bad. If it's all for the sake of 'logic' then how come it seems perfectly logical to me but is still somehow 'illogical' or 'breaks logical flow'? Anyway.. I'm sure there'll be more silly debate later. -TG PS. Don't read below. It break's logical flow. You might sprain something. It does break logical flow, but it was needed to understand what you were quoting. Tijnema = = = Original message = = = A: Because it breaks the logical sequence of discussion. Q: Why is top posting bad? This explains everything ^^^ -- Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Small LAMP install/distro
On 6/22/07, Stut [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: logic is subjective. When I read Because it breaks the logical sequence of discussion., I already knew what you were talking about without having to read the question.. because I knew what was being discussed in this thread. If it wasn't an answer to my original question, then it was about top-posting vs bottom-posting. I was going to stay out of this discussion because I've seen it all before so many times that I'm bored of it now, but this comment hit one of my buttons. This is an incredibly selfish attitude for several reasons... 1) Not all of us keep up with the list in real time. In fact, I'd put money on it being a very small percentage of the subscribers. Top posting means it requires more effort to remember where a thread had gotten to. 2) This also applies to the archives. This list gets archived on a lot of sites, and if you hit one particular message from a search engine you will have the same problem. By responding inside the email to which you are responding, you are aligning your comments in an appropriate context. By top posting you are making it more difficult for people to understand the context. 3) This is basically the same as point 1, but I think it's still worth making. I don't know about anyone else, but this is 1 of 14 lists I subscribe to. Keeping track of what's happening in all current threads in all those lists is not possible, and it helps a great deal if context is built into the messages. In my opinion these are the reasons why top posting is bad etiquette. It devalues the usefulness of the discussion. -Stut I agree with you on all 3 points stut! For point 3, i'm not on 14 lists, but on 4, but it's the same problem for me. Tijnema -- Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP calling an ISAPI Extension
On 6/22/07, FrozenDice [EMAIL PROTECTED] wrote: What do you mean not all the data is sent at once? I'm doing a http request, the browser responds sending back the code for the page. I've never heard of it sending back multiple responses. Plus I'm controling what the server sends from the ISAPI code, I'm only sending info back once. I'm kinda confused on this whole not sending all the data at once. - Dan That's just the way how our network works :) HTTP is over TCP/IP. TCP/IP sends data in packets, each package is max. 1500 bytes. So, when your server sends a site of let's say 1200 bytes then all data will be in one single packet. But when your site returned is more then 1500 bytes, your site will be split across multiple packets. Reading with fread stops after a package is available... This is also noted in the second warning on the fread manual page[1]. Tijnema ps. Please don't top post pps. When you make reply, make sure you have the PHP list in your To: or Cc:, most mail clients allow you to use Reply to all for this. [1] http://www.php.net/fread On 6/22/07, Tijnema [EMAIL PROTECTED] wrote: On 6/22/07, FrozenDice [EMAIL PROTECTED] wrote: I came up with a what I presume to be quicker way of doing this by knowing the format. Since the headers always have \r\n after each line, then a blank line before the content I made this little bit of code. $explodedResult = explode(\r\n, $result); for($i = 0; $i = count($explodedResult); $i++) { if($explodedResult[$i] == ) { return $explodedResult[($i + 1)]; } } - Dan Yes, it is faster, but sometimes, when loading big sites, not all data is send at once, and then you need to get the content-length from the header and read that many bytes. That's why i've written a little bit longer code :) Tijnema On 6/22/07, FrozenDice [EMAIL PROTECTED] wrote: I've read through that code a few times and I still don't understand at all what's going on. Could you explain it? - Dan On 6/22/07, Tijnema [EMAIL PROTECTED] wrote: On 6/20/07, Tijnema [EMAIL PROTECTED] wrote: On 6/19/07, Dan [EMAIL PROTECTED] wrote: Whoops, it turned out just to be a line wrapping problem, it was putting an extra space in. I have it working now, but after every request I get back the returning header in my result to it looks like this: HTTP/1.1 200 OK Content-Length: 184 Content-Type: text/html Server: Microsoft-IIS/7.0 Content: Date: Tue, 19 Jun 2007 17:20:04 GMT The resulting page I really wished to be returned. How do I get this not to set the return header in the $result? Or shoudl I just somehow get rid of the header after I get it? I don't know how long it is so I can't do a substring. Ideas? It has to do something with the way the things are send across the internet, in packages. The manual of fread says that it will read until EOF, the given length or the end of a package... try this code: $post_data = name=wowlikes=true; $fp = fsockopen(localhost,8080); fwrite($fp,POST /Project1.dll HTTP/1.1\r\nHost:localhost\r\nContent-Length:.strlen($post_data).\r\n\r\n.$post_data); $line = fgets($fp); $length = 0; while($line != \r\n) { if(strtolower(substr($line,0,15)) == content-length:) { $length = (int)substr($line,15); } } $result = fread($fp,$length); while(strlen($result) != $length) { $result .= fread($fp,$length-strlen($result)); } echo $result; Ok, above code is untested, and i just written it in gmail, so might be stupid syntax error in it or such. Tijnema Like I said, there might be stupid bugs in, this code is better: $post_data = name=wowlikes=true; $fp = fsockopen(localhost,8080); fwrite($fp,POST /Project1.dll HTTP/1.1\r\nHost:localhost\r\nContent-Length:.strlen($post_data).\r\n\r\n.$post_data); $line = fgets($fp); $length = 0; while($line != \r\n) { if(strtolower(substr($line,0,15)) == content-length:) { $length = (int)substr($line,15); $line = fgets($fp); } } $result = fread($fp,$length); while(strlen($result) != $length) { $result .= fread($fp,$length-strlen($result)); } echo $result; Dan [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I modified your code to work with what I'm doing and this is what I got: $post_data = name=wowlikes=true; $fp = fsockopen(localhost,8080); fwrite($fp,POST /Project1.dll HTTP/1.1\r\nHost: localhost\r\nContent-Length: .strlen($post_data).\r\n\r\n.$post_data); $result = fread($fp,102400); // Reads 100KB, change if you
Re: [PHP] PHP calling an ISAPI Extension
On 6/22/07, Tijnema [EMAIL PROTECTED] wrote: On 6/22/07, FrozenDice [EMAIL PROTECTED] wrote: What do you mean not all the data is sent at once? I'm doing a http request, the browser responds sending back the code for the page. I've never heard of it sending back multiple responses. Plus I'm controling what the server sends from the ISAPI code, I'm only sending info back once. I'm kinda confused on this whole not sending all the data at once. - Dan That's just the way how our network works :) HTTP is over TCP/IP. TCP/IP sends data in packets, each package is max. 1500 bytes. So, when your server sends a site of let's say 1200 bytes then all data will be in one single packet. But when your site returned is more then 1500 bytes, your site will be split across multiple packets. Reading with fread stops after a package is available... This is also noted in the second warning on the fread manual page[1]. Tijnema ps. Please don't top post pps. When you make reply, make sure you have the PHP list in your To: or Cc:, most mail clients allow you to use Reply to all for this. [1] http://www.php.net/fread Thanks, I'm pretty new to Newsgroups so I don't know all the etiquette. I'm actually sometimes reading through email but usually I'm using a newsreader so when a message doen't get to the server it's because I forgot to click reply all in gmail. I'll give another look at your code and try to implement it. It shouldn't take too much longer because the page it's calling is on the same machine. :D - Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Color Coding in Gmail (was: open a file in a folder without knowing the filename)
To all Has http://pastebin.com/ already been forgotten about? Just think about the amount of space that would be saved it people would post code there first and then link it in there email. It might hurt some that are not running on the net when they check their email, but it does have code highlighting. :) Then maybe, when the final product was completed, paste that into the final email to the list for archiving purpose. -- 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] PHP Color Coding in Gmail (was: open a file in a folder without knowing the filename)
On 6/23/07, Jim Lucas [EMAIL PROTECTED] wrote: To all Has http://pastebin.com/ already been forgotten about? Just think about the amount of space that would be saved it people would post code there first and then link it in there email. It might hurt some that are not running on the net when they check their email, but it does have code highlighting. :) Then maybe, when the final product was completed, paste that into the final email to the list for archiving purpose. -- Jim Lucas Nice idea, but the highlighting is bad I think... Take a look at this useless code: http://pastebin.com/934379 and compare it with this: http://86.86.80.41/hl_ex.phps Second one looks a lot better IMO. Tijnema -- Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: generate an etag header that apache can subsequently use, how?
hi Tul, thanks for the feedback ... can I borrow your brain for a little longer? M. Sokolewicz wrote: hey Jochem, as far as I can see, this should work for you: ?php $stats = stat('/dev/shm/file'); $etag = sprintf('%x-%x-%x', $stats['ino'], $stats['size'], $stats['mtime']); // lowercase hexadecimal numbers separated by dashes header('Etag: '.$etag); ? this is what I thought - actually I originally used dechex() - which gave the same output as sprintf(%x, ...) ... which is not surprising. sidenote: I'm actually only using the modification time in the etag right now. I figure this keeps it a little faster - there is next to no chance to that the filemtime will change and the file will be the same and using the inode info is silly because moving the files locally (for whatever reason) shouldn't affect whether a 304 can be given (imho). the fact that this may result in many files with identical Etags maybe incorrect but I don't see the problem as the URL (and therefore the local file) is going to be different. BIG BUT: apache is not generating the same hexadecimal value for the filemtime of a given file as I get from the various attempts with php for a given file I get: apache Etag : 8e6bbb80 mtime via stat(): 1182540030 mtime via filemtime() : 1182540030 sprintf(%x) Etag : 467c20fe dechex() Etag : 467c20fe the http headers for the URL of the file in question are: Date: Fri, 22 Jun 2007 23:00:13 GMT Server: Apache Last-Modified: Fri, 22 Jun 2007 19:20:30 GMT Etag: 8e6bbb80 Accept-Ranges: bytes Content-Length: 11924 Content-Type: image/jpeg X-lori-time-2: 1182553213537 an 'ls -l' on the file in question gives (name of file changed to protect the innocent): -rw-r--r-- 1 apache apache 11924 Jun 22 21:20 foo.jpg I swear it's the same file but apache is generating the hexadecimal representation of the filemtime differently than a 'straight' dec2hex conversion (ala dechex() and sprintf()) doing a hexdec() on the apache generated Etag shows that this is not a question of mtimes being slightly off (for some reason): hexdec(8e6bbb80) = 2389425024 I'm stumped, the comments for etag_ulong_to_hex() in the apache source even states: Generate the human-readable hex representation of an unsigned long (basically a faster version of 'sprintf(%lx)') I'm rather wary of the 'basically' it smells fishy to me ... rather like saying I'm basically a women - sure there is a resemblance, but bit of investigation will show plenty of differences. I have been checking with static image files (ones that go no where near a resampling script) and the same problem occurs. my desk is covered in hair :-/ PS - completely offtrack but what's X-lori-time-2 - I've noticed since not long ago, I have no idea what it is or what purpose it serves, and seemingly nor do the search engines. Assuming your apache is configured to use the inode, modification time and filesize in its etag. The function you attached simply converts integers of type long to hexadecimal strings. It is not the actual function creating the etag itself. ... I'd like to be able to generate an Etag header in php that matches what Apache generates, I ended up in the apache source code here: http://svn.apache.org/viewvc/httpd/httpd/branches/2.0.x/modules/http/http_protocol.c?view=markup ... static char *etag_ulong_to_hex(char *next, unsigned long u) { int printing = 0; int shift = sizeof(unsigned long) * 8 - 4; do { unsigned long next_digit = ((u shift) (unsigned long)0xf); if (next_digit) { *next++ = HEX_DIGITS[next_digit]; printing = 1; } else if (printing) { *next++ = HEX_DIGITS[next_digit]; } shift -= 4; } while (shift); *next++ = HEX_DIGITS[u (unsigned long)0xf]; return next; } ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] waxy ramblings [was:] Re: [PHP] Re: php framework, large site
Daniel Brown wrote: My Spam filter got sick from over-eating. didn't your mother ever tell not to eat the crayons? :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Man Lebt nur einmal - probiers aus !
On 6/23/07, Fernando Cosso [EMAIL PROTECTED] wrote: SPAAM And under which category falls above message? SPAM?? -- Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTML tags in MySQL
Hi gang: I have a client who over the years thought it was great to enter html tags directly into his database via his CMS for display in his web site. Now, he has a mess with some data being shown one way, when he wants it shown another. Plus, not all the tags are well formed and some are even malformed (i.e., b ). So, what to do is the question? Is there an easy way to scrub the data to remove tags; or is this going to be one of those change it where you see it in the CMS; or do I just scrub the data after I extract it from the dB and before displaying it and forget about fixing the dB? Recommendations and suggestions welcomed. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML tags in MySQL
On Sat, 2007-06-23 at 00:16 -0400, tedd wrote: Hi gang: I have a client who over the years thought it was great to enter html tags directly into his database via his CMS for display in his web site. Now, he has a mess with some data being shown one way, when he wants it shown another. Plus, not all the tags are well formed and some are even malformed (i.e., b ). So, what to do is the question? Is there an easy way to scrub the data to remove tags; or is this going to be one of those change it where you see it in the CMS; or do I just scrub the data after I extract it from the dB and before displaying it and forget about fixing the dB? Recommendations and suggestions welcomed. Could probably use the tidy lib: http://ca.php.net/manual/en/ref.tidy.php To clean up the tags. Alternatively strip_tags, and strip them all. This will do nothing for malformed tags like b, and rightly so, who's to say that's not part of an equation :) There's nothing wrong with putting HTML into a database, in fact it's probably better so that in the event you want to display it as HTML you can, and in the event you don't you can scrub as you now wish to do :B Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML tags in MySQL
You can use something like html_tidy to make the code sane, and strip_tags() to remove tags you don't want him using for whatever reason. As for changing b to i because the style guide changed, well, you're on your own there without some really trippy regexing that is well beyond my capabilities. :-) Whether you go through the database and fix it or fix on the fly on display is up to you. There are pros and cons to both methods. On Friday 22 June 2007, tedd wrote: Hi gang: I have a client who over the years thought it was great to enter html tags directly into his database via his CMS for display in his web site. Now, he has a mess with some data being shown one way, when he wants it shown another. Plus, not all the tags are well formed and some are even malformed (i.e., b ). So, what to do is the question? Is there an easy way to scrub the data to remove tags; or is this going to be one of those change it where you see it in the CMS; or do I just scrub the data after I extract it from the dB and before displaying it and forget about fixing the dB? Recommendations and suggestions welcomed. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it. -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php