[PHP] Server-initiated HTTP requests
I'm using php to have several servers communicate between eachother. I want to do the following: Server A sends a request to server B. Server B stores some information about this request, and sends back a response to A (so far it's regular HTTP). Next, server B must send an HTTP request to server C. How can I initiate an HTTP request to server C with PHP? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Dynamic 'left menu's' on site: Like a windows explorer system???
> Hi, > > I need to change my static left menu's into more dynamic ones, like when > you click one title of the menu, it shows it sub menu etc. > > Any body knows if that can be achieved using PHP? Or should i repel on > other techniques? > If someone did make similar stuff, could you please send me an example > or some good ideas? > > Thanks a lot in advance > Yoeri. Such dynamic (no-reload) behaviour can only be achieved in a client side-solution. DHTML, java or flash is what you are looking for. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Search Engines and PHP
> > I was wondering if anyone can enlighten me about the ability of search > engines to read and list PHP pages. I have been told that because PHP > produces a dynamic html page (i.e. one that possibly outputs > different HTML > for each hit or request) that they are not easily added to search engines > (if this is true though what would be the point of having any > html pages if > you can't update or change them at anytime?). Another point was > made to me > was that many PHP pages require additional commands to be passed > through the > URL eg www.domain.com.au/writestufft.php?variable=foobar which search > engines find hard to deal with also. > If any of these are true or if there are such problems which > could result in > the page not getting listed then what are the options. > My only idea has come from the [PHP]url hide thread in which a index.html > single 'wrapper frame' could be applied to the entire site. > Any Ideas > Search-engines read HTML, what drives that HTML is entirely irrelevant. ... however, some searchengines do not index pages that have variables on the url, so those pages will never be indexed by that particular searchengine. But other searchengines will spider about everything (I think google spiders a lot, including dynamic pages) - but realize that the searchengine always contains a snapshot of your page, most likely one taken weeks ago. If you want to be totally searchengine-safe, do not use variables on the url, do not rely on cookies and do not rely on POST variables for the pages you want to have the searchengine spider. Also, you could make a robots.txt file and instruct the searchengines to spider only particular pages on your site. -Sander -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Search Engines and PHP
> > >If you want to be totally searchengine-safe, do not use variables on the > >url, do not rely on cookies and do not rely on POST variables > for the pages > >you want to have the searchengine spider. > > How the heck do you build a dynamic site without URL variables, > cookies, or POST variables? > > Kristofer One way would be to use the url path. Http://script.php/these/are/variables/passed/to/php You fool the searchengine, it thinks 'script.php' is a directory and its getting a file called 'php', but actually you're calling 'script.php' with '/these/are/variables/passed/to/php' as parameters. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] RE: url hide
> > > > Perhaps not related to php but I was wandering, is it > > > > possible to hide > > > > site's real url and replace it with something else (some > > > > other URL). ie. > > > > someone clicks on a link on www.blah.co.uk which takes the > user to an > > > > designated area (ie. /house-search/) on www.foo.co.uk. I want > > > > the user still to see www.blah.co.uk. This is just for > > > > aesthetic reasons > > > > since ones the user finishes the search for houses (on > > > > www.foo.co.uk/house-search/) he/she will return to www.blah.co.uk. > > > > > > > > I have tried www.javascripts.com but no success?? > > you can use frame for doing this. for advanced people still can > see the url but not newbie It just makes me wonder how 'advanced' you need to be to right click and select 'view properties'. (Or a similar simple action when using netrape) A frame also has some drawbacks, most important one being that a user, wherever he is on your site, always bookmarks the frame. It's something that would piss me off :) (Making me work, right click to find the real url I want to bookmakr, etc.) DHTML can do something like you want, but its complicated and not standard. (You can load the contents of URL A in a hidden frame, then replace the contents of the current document with the contents of the hidden frame.) Just forget about the whole idea already, each individual page should have an unique url, and that's the way it's supposed to be. -Sander -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Zend hit (Encoder price)
> > Hello, > > What do you think about Zend position? > http://php.weblogs.com/ > http://zend.com/phorum/read.php?num=3&id=6277&loc=0&thread=6277 > I think that if Zend wants to sell it for $6000, then they have all right to. These guys have worked hard, and they deserve some cash for it. If people can't afford it at $6000, then that's their problem. Software is intellectual property, it shouldn't be free, and authors should be able to charge any price for it they want to charge for it. But, I don't think it's a wise decision to sell it at $6000, personally I think I would sell it between $1000 and $4000, but that's just me. ($6000 is a bit on the high side, considering what alternatives one haves for that price, and considering that anyone who paid $1000 a year back (I recall something about 'sponsoring') gets it all.) -S -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Display progress in browser using flush(); IE versus NS
Netrape supports multipart documents. Read up on your mime types and encodings, and use that to create a nice progressbar in netscape :) > -Original Message- > From: Chris Lee [mailto:[EMAIL PROTECTED]] > Sent: 26 January 2001 23:53 > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Display progress in browser using flush(); IE versus > NS > > > havent tested this but im almost sure that netscape waits until the entire > page is downloaded until being displayed IF there are tables on the page. > write a small test script to see if Im right. > > > -- > > > > Chris Lee > Mediawaveonline.com > [EMAIL PROTECTED] > > > > > > ""Spallek, Heiko"" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hi, > > > > I have a script which slowly processes several thousand lines of text. I > > want to give users a feeling for that the process is not dead. > Thus, I am > > using: > > > > ... > > print "processing "; > > print" > > "; > > flush(); > > > > for($i=0;$i > print". > > "; > > flush(); > > // do something time consuming > > } > > ... > > > > Works perfect in IE 5.5: It shows the word "processing" followed every 2 > > seconds (denpending on what I am doing) by a new period. > > > > But, in Netscape nothing shows up until the entire process has finished. > > When I push "stop" on the Netspace menu it shows what was transfered so > far > > and "Transfer interrupted!" But, I would rather have it the way it is in > IE. > > > > Any idea how to improve the code above? > > Thanks! > > > > Der Heiko > > > > Buchtipp: http://www.aufbruch.com/ > > Heiko und Gisela Spallek: > > Aufbruch ins Land der unbegrenzten Moeglichkeiten. > > Studieren, Arbeiten und Leben in den USA: Tips fuer Neuankoemmlinge > > 2. erweiterte und ueberarbeitete Auflage: ISBN: 3-934407-01-3 > > > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Display progress in browser using flush(); IE versus NS
Look here - http://home.netscape.com/assist/net_sites/mozilla/index.html (That is not an animated gif) http://home.netscape.com/assist/net_sites/pushpull.html It only works in netscape (so far), but hey... you can't forget the two remaining people on the planet that actually use it, right? > -Original Message- > From: Chris Lee [mailto:[EMAIL PROTECTED]] > Sent: 26 January 2001 23:53 > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Display progress in browser using flush(); IE versus > NS > > > havent tested this but im almost sure that netscape waits until the entire > page is downloaded until being displayed IF there are tables on the page. > write a small test script to see if Im right. > > > -- > > > > Chris Lee > Mediawaveonline.com > [EMAIL PROTECTED] > > > > > > ""Spallek, Heiko"" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hi, > > > > I have a script which slowly processes several thousand lines of text. I > > want to give users a feeling for that the process is not dead. > Thus, I am > > using: > > > > ... > > print "processing "; > > print" > > "; > > flush(); > > > > for($i=0;$i > print". > > "; > > flush(); > > // do something time consuming > > } > > ... > > > > Works perfect in IE 5.5: It shows the word "processing" followed every 2 > > seconds (denpending on what I am doing) by a new period. > > > > But, in Netscape nothing shows up until the entire process has finished. > > When I push "stop" on the Netspace menu it shows what was transfered so > far > > and "Transfer interrupted!" But, I would rather have it the way it is in > IE. > > > > Any idea how to improve the code above? > > Thanks! > > > > Der Heiko > > > > Buchtipp: http://www.aufbruch.com/ > > Heiko und Gisela Spallek: > > Aufbruch ins Land der unbegrenzten Moeglichkeiten. > > Studieren, Arbeiten und Leben in den USA: Tips fuer Neuankoemmlinge > > 2. erweiterte und ueberarbeitete Auflage: ISBN: 3-934407-01-3 > > > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Forcing htaccess login again
The request for a password is usually generated by a 401 header. Just do this - Header("WWW-authenticate: basic realm=\"Some realm\""); Header("HTTP/1.1 401 Unauthorized"); exit; That should pop up a box. Just make sure you check the values of $PHP_AUTH_USER/PW first before presenting those headers. This is more of an http question then it is a php question, I strongly advise you to read and understand the HTTP/1.1 rfc - it can be found at http://www.faqs.org/rfcs/rfc2616.html (See chapter 10.4.2 for the documentation of the 401 header) Regards, Sander > -Original Message- > From: Chris Aitken [mailto:[EMAIL PROTECTED]] > Sent: 27 February 2001 00:12 > To: [EMAIL PROTECTED] > Subject: [PHP] Forcing htaccess login again > > > Now im even getting more confused. Ive been doing some more research into > the subject, and cant seem to find any answers. > > All of the PHP documentation about headers() talks about auth via > PHP, but > doesnt mention anything about htaccess as the auth system. > > On my main.php screen, this is where the cookie gets set once the > user logs > in with htaccess. What im trying to do is incorporate a section into > (possibly) main.php which forces the htaccess to rerequest login again > using my .htpasswd password file as the criteria. > > Is there some sort of header information which will make the > webserver turn > around and say. "Hey, you shouldnt be here anymore, login again and I > might think about letting you in" > > Because once I can get the user logging in again, it will go to > the rest of > main.php and unset/reset the cookie with the new user. > > > Scratching my head. > > > > Chris > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] What's XML's Purpose??
XML, IMHO, can best be regarded as a layer between the real data and the application. We used to make up new formats for allmost every type of data exchange. Every type had its own format, its own parser, and because of that the same mistakes were made over and over again. Some formats weren't extensible. Parsers contain(ed) bugs. XML solves all this. If your data is suitable to be encapsulated in xml (meaning its not binary data and a little tag-overhead isn't a big deal) there is no need for these mistakes anymore. You can use a trusted, standard format, which is extensible and readable, and you can use standard tools to read and write the data. (no more, or at least less, bugs in parsers.) -S -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Which is better coding style...
Definitely the second style :) (If we were talking about C(++) then the first would have even been forbidden by my companies coding standard as well as several coding standards of other companies I worked for.) The reason is this - a function has one entrypoint (duh) and one exitpoint. Jumping out of a function somewhere in the middle leads to unmaintainable code, and bugs when extending that function and that return is overlooked. But, as with the indenting and bracket placing, it is a matter of religion. They would have to torture me for three weeks to get me to place the brackets like you did in your example :) function blah() { $retval = ""; switch( $bob ) { case 1: $retval = "this"; break; case 2: $retval = "that"; break; default: $retval = "other"; break; } return $retval; } > -Original Message- > From: ..s.c.o.t.t.. [gts] [mailto:[EMAIL PROTECTED]] > Sent: 19 April 2001 21:31 > To: Php-General > Subject: RE: [PHP] Which is better coding style... > > > i say the first style. > > unneeded variables and other thingies just > obscure things and make it harder to maintain. > > > > -Original Message- > > From: Boget, Chris [mailto:[EMAIL PROTECTED]] > > Subject: [PHP] Which is better coding style... > > > > Which is better? > > > > function blah() { > > switch( $bob ) { > > case 1: > >return "this"; > > > > case 2: > > return "that"; > > > > default: > > return "other"; > > > > } > > } > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] To contact the list > administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Make text a submit button?
bleh Or something very similar. See the form.submit() function in your favorite Javacsript manual. > -Original Message- > From: Brandon Orther [mailto:[EMAIL PROTECTED]] > Sent: 3 May 2001 18:09 > To: PHP User Group > Subject: [PHP] Make text a submit button? > > > Hello, > > I am currently using image buttons for my submit buttons on a > project I am working on. What I would like to use is regular > text like a hyperlink. Does anyone know of how I can use text > as the submit button? > > Thanks for any help > Brandon > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] To contact the list > administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] how to create html tables in php
Hello, I made a database with bookmarks, these bookmarks are catogarized by type. Now I want to display those bookmarks in tables by category. This works already fine. The only problem I have is that the tables are very difficult to handle. I want to make 4 tables in a row (so that will be 4 dif categories with bookmarks) and after that, the next table should start under the first one. Like this categorycategorycategorycategory xxx xxxxxx xxx xxx xxxxxx xxx xxx xxxxxx xxx categorycategorycategorycategory xxx xxxxxx xxx xxx xxxxxx xxx xxx xxxxxx xxx (x = a weblink ;-) The (dutch) website where you can find a full example for what I mean: http://www.startpagina.nl/ Can anyone help me with this please? Thanx! -- Met vriendelijke groet / With Greetings, Sander Peters site: http://www.visionnet.nl/ email: mailto:[EMAIL PROTECTED] webmail: mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] counting with dates (help!)
Hello, This is my problem: $today = date("Ymd", mktime(0,0,0, date(m),date(d),date(Y))); $last_week = date("Ymd", mktime(0,0,0, date(m),date(d)-7,date(Y))); echo ($today - $last_week); The result is a number like 8876 (20020107-20011231 = 8876) But in date thinking it should be 7! How can I let php count in real days/month/years in stead of numbers? Maybe this is a silly question, but anyone who has the answer would help me very much! Thanks in advance! -- Met vriendelijke groet / With Greetings, Sander Peters site: http://www.visionnet.nl/ email: mailto:[EMAIL PROTECTED] webmail: mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] convert yyyy/mm/dd to mm/dd/yyyy, how?
Hello everybody, convert /mm/dd to mm/dd/, how? MYSQL does everything in /mm/dd. I live in the Netherlands and we are use to the format dd/mm/. What's the best way to display it as mm/dd/ in a table on a query? My first idea whas to split the date up in vars in php and then print the vars in the way I like it Is this a bad idea? Or are there better sollutions? Thanx in advance for answering! -- Met vriendelijke groet / With Greetings, Sander Peters site: http://www.visionnet.nl/ email: mailto:[EMAIL PROTECTED] webmail: mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Recompile PHP not recognizing new Install
I'm trying to upgrade from php-4.0.6 to php-4.1.1 . Here are the steps I'm taking. 1. Download php-4.1.1.tar.gz to /www/root 2. gunzip php-4.1.1.tar.gz 3. tar xvf php-4.1.1tar 4. /www/bin/apachectl stop 5. cd php-4.1.1 6. rm config.cache 7. ./configure --with-mysql=/usr/local/mysql --with-apache=../apache_1.3.14 --enable-track-vars --disable-debug --enable-ftp 8. make clean 9. make install 10. cp php.ini-dist /usr/local/lib/php.ini 11. /www/bin/apachectl start (reboot machine also didn't seem to matter either way) The problem is that I check phpinfo() and it still shows that 4.0.6 is installed If anyone has any idea, it would be greatly appreciated. Thanks, Ryan Sander Web Developer [EMAIL PROTECTED] http://www.cantonrep.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] PHP Hosting Services
Here's a great place to look. http://hosts.php.net/ Ryan Sander Web Developer [EMAIL PROTECTED] http://www.cantonrep.com > -- > From: Boaz Yahav > Sent: Thursday, January 31, 2002 10:07 AM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: RE: [PHP] PHP Hosting Services > > Check out : > > http://www.weberdev.com/index.php3?GoTo=phenominet/prices.htm > > This is your one stop shop for hosting. WeberDev.com is hosted there > and I can tell you that their service is amazing. They are fast, > reliable > and more than anything, very professional (specially in PHP / MySQL). > > Sincerely > > berber > > Visit http://www.weberdev.com Today!!! > To see where PHP might take you tomorrow. > > > -Original Message- > From: Mike Baranski [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 31, 2002 4:36 PM > To: [EMAIL PROTECTED] > Subject: [PHP] PHP Hosting Services > > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hello, just wondering if anyone here could recommend a good (free, if > there > is a good one) PHP/mysql Hosting service. I'm willing to pay some, but > not > more than 15 /month > > Thanks > > GPG Key located on: > http://www.keyserver.net/en/ > -BEGIN PGP SIGNATURE- > Version: GnuPG v1.0.6 (GNU/Linux) > Comment: For info see http://www.gnupg.org > > iD8DBQE8WVZjn0XmoxBj3PwRAizbAJ0QZETkXf+i7xx1XPpUa/0P4xnwMwCfTLLN > xSXs4S0fHADWDAj+FSDR4mY= > =jSpN > -END PGP SIGNATURE- > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] One more try
The reason no one has helped you is probably due to the fact you are being very vague. How are they 'not working together'? Error messages, maybe the steps you used to install apache and php (probably where the problem will be found). Good Luck, Ryan Sander Web Developer [EMAIL PROTECTED] http://cantonrep.com > -- > From: Taylor Lewick > Sent: Thursday, May 30, 2002 2:47 PM > To: [EMAIL PROTECTED] > Subject: [PHP] One more try > > Okay, I dont know if anyone out there just doesnt know the answer to my > question or what... > > I tried to install PHP and apache. I have apache 2.0.36 installed > correctly and php-4.2.1 installed. The trouble is getting them to work > together... > I have read numerous web articles and manuals saying do this and do that, > but no one seems to have a comprehensive or accurate steps available.. > Could someone help me with this please... > > Thanks > > Taylor Lewick > Unix System Administrator > Fortis Benefits > 816 881 6073 > > "Help Wanted. Seeking Telepath..." > "You Know where to apply." > > > Please Note > The information in this E-mail message is legally privileged > and confidential information intended only for the use of the > individual(s) named above. If you, the reader of this message, > are not the intended recipient, you are hereby notified that > you should not further disseminate, distribute, or forward this > E-mail message. If you have received this E-mail in error, > please notify the sender. Thank you > * > > -- > 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] variable operators in queries
Hello, Is it possible to put variable operators in queries? I tried this (the real variable comes from a form) $Date_Operator =(">="); sql="SELECT * FROM poeple WHERE age $Date_operator 20"; $result_id = mysql_query($sql); It doesn't work like this. I also tried: sql="SELECT * FROM poeple WHERE age \"$Date_operator\" 20" $result_id = mysql_query($sql); it didn't work either. Or should I use a have to make a IF-Then construction? If $Date_Operator == (">=") then { sql="SELECT * FROM poeple WHERE age >= 20" } etc... Can anybody help me with this? Thanks in advance! -- Met vriendelijke groet / With Greetings, Sander Peters site: http://www.visionnet.nl/ email: mailto:[EMAIL PROTECTED] webmail: mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP passthru() blocks with bash process replacement?
Hi all, I have a problem with PHP passthru() blocking when it is supposed to start a daemon and return. I have a Node.js daemon with a bash script wrapper around it. Users can call this bash script directly, but it is also used by our deployment system. Our deployment system uses Phing, and Phing uses `exec()` and `passthru()` internally to cann external programs. The bash script wrapper around my Node.js uses a bit of process replacement because my Node.js server can't directly log to syslog. Normally I'd start Node.js like this: forever -l app.log app.js But because I want it to log to syslog, I put this in the bash script: forever -l >(logger) app.js The `logger` process replacement creates a file descriptor into syslog like /dev/fd/63 whose path is passed to the forever command as the logfile to use. This works great when I start the daemon using the bash script directly, but when the bash script is executed using PHP passthru() or exec() then these calls will block. If I use a regular logfile instead of the process replacement then both passthru() and exec() work just fine, starting the daemon in the background. I have created a complete working example (using a simple PHP daemon instead of Node.js) on Github's Gist: https://gist.github.com/1977896 (needs PHP 5.3.6+) Why does the passthru() call block on the process replacement? And is there anything I can do to work around it? Kind regards, -- Sander Marechal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] HTTP compression
Check the http 1.1 rfc - http://www.faqs.org/rfcs/rfc2616.html It links to the gzip file format rfc - http://www.faqs.org/rfcs/rfc1952.html > -Original Message- > From: Carsten Gehling [mailto:[EMAIL PROTECTED]] > Sent: 4 February 2001 19:19 > To: [EMAIL PROTECTED] > Subject: Re: [PHP] HTTP compression > > > From: "Teodor Cimpoesu" <[EMAIL PROTECTED]> > Sent: Sunday, February 04, 2001 7:08 PM > > > a HTTP response is made of response header(s) and the response body. > > Only the body > > is compressed, and this is signaled in the headers so the User Agent > > will know > > not to stare to a bunch of binary data :) > > Where can I get the specs on the compression algorithm? Is it > specified in a > RFC? > > - Carsten > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] HTTP compression
> Sean, > > Thanks, I see. How about headers ? Do they need to be compressed, too; in > other words, do headers "belong" to the output ? How about RTFR? :) (Read the .. RFC.) Really, when you've read http://www.faqs.org/rfcs/rfc2616.html you'll be able to understand a lot more about how http requests and responses work, and how stuff like compression fits into the picture, etc, etc. Basically a must-read for anyone serious about working with the web on a technical level. (That'd be you, php'ers :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Apache 2.0.52, PHP 5.03, FreeBSD 4.10 memory problems
I'm running Apache 2.0.52 and PHP 5.03 in a jailed (Virtual Private Server) FreeBSD 4.10 envirorement. PHP 5.03 is running as php_mod and was installed quite recently. Since then (better, since someone started using it) I've been getting these errors in the httpd-error log: Allowed memory size of 8388608 bytes exhausted (tried to allocate 79 bytes) And this one in the php-error log: [06-Feb-2005 17:25:50] PHP Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 6587593 bytes) in xxx/xxx/xxx/xxx/xxx/xxx.php on line 53 I also see several thousands of notices in the PHP-error log within the time-frame of a single second, plus diveded by zero, etc. Of course, I asked the programmer to fix all of these issues.Among others, there was a script that outputted a html-form with 2 columns, 100 rows each containing select-boxes with 100 full names (and those 100 names were the same of every column/row in that form :-|). But the problem is not so much that someone is using broken and the most inefficient scripts, but more that they are crashing the entire box! When these scripts are run, the box becomes totally unresponsive, afterwards all cgi and php request to Apache fail with a 500 error and sometimes the whole box crashes completely, apparently from memory exhaustion. :-( It this a bug somewhere in PHP, Apache or FreeBSD? How can I protect myself against this? I can't manually check every script, and the memory and time limits in php.ini (20s for exe, 30s for input and 8MB for mem) don't seem effective here. What are my options to make Apache 2 and PHP 5 full proof against such scripts? Kind Regards, Sander Holthaus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Apache 2.0.52, PHP 5.03, FreeBSD 4.10 memory problems
> Sander Holthaus - Orange XL wrote: > > I'm running Apache 2.0.52 and PHP 5.03 in a jailed (Virtual Private > > Server) > > FreeBSD 4.10 envirorement. PHP 5.03 is running as php_mod and was > > installed quite recently. Since then (better, since someone started > > using it) I've been getting these errors in the httpd-error log: > > > > Allowed memory size of 8388608 bytes exhausted (tried to allocate 79 > > bytes) > > > > And this one in the php-error log: > > > > [06-Feb-2005 17:25:50] PHP Fatal error: Allowed memory size of > > 8388608 bytes exhausted (tried to allocate 6587593 bytes) in > > xxx/xxx/xxx/xxx/xxx/xxx.php on line 53 > > Fix or disable that script. I wish I could, but I'm not a PHP-programmer (can read it and can do some basic programming, but I lack in-depth knowledge of PHP). > > I also see several thousands of notices in the PHP-error log within > > the time-frame of a single second, plus diveded by zero, etc. > > Are they coming from the same script?... Those notices, yes. > Again, fix or disable that script. > > > Of course, I asked the programmer to fix all of these issues.Among > > others, there was a script that outputted a html-form with > 2 columns, > > 100 rows each containing select-boxes with 100 full names > (and those > > 100 names were the same of every column/row in that form :-|). > > You're simply going to have to work with that programmer to > get them to write better code, or not work with them > (terminate their account). As it is a personal friend, it is an difficult situation. Getting him to write better code isn't easy, he's mainly interested in functionality and getting program done ASAP. > > But the problem is not so much that someone is using broken and the > > most inefficient scripts, but more that they are crashing > the entire box! > > That's definitely not good. Nope, and I can't figure out why. I've set the memory limits in php.ini plus some additional things in httpd.conf (RLimitMEM, etc), but for some reason, memory keeps getting consumed. What I find really troublesome is that it effects both php (running as mod_php) and cgi. After some time, cgi-scripts start failing too with: Out of memory during "large" request for 134221824 bytes, total sbrk() is 134369280 bytes., referer: ... Which makes no sense to me at all. > But there is only so much you, and PHP, can do to stop a bad > programmer from chewing up resources. > > > When these scripts are run, the box becomes totally unresponsive, > > afterwards all cgi and php request to Apache fail with a > 500 error and > > sometimes the whole box crashes completely, apparently from memory > > exhaustion. :-( > > > > It this a bug somewhere in PHP, Apache or FreeBSD? > > No. It's a bug in the script/program that causes the crash. > > > How can I protect myself against this? I can't manually check every > > script, > > You can identify the culprit script, and disable it, and > notify the client that they are violating their terms of > service to run it again on a production server until it is debugged. > > Get them to install PHP on their own machine and develop on that. They did actually, though it was a Windows box, with prety much the standard configuration. > > and the memory and time limits in php.ini (20s for exe, 30s > for input > > and 8MB for mem) don't seem effective here. What are my options to > > make Apache > > 2 > > and PHP 5 full proof against such scripts? > > NOTHING is foolproof. Ever. > > You can change those numbers and be more harsh, but that will > affect ALL users, not just the one who's bringing your box down. > > You would be far better off, for all your clients, to deal > directly with the client who's causing the problems. > > Perhaps get them in touch with a good progammer, or up-sell > them your services in fixing their scripts or... :-( The downside would be, IMHO, that I would need to pro-actively check everything that is going on concerning PHP, in order to prevent any major problems. (one and a halve month ago, some clients on an other installation who hadn't mainted phpBB also caused me the necessary problems). Also, when clients are non-commercial, a good programmer is out of the question (which applies to this case too). I wonder how mass hosting companies get arround these issue's? Thanks for the input! Kind Regards, Sander Holthaus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Apache 2.0.52, PHP 5.03, FreeBSD 4.10 memory problems
> > :-( The downside would be, IMHO, that I would need to pro-actively > > check everything that is going on concerning PHP, in order > to prevent > > any major problems. (one and a halve month ago, some clients on an > > other installation who hadn't mainted phpBB also caused me the > > necessary problems). Also, when clients are non-commercial, a good > > programmer is out of the question (which applies to this > case too). I > > wonder how mass hosting companies get arround these issue's? > > To add to this -- I suspect some good hosts actively check > the directories of their clients, and search for known > security flawed software, such as specific versions of phpBB > and formmail.pl and so on. I could write a PERL-script for that :-) For wide-used scripts (such as PHPBB) automation would be a doable and good sollution, but for custom scripts, it will be quite a challenge. > When you find a client running known security flawed > software, you deal with them, quickly and politely, but with > clear cut no nonsense > requirements: > > Upgrade it now or lose the account. That would be the right thing indeed. Though I do find that many times, people either have severe technical difficulty upgrading (usually installing was already quite a tough cookie for them, being used to the more point and click of Windows). Or perhaps just to the fear of it. It always comes down to a lack of knowledge and understanding from the user. Educating users in this regard is not easy. > Non-profits can always find a free programmer or a donor to > hire the programmer or... > > There are even organizations that exist solely to provide > services like this to non-profits. One small one I know of > run by guys in Chicago is > here: > http://npotechs.org/ > > I'm sure that there are others. Thanks! That looks like a very nice addition to my to-do and to-look-at bookmark list :-) Kind Regards, Sander Holthaus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Apache 2.0.52, PHP 5.03, FreeBSD 4.10 memory problems
> Sander Holthaus - Orange XL wrote: > >>Sander Holthaus - Orange XL wrote: > >> > ... > >> > >>Fix or disable that script. > > > > > > I wish I could, but I'm not a PHP-programmer (can read it > and can do > > some basic programming, but I lack in-depth knowledge of PHP). > > > > well disabling it is fairly easy ;-) rm -f ./xxx.php chown && chmod would be less invasive :-) > a script that functions is a one that doesn't crash the box. > quick'n'dirty or inefficient scripts don't have to cause > problems per se, > his script is just plain borked. if you need to ensure the box is > running then you _can't_ let him run it till its fixed, friend or not. > besides if it is a friend then presumably you are offering > space/resources > for free - under such circumstances your interest in keeping > the machine up > precludes his interest in functionality and ASAP programming - and > would be understanding of your interests (just as you seem to > be of his ;-). no? Indeed. > > :-( The downside would be, IMHO, that I would need to > pro-actively check > > everything that is going on concerning PHP, in order to > prevent any major > > problems. (one and a halve month ago, some clients on an > other installation > > who hadn't mainted phpBB also caused me the necessary > problems). Also, when > > clients are non-commercial, a good programmer is out of the > question (which > > applies to this case too). I wonder how mass hosting > companies get arround > > these issue's? > > by not garanteeing full uptime ;-) and having lots of machine > across which to > spread the risk etc. That makes sense :-/ Must be quite frustrating from times to times being a sysadmin at such a company. Kind Regards, Sander Holthaus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php