php-general Digest 26 Jul 2005 07:40:23 -0000 Issue 3588
php-general Digest 26 Jul 2005 07:40:23 - Issue 3588 Topics (messages 219301 through 219323): A directory permissions question 219301 by: Al Re: A strategy question about using mySQL for saving flat-file stings? 219302 by: James Wierd time shifting problem?!? 219303 by: Gord Busse Prepopulating form fields afer an error 219304 by: Jack Jackson 219307 by: Matt Darby 219311 by: Mark Cain 219316 by: Jack Jackson how to install phpize and php-config? 219305 by: Victor Alvarez How would you create a tracking pixel? 219306 by: Brian Dunning 219308 by: Philip Hallstrom 219309 by: Matt Darby 219310 by: Brian Dunning 219312 by: Brian Dunning Full time PHP/MySQL position available 219313 by: Greg Donald Re: running number 219314 by: Robert Sossomon 219320 by: Roger Thomas Delivery reports about your e-mail 219315 by: cf-newbie.houseoffusion.com Re: Problem with Form not putting Data in Post Request 219317 by: maddog1169 219319 by: Rasmus Lerdorf performance. 219318 by: Rodolfo Gonzalez Gonzalez Searching and Count within array 219321 by: Bagus Nugroho 219322 by: Rasmus Lerdorf Class for creating RSS 2 feed? 219323 by: Murray . PlanetThoughtful Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-general@lists.php.net -- ---BeginMessage--- I'm on virtual-host server and have been following a rule of making certain all directories on the root have permissions set to 755. This is the default when creating new directories with ftp, etc. Occasionally, I need directories with 757 and have always made certain they were not on the root. I've started thinking about whether my rule really makes any sense for security reasons. In general, the site is well protected by the host's security measures and my use of the Apache basic authorization where needed, etc. Comments and suggestions??? Thanks. ---End Message--- ---BeginMessage--- I don't know if this is of any help, but you can make a mysql field Unique without it being an index/primary key. - Original Message - From: Al [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Monday, July 25, 2005 9:40 AM Subject: [PHP] A strategy question about using mySQL for saving flat-file stings? I've been creating a number of CM applications for a virtual-host website. One feature, of several applications, allows the editor [one of our people] to create simple text files. I've been using simple flat-files in a directory for saving the files. I've gotten tried of dealing with directory permission problems, etc., and am considering using a simple mySQL DB for storing the file strings. Obviously, for each file-string to be unique, its path must be included as part of the ID. Here is my question. I can use one table for all the path/files and use the following as the primary key /home/some-dir/filename. fields: fullpath-filename | path | type | date | binary-string path is so the code can do an equivalent of scandir() type signifies whether data has been serialized() or not. This is so I can save arrays date is the equivalent of file last mod date. Or, I can create a separate table for each full-path used and then just use the filename for the primary key. In this case, since the table name is in effect the path, only the filename is needed. The first approach is obviously simplest; but, I'm concerned about getting myself into a trap later on. Anyone offer any suggestions? Many thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- ---BeginMessage--- Greetings, I have an application I built that allows the user to schedule mailings to subscribed users for specific times and dates. Everything was working fine as far as I could tell then all of a sudden this time shifting problem started popping up and seems to be getting worse. The application makes extensive use of the date() and time() command for generating and displaying dates and times. It appears that the times are shifting 7 hours into the future. If I shutdown Apache then start it back up next time I log into the application all of the times are now displayed correctly. Below is my server configuration: - Windows Advanced Server 2000 with all updates applied - Apache 2.0.47 non SSL - PHP 4.3.3 using Apache2 module - MySQL 4.0.14-max - phpMyAdmin 2.5.2-pl1 The application itself also makes heavy use of: - Adodb 4.52 - Smarty 2.6.5 I am hoping someone can at least point me in the right direction here as this
[PHP] Class for creating RSS 2 feed?
Hi All, Just curious if anyone knows of an existing class that will take MySQL records containing HTML and create a valid RSS 2.0 newsfeed from them? Much warmth, Murray --- http://www.planetthoughtful.org Building a thoughtful planet, one quirky comment at a time. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Urgent:Php5 fully oops supported? Difference between java oops php5 oops
Hi, I want to know whether Php5 fully oops ? Difference between java oops php5 oops. I need immediately. Thanks, tamilarasi
Re: [PHP] Urgent:Php5 fully oops supported? Difference between java oops php5 oops
Tamilarasi Palanisamy (tpalanis) wrote: Hi, Hi I want to know whether Php5 fully oops ? That depends - what do you want to do? Difference between java oops php5 oops. I don't know - I'm a PHP programmer and I've never written a single line of Java code in my life. I need immediately. Perhaps this will help you get better answers:- http://www.catb.org/~esr/faqs/smart-questions.html Regards Alan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [PHP4]: Problem with Form not putting Data in Post Request
Rasmus Lerdorf wrote: maddog1169 wrote: The one that does not get accepted is Group including the You have something like this? input type=text name=Group / It should work. Make sure you have quotes around it, of course, or weird stuff will happen. IIRC technically the and should be HTML entity encoded. depending on browser/server/doctype combination that also may be giving the OP a problem? e.g. input type=text name=lt;Groupgt; / ... looking into this a little further I discover the following information at w3c: (here: http://www.w3.org/TR/html4/types.html#type-name) ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens (-), underscores (_), colons (:), and periods (.). which suggests that even though a and/or in a name attribute value can/does work it might not be a good idea to use it. Try something like this: form action=f.php method=POST input type=text name=Group / /form ?php phpinfo() ? Type something in the form field and hit return and then scroll down and look at the $_REQUEST and $_POST variables. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Searching and Count within array
Rasmus Lerdorf wrote: array_count_values() Bagus Nugroho wrote: Hi Master, not sure what Bagus was intending with 'Master', regardless, the reply made me smile... :-) I have an array as : $myArray = array('four','four','four','four','one,,'three','three','three','two','two'); bla / -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Class for creating RSS 2 feed?
Quoting Murray @ PlanetThoughtful [EMAIL PROTECTED]: Just curious if anyone knows of an existing class that will take MySQL records containing HTML and create a valid RSS 2.0 newsfeed from them? http://software.zuavra.net/rowd_feed/ -- Romanian Web Developers - http://ROWD.ORG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Urgent:Php5 fully oops supported? Difference between java oops php5 oops
Alan Milnes wrote: Tamilarasi Palanisamy (tpalanis) wrote: warning to=Tamilarasi voice-style=Alec Guiness these are not the answers you're looking for. move along. /warning Hi, Hi I want to know whether Php5 fully oops ? sometimes (actually quite often :-) I write some code and it does something I don't want to happen - then I say 'oops'. in that sense php5 is fully 'oops' compatible. That depends - what do you want to do? Difference between java oops php5 oops. I believe in Java you have to write everything 3 times. ;-) also you have a server/application scope which does not exist in php's share-nothing architecture (well there are ways round that too). I don't know - I'm a PHP programmer and I've never written a single line of Java code in my life. I need immediately. immiediately is not a thing you can need ... not according to my limited understanding of the english language. OT actually I read a book last night called 'Anastasia', which tells of the the latent human ability to instantaneously garner any information you want by way of dreaming (given certain prerequisites). the book also says all our technology is primitive, destroying the planet and making us miserable ... you be the judge! Shakespeare wrote 'there are more things in heaven and earth than are dreamt of in your philosophy, Horatio' - something that has always stuck in my head for some reason... oh well back to php :-) /OT Perhaps this will help you get better answers:- http://www.catb.org/~esr/faqs/smart-questions.html Regards Alan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MySQL + PHP question
Hi guys. I'm having some trouble here regarding a project. I have a table with projects, wich can be recursive (ie. sub-projects) and it is related to itself. By making the following query -8-- SELECT * FROM projects LEFT JOIN projects proj_parent ON projects.project_parent = proj_parent.parent_id WHERE project_id = 1234 -8-- i need to be able to access to the parent project's fields, but I have a slight problem here. First off, I have to make the LEFT JOIN. I don't know if the project can be parent (therefore not finding a project_id = 0 wouldn't show the row) and I need to add some kind of prefix to the proj_parent's fields so that I can access them (or that they can't overwrite the project i'm getting info on. Well... there is an obvious sollution here: use an associative array instead of an object, and access the properties by doing $array[0], $array[1], etc. By my experience, this is a nightmare, maintenence-wise, so I'd only use it as a _LAST_ resource. Does anyone have any experience with this? The answer should be pretty obvious, but I can't seem to figure it out :( Thanks in advance. André -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Urgent:Php5 fully oops supported? Difference between java oops php5 oops
I want to know whether Php5 fully oops ? Difference between java oops php5 oops. I need immediately. I guess you would get as many different answers as there are compute language theoreticians, but I would say that php5 is one fine oop language, in my taste even more fun than java since it is dynamically typed like Smalltalk, while java is statically typed. rush -- http://www.templatetamer.com/ http://www.folderscavenger.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Urgent:Php5 fully oops supported? Difference between java oops php5 oops
Tamilarasi Palanisamy (tpalanis) [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I want to know whether Php5 fully oops ? Difference between java oops php5 oops. I need immediately. I guess you will het as many answers as there are computer language theoreticians ;) . But form me php 5 is one fine oop language, and personaly more fun than java since it is dynamically typed like some root oop languagas like Smalltalk, while java is of statically typed kind of bore. rush -- http://www.templatetamer.com/ http://www.folderscavenger.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MySQL + PHP question
Hello, Consider this: tbl_project(id, name, parent) 1 6 / \ / \ 2 3 7 8 /\ 4 5 if tbl_project.parent = 0 then the project is the top parent. Therefore, 1 and 6 have the field parent = 0. So, say if you have project 5, do you want to find out its parent (2), or do you want to find out all its parents including grandparents (2) and (1)? What do you need to know? C. -Original Message- From: André Medeiros [mailto:[EMAIL PROTECTED] Sent: 26 July 2005 12:18 To: php-general@lists.php.net Subject: [PHP] MySQL + PHP question * This e-mail has been received by the Revenue Internet e-mail service. * Hi guys. I'm having some trouble here regarding a project. I have a table with projects, wich can be recursive (ie. sub-projects) and it is related to itself. By making the following query -8-- SELECT * FROM projects LEFT JOIN projects proj_parent ON projects.project_parent = proj_parent.parent_id WHERE project_id = 1234 -8-- i need to be able to access to the parent project's fields, but I have a slight problem here. First off, I have to make the LEFT JOIN. I don't know if the project can be parent (therefore not finding a project_id = 0 wouldn't show the row) and I need to add some kind of prefix to the proj_parent's fields so that I can access them (or that they can't overwrite the project i'm getting info on. Well... there is an obvious sollution here: use an associative array instead of an object, and access the properties by doing $array[0], $array[1], etc. By my experience, this is a nightmare, maintenence-wise, so I'd only use it as a _LAST_ resource. Does anyone have any experience with this? The answer should be pretty obvious, but I can't seem to figure it out :( Thanks in advance. André -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This message has been delivered to the Internet by the Revenue Internet e-mail service * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MySQL + PHP question
On Tue, 2005-07-26 at 11:45 +0100, Shaw, Chris - Accenture wrote: Hello, Consider this: tbl_project(id, name, parent) 1 6 / \ / \ 2 3 7 8 /\ 4 5 if tbl_project.parent = 0 then the project is the top parent. Therefore, 1 and 6 have the field parent = 0. So, say if you have project 5, do you want to find out its parent (2), or do you want to find out all its parents including grandparents (2) and (1)? I just need to find it's parent. This is part of a permission system i'm building, and I need to somewhat register the objects in the permission system so I can manage things easilly from there. So to sum it up, this is my attempt to save queries :) What do you need to know? Projects can only be parent or children. No more recursiveness than that (it's possible, but we've implemented business rules that prevent it.) What I'm trying to do is to add some sort of prefix to the fields returned by the proj_parent table (wich is the projects table the same, but with different info, and will overwrite the object's properties). If not... heck, I'll have to make another query or use the associative array sollution (wich neither will make me very happy, but that's life). Thanks for your prompt reply :) C. -Original Message- From: André Medeiros [mailto:[EMAIL PROTECTED] Sent: 26 July 2005 12:18 To: php-general@lists.php.net Subject: [PHP] MySQL + PHP question * This e-mail has been received by the Revenue Internet e-mail service. * Hi guys. I'm having some trouble here regarding a project. I have a table with projects, wich can be recursive (ie. sub-projects) and it is related to itself. By making the following query -8-- SELECT * FROM projects LEFT JOIN projects proj_parent ON projects.project_parent = proj_parent.parent_id WHERE project_id = 1234 -8-- i need to be able to access to the parent project's fields, but I have a slight problem here. First off, I have to make the LEFT JOIN. I don't know if the project can be parent (therefore not finding a project_id = 0 wouldn't show the row) and I need to add some kind of prefix to the proj_parent's fields so that I can access them (or that they can't overwrite the project i'm getting info on. Well... there is an obvious sollution here: use an associative array instead of an object, and access the properties by doing $array[0], $array[1], etc. By my experience, this is a nightmare, maintenence-wise, so I'd only use it as a _LAST_ resource. Does anyone have any experience with this? The answer should be pretty obvious, but I can't seem to figure it out :( Thanks in advance. André -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This message has been delivered to the Internet by the Revenue Internet e-mail service * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL + PHP question
Are you familiar with Joe Celko's tree theory? It might help you understand more about the problem. http://www.intelligententerprise.com/001020/celko.jhtml?_requestid=235427 -- Hello, Consider this: tbl_project(id, name, parent) 1 6 / \ / \ 2 3 7 8 /\ 4 5 if tbl_project.parent = 0 then the project is the top parent. Therefore, 1 and 6 have the field parent = 0. So, say if you have project 5, do you want to find out its parent (2), or do you want to find out all its parents including grandparents (2) and (1)? What do you need to know? C. -Original Message- From: André Medeiros [mailto:[EMAIL PROTECTED] Sent: 26 July 2005 12:18 To: php-general@lists.php.net Subject: [PHP] MySQL + PHP question Hi guys. I'm having some trouble here regarding a project. I have a table with projects, wich can be recursive (ie. sub-projects) and it is related to itself. By making the following query -8-- SELECT * FROM projects LEFT JOIN projects proj_parent ON projects.project_parent = proj_parent.parent_id WHERE project_id = 1234 -8-- i need to be able to access to the parent project's fields, but I have a slight problem here. First off, I have to make the LEFT JOIN. I don't know if the project can be parent (therefore not finding a project_id = 0 wouldn't show the row) and I need to add some kind of prefix to the proj_parent's fields so that I can access them (or that they can't overwrite the project i'm getting info on. Well... there is an obvious sollution here: use an associative array instead of an object, and access the properties by doing $array[0], $array[1], etc. By my experience, this is a nightmare, maintenence-wise, so I'd only use it as a _LAST_ resource. Does anyone have any experience with this? The answer should be pretty obvious, but I can't seem to figure it out :( Thanks in advance. André -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: gloabl reference behavior question?
On 22 July 2005 19:47, Surendra Singhi wrote: I don't think it will make the code confusing, but the person looking at the code should understand how reference and global variables work. Using reference variables avoids unnecessary extra copying of objects, and while using large arrays it can make a big difference in speed. You shouldn't need to worry about this -- PHP tries to take care of it for you. When you copy an array value, PHP only does a shallow copy (of the array's address); if you later modify the array, this triggers a full deep copy of all the array's element values before the modification is done. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MySQL + PHP question
Hello, Well its simply this: select b.id from tbl_project a, tbl_project b where b.id = a.parent and a.id = 5 This will return the id of project 5 parent, in this case it is 2. If the query doesn't return any rows then you know the project doesn't have a parent. I cannot test it on MySQL, but this query should work on MSSQL and Oracle. HTH. C. -Original Message- From: André Medeiros [mailto:[EMAIL PROTECTED] Sent: 26 July 2005 12:53 To: Shaw, Chris - Accenture Cc: php-general@lists.php.net Subject: RE: [PHP] MySQL + PHP question * This e-mail has been received by the Revenue Internet e-mail service. * On Tue, 2005-07-26 at 11:45 +0100, Shaw, Chris - Accenture wrote: Hello, Consider this: tbl_project(id, name, parent) 1 6 / \ / \ 2 3 7 8 /\ 4 5 if tbl_project.parent = 0 then the project is the top parent. Therefore, 1 and 6 have the field parent = 0. So, say if you have project 5, do you want to find out its parent (2), or do you want to find out all its parents including grandparents (2) and (1)? I just need to find it's parent. This is part of a permission system i'm building, and I need to somewhat register the objects in the permission system so I can manage things easilly from there. So to sum it up, this is my attempt to save queries :) What do you need to know? Projects can only be parent or children. No more recursiveness than that (it's possible, but we've implemented business rules that prevent it.) What I'm trying to do is to add some sort of prefix to the fields returned by the proj_parent table (wich is the projects table the same, but with different info, and will overwrite the object's properties). If not... heck, I'll have to make another query or use the associative array sollution (wich neither will make me very happy, but that's life). Thanks for your prompt reply :) C. -Original Message- From: André Medeiros [mailto:[EMAIL PROTECTED] Sent: 26 July 2005 12:18 To: php-general@lists.php.net Subject: [PHP] MySQL + PHP question * This e-mail has been received by the Revenue Internet e-mail service. * Hi guys. I'm having some trouble here regarding a project. I have a table with projects, wich can be recursive (ie. sub-projects) and it is related to itself. By making the following query -8-- SELECT * FROM projects LEFT JOIN projects proj_parent ON projects.project_parent = proj_parent.parent_id WHERE project_id = 1234 -8-- i need to be able to access to the parent project's fields, but I have a slight problem here. First off, I have to make the LEFT JOIN. I don't know if the project can be parent (therefore not finding a project_id = 0 wouldn't show the row) and I need to add some kind of prefix to the proj_parent's fields so that I can access them (or that they can't overwrite the project i'm getting info on. Well... there is an obvious sollution here: use an associative array instead of an object, and access the properties by doing $array[0], $array[1], etc. By my experience, this is a nightmare, maintenence-wise, so I'd only use it as a _LAST_ resource. Does anyone have any experience with this? The answer should be pretty obvious, but I can't seem to figure it out :( Thanks in advance. André -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This message has been delivered to the Internet by the Revenue Internet e-mail service * This message has been delivered to the Internet by the Revenue Internet e-mail service * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL + PHP question
One thing I didn't quite explain myself well... I'm building this to register objects on a permission system. The SQL weight is heavy as it is, and I want to save queries as much as possible. Making two queries to extract information about a project and it's parent is not something I'd want to do. I know recursiveness, but thanks for the pointers and for the reply :) Best regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help with a home-grown function
On 21 July 2005 22:19, Chris W. Parker wrote: 2. It will be a good idea to get out of the habit of breaking in and out of PHP like that. Instead just do: echo 'hi1'; Why? Some of us just strongly prefer the breaking in and out style -- I use it almost exclusively. In my 10,000s of lines of code, you can probably count the number of echos on your fingers! You'll have problems down the road with modifying the headers (cookies, redirects, content-type, etc.) if you break in and out. Absolute rubbish -- whatever gives you this idea? The sequence ?x?php Is functionally identical to echo 'x'; so anything that works with the latter will work identically with the former. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MySQL + PHP question
You're missing the point here. I know how to get the parent project's info. I know recursiveness. I _JUST_ don't know how to get the current and parent project's info in just ONE QUERY (since I'm trying to save them because the sql weight is getting pretty heavy). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help needed in changing row color
Hi I am retrieving data from postgresql and displaying it in form of table in different rows. my problem is when check box is clicked i need to change the color of the row .agai when the check box is unclicked it should hold the old color. Can any one please help me Thanks regards Suma _ Formula One fan? http://server1.msn.co.in/sp05/tataracing/ Get news, wallpapers and photos of Narain Karthikeyan. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with a home-grown function
* Ford, Mike [EMAIL PROTECTED] : On 21 July 2005 22:19, Chris W. Parker wrote: 2. It will be a good idea to get out of the habit of breaking in and out of PHP like that. Instead just do: echo 'hi1'; Why? Some of us just strongly prefer the breaking in and out style -- I use it almost exclusively. In my 10,000s of lines of code, you can probably count the number of echos on your fingers! You'll have problems down the road with modifying the headers (cookies, redirects, content-type, etc.) if you break in and out. Absolute rubbish -- whatever gives you this idea? The sequence ? x?php Is functionally identical to echo 'x'; so anything that works with the latter will work identically with the former. I disagree with both statements. Echoing and breaking out of PHP are typically both undesirable in large applications where you may wish to change headers. Capture your output into a variable and send it to output once all processing is done. This may be done using output buffering or other techniques. -- Matthew Weier O'Phinney Zend Certified Engineer http://weierophinney.net/matthew/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: performance.
* Rodolfo Gonzalez Gonzalez [EMAIL PROTECTED]: this could be a silly question. Is there some performance penalty when using the operator like this: $var =EOP add a bunch of text here and here EOP; Just curious. Try doing some benchmarks using microtime(). My gut reaction is that there shouldn't be any difference; heredoc syntax is simply another form of quoting strings. The other factor to consider is if a few microseconds more of processing time is worth the extra programming time it takes to get quotes right (assuming heredoc syntax *does* take longer). I personally prefer heredocs when using long, multiline strings to using double quotes -- they're easier to maintain. -- Matthew Weier O'Phinney Zend Certified Engineer http://weierophinney.net/matthew/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] quick question about using capital letters coding w/ PHP
On 7/25/05, Jochem Maas [EMAIL PROTECTED] wrote: ...somebody beat me with a virtual stick if I am wrong! Why? I'd rather just throw the php.net/manual at you! Dotan http://lyricslist.com/lyrics/artist_albums/23/aguilera_christina.php Aguilera, Christina Song Lyrics -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help needed in changing row color
On 7/26/05, suma parakala [EMAIL PROTECTED] wrote: Hi I am retrieving data from postgresql and displaying it in form of table in different rows. my problem is when check box is clicked i need to change the color of the row .agai when the check box is unclicked it should hold the old color. Can any one please help me Thanks regards Suma That is a javascript challenge, not php. http://www.google.fi/search?hl=fiq=javascriptbtnG=Google-hakumeta= Dotan http://lyricslist.com/lyrics/artist_albums/260/houston_whitney.php Houston, Whitney Song Lyrics -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help needed in changing row color
suma parakala wrote: Hi I am retrieving data from postgresql and displaying it in form of table in different rows. my problem is when check box is clicked i need to change the color of the row .agai when the check box is unclicked it should hold the old color. Can any one please help me This is a javascript question, not a PHP one. You will need to google for a javascript snippet that changes the background of table cells. Google 'javascript table dom' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] corrected
Please confirm the document. +++ Attachment: No Virus found +++ Panda AntiVirus - www.pandasoftware.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL + PHP question
André Medeiros [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] One thing I didn't quite explain myself well... I'm building this to register objects on a permission system. The SQL weight is heavy as it is, and I want to save queries as much as possible. Making two queries to extract information about a project and it's parent is not something I'd want to do. I know recursiveness, but thanks for the pointers and for the reply :) Best regards I must admit I still don't really get what you are looking for. Does this query help? select c.field1 AS childfield1, c.field2 AS childfield2, (etc) p.field1 AS parentfield1, p.field2 AS parentfield2, (etc) FROM child AS c LEFT JOIN parent AS p ON c.parent=p.id ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Playing Audio
This seems really silly, but I can't find a way of doing it! How can I play/stream an audio file, that may be upto an hour long and keep it playing while visitors view other pages? Is it possible to use sessions so that the file will continue playing when they hit the next page. (It wouldn't really matter if there was a small pause while they changed) (I don't really want to play it from a popup window.) Any help would be greatly appreciated. Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Playing Audio
On Tue, 2005-07-26 at 13:47 +0100, Tom Chubb wrote: This seems really silly, but I can't find a way of doing it! How can I play/stream an audio file, that may be upto an hour long and keep it playing while visitors view other pages? Is it possible to use sessions so that the file will continue playing when they hit the next page. (It wouldn't really matter if there was a small pause while they changed) (I don't really want to play it from a popup window.) Any help would be greatly appreciated. Tom Using frames? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL + PHP question
On Tue, 2005-07-26 at 13:39 +0100, Mark Rees wrote: André Medeiros [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] One thing I didn't quite explain myself well... I'm building this to register objects on a permission system. The SQL weight is heavy as it is, and I want to save queries as much as possible. Making two queries to extract information about a project and it's parent is not something I'd want to do. I know recursiveness, but thanks for the pointers and for the reply :) Best regards I must admit I still don't really get what you are looking for. Does this query help? select c.field1 AS childfield1, c.field2 AS childfield2, (etc) p.field1 AS parentfield1, p.field2 AS parentfield2, (etc) FROM child AS c LEFT JOIN parent AS p ON c.parent=p.id ? Yeah, that might do, thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MySQL + PHP question
Yeah I understand what he wants, but the problem boils down to the project with no parent. The only thing I can suggest is if you have a dummy row in, so the top parent row, (1) or (6) in my example with have the dummy as its parent. Then using: select b.id parentID, b.name parentName, a.id childID, b.name childName from tbl_project a, tbl_project b where b.id = a.parent and a.id = 1 Should give a row of: ParentID: 0 ParentName: Dummy ChildID: 1 ChildName: Project One So, if a Project has a parent that the name is called Dummy, then you know it doesn't have a parent. HTH. C. -Original Message- From: Mark Rees [mailto:[EMAIL PROTECTED] Sent: 26 July 2005 13:39 To: php-general@lists.php.net Subject: Re: [PHP] MySQL + PHP question * This e-mail has been received by the Revenue Internet e-mail service. * André Medeiros [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] One thing I didn't quite explain myself well... I'm building this to register objects on a permission system. The SQL weight is heavy as it is, and I want to save queries as much as possible. Making two queries to extract information about a project and it's parent is not something I'd want to do. I know recursiveness, but thanks for the pointers and for the reply :) Best regards I must admit I still don't really get what you are looking for. Does this query help? select c.field1 AS childfield1, c.field2 AS childfield2, (etc) p.field1 AS parentfield1, p.field2 AS parentfield2, (etc) FROM child AS c LEFT JOIN parent AS p ON c.parent=p.id ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This message has been delivered to the Internet by the Revenue Internet e-mail service * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] stipping raw text from rss story
I want to write a j2me midlet that displays a story headline and description. This is working great. However I want to write a php script that I can hit the url/page of the full story with then pull all of the stories text and remove all html/script/menu/imagee etc. So the phone can display it. How can I effectively get (mostly) just the text? Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] cURL - is it best for me?
Hi, My main site allows authenticated users to insert bibliographic data into our database. We ask them to start by putting in an ISBN or ISSN. Some documentes don't have them, or the use is too lazy to look for them. Rather than them entering jibberish, we first check that if they have entered something - that its mathematically correct (there's a algorithm to check these). Where they don't know the ISBN/ISSN, I would like them to enter their document title and then get my system to check the UK's main library biblio service (COPAC) and see if the title exists on their db. I've set up a simple cURL test which queries the COPAC site and displays the page as if it was from my site (not quite what I wanted - I'd rather have a list of ISBN/ISSNs and their associated titles without all the baggage). So my questions are: Is there a way for me to (using cURL) ask COPAC how many records match the search and if 0, return the data in a way that I can use it as I wish? If not, is there another tool that I should be using? MTIA George in Oxford (using a mix of NT4/XP by command of the company) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] stipping raw text from rss story
On Tue, 2005-07-26 at 09:28 -0400, Krypto 76 wrote: I want to write a j2me midlet that displays a story headline and description. This is working great. However I want to write a php script that I can hit the url/page of the full story with then pull all of the stories text and remove all html/script/menu/imagee etc. So the phone can display it. How can I effectively get (mostly) just the text? Jay http://pt.php.net/manual/en/function.strip-tags.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cURL - is it best for me?
George Pitcher wrote: Hi, the likelyhood that someone will answer you question with anything relevant rapidly drops when you can't be bothered to start a new thread. this is because threaded news/list readers are, well, threaded and your post just got tagged onto the bottom of some, possibly totally uninteresting thread, that person X is ignoring. if you promise not to do it again I give you an answer that might help, a little. promise? ok then... :-) My main site allows authenticated users to insert bibliographic data into our database. We ask them to start by putting in an ISBN or ISSN. Some documentes don't have them, or the use is too lazy to look for them. Rather than them entering jibberish, we first check that if they have entered something - that its mathematically correct (there's a algorithm to check these). Where they don't know the ISBN/ISSN, I would like them to enter their document title and then get my system to check the UK's main library biblio service (COPAC) and see if the title exists on their db. I've set up a simple cURL test which queries the COPAC site and displays the page as if it was from my site (not quite what I wanted - I'd rather have a list of ISBN/ISSNs and their associated titles without all the baggage). So my questions are: Is there a way for me to (using cURL) ask COPAC how many records match the search and if 0, return the data in a way that I can use it as I wish? cURL is a tool for retrieving a resource from a URL so the question does COPAC offer a 'webservice' that returns 'raw' data? this has nothing to do with cURL at all, you can view cURL (although it a simplistic view as a webbrowser that you scripts can use) COPAC may or may noy offer a handy webservice, and it may be subscription based. If not, is there another tool that I should be using? probably the most powerful one you have, its between your ears and pisses over every other tool at your disposal :-) - chances are you are going to have to use cURL to return the relevant page to you script and then _parse_ the returned (x)HTML in order to determine what (if any relevant data was returned in the page) - such 'parsing' is often called screen-scraping probably you want to make use of either the preg_*() functions, the DOM extension (DOMXML extension if using php4) or SimpleXML extension in order to fish out the relevant data. If you do end up having to scrape out the data yourself you might consider sharing your code on hotscripts.com, phpclasses.org or whatever to save someone else the time to reinvent the wheel .. actually why not search some of the php related sites for code that does what you want - chances are someone has had to do this before. MTIA George in Oxford (using a mix of NT4/XP by command of the company) NT4? YPB (the middle word is 'Poor' ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cURL - is it best for me?
George Pitcher wrote: Jochem, Sorry about the thread issue - nothing intentional - just easier than trying to find my php-general address. the list doesn't give a who sends the mail AFAICT, also if the mail you send doesn't get read and /or replied to then whats the point? oh and the way you describe it it _was_ intentional - you couldn't be bothered to 'find' your php-general address so you replied to an existing thread and changed the subject. not exactly a big deal though :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] quick question about using capital letters coding w/ PHP
Dotan Cohen wrote: On 7/25/05, Jochem Maas [EMAIL PROTECTED] wrote: ...somebody beat me with a virtual stick if I am wrong! Why? I'd rather just throw the php.net/manual at you! harddrive or memory stick? but seriously did I err? Dotan http://lyricslist.com/lyrics/artist_albums/23/aguilera_christina.php Aguilera, Christina Song Lyrics -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Setting clock backwards hangs webserver (PHP+THTTPD)
Hi all, Iam running PHP on THTTPD 2.21b I have a simple php script that sets the system clock (using exec(date -s MMDDhhmm.ss) and returns a page showing the system time when i use it to set the time forwards, it works fine but if i use it and set the time backwards (even a few seconds), the webserver hangs. also it hangs only for exactly the amount of time needed for the backwards-set time to catch up with the original time. when the clock catches up with the original time, the page is returned. till then it hangs it's almost as if the webserver is waiting for the time to come back to the request-received time before sending the page. i dont know if this is a php problem or a thttpd problem. any pointers, please ? Regards, Vinoo Sent via the WebMail system at kalkitech.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] On register_shutdown_function: What might be the problem?
Hi Rasmus, This may be a little bit long, sorry for taking your time. It still does not work as expected. I tried some experiment, and found that if I called some function or write some code line other then calling header(), the register_shutdown_function and other part of codes work as expected . For example: ?php set_time_limit(5); function f(){ set_time_limit(10); //doing something time consuming } some_function(); ? The time limit of 5 will be the limit of the some_function() and the 10 will be the limit of function f() respectively. Code example: --- ?php set_time_limit(1); ignore_user_abort(true); function say_goodbye() { $st = connection_status(); print Status 1: .$st.\n; set_time_limit(10); $st = connection_status(); print Status 2: .$st.\n; $count=2000; for($i=0; $i$count; $i++){} print End!\n; exec(touch /home/.nappy/liang/liang.ns2user.info/php/bbb); } register_shutdown_function(say_goodbye); print Sleeping...\n; $count=1000; for($i=0; $i$count; $i++){} print Done!\n; ? -bash-2.05b$ curl -N liang.ns2user.info/php/v.php Sleeping... br / bFatal error/b: Maximum execution time of 1 second exceeded in b/home/.nappy/liang/liang.ns2user.info/php/v.php/b on line b30/bbr / Status 1: 2 Status 2: 2 End! ~~~ if I change the time limit from 10 to 5 in function f() -bash-2.05b$ curl -N liang.ns2user.info/php/v.php Sleeping... br / bFatal error/b: Maximum execution time of 1 second exceeded in b/home/.nappy/liang/liang.ns2user.info/php/v.php/b on line b30/bbr / Status 1: 2 Status 2: 2 br / bFatal error/b: Maximum execution time of 5 seconds exceeded in b/home/.nappy/liang/liang.ns2user.info/php/v.php/b on line b14/bbr / ~~ Change both the time limit to 10 will result: -bash-2.05b$ curl -N liang.ns2user.info/php/v.php Sleeping... Done! Status 1: 0 Status 2: 0 End! ~~ But if the some_function is header() then the rule above does not work. It seems the function f()'s time limit also rule the header(). Only after the registered shutdown function finishes runing normally or by hit the expire time limit, will the header() return page to browser/http user agent. Example code with suggestion from Rasmus as: -- ?php set_time_limit(5); function f(){ set_time_limit(100); $count=5; for($i=0; $i$count; $i++){ //sit here and loop for a bit so we can have time to hit Stop... echo a \n; flush(); } echo end; exec(touch /tmp/aaa); } register_shutdown_function('f'); ignore_user_abort(true); header(Content-type: text/plain); header(Location: y.html); echo foo\n; flush(); for($i=0;$i10;$i++) { echo $i; sleep(1); } $fp = fopen(/tmp/foo.txt,a); fputs($fp,$i); fclose($fp); ? -- After the file /tmp/foo.txt has been created, before the file /tmp/aaa being created, the y.html will not get to the browser or perl program using LWP::UserAgent. I think it is no way to close the connection actively by the php program to deliver the page sooner to end the http request, even I add lines and make code like this does not work: header(Content-type: text/plain); header(Cache-Control: no-store, no-cache); header(Location: y.html); header(Connection: close); My project act as a broker for user agent to a library database server called z39.50. Upon the request from user agent, my program need to connect a z39.50 server, getting data back 1 by 1, transforming to sepcial xml format and sending back to the request party. When the data repository is huge (sometimes up to million records), I have to get partial data transform and send back to user agent (normally a piece of perl code, called harvester) with a resumption token. The harvester will in a while loop send out another http request with the last resumption token and fetch data of next part, until finish all data fetching. The time to connect the database and do the query is a constant overhead. So it is not a good design that program need to connect the database and query upon each request with or with out resumption token. So my design is to connect to database and query only when the first initial request comes, and reponse back with partical data using header() and continue getting back data from z39
[PHP] Apache 2.0.52 + PHP 4.3.9 configuration problem, for Linux Fedora 3.
Hi, I have Apache 2.0.52 with PHP 4.3.9, running on a Linux Fedora 3, and cannot write through PHP on any folder, except for /tmp. No matter which permissions, owner or group are set for the folders or files, they never become writable. When I execute the following script, I have always obtain as a result, that The file is not writable, although it should be, because test.txt has Apache as its owner and group, and permissions for reading, writing and executing for the owner, group and others. In Apache, the user and group are set to Apache, and in PHP the safe mode is off. - ?php $filename1 = '/opt/ilias/www/htdocs/ilias3/setup/test.txt'; $filename2 = '/opt/ilias/www/htdocs/ilias3/setup'; $filename3 = '/tmp'; clearstatcache(); if (is_writable($filename1)) { echo 'The file is writable'; } else { echo 'The file is not writable'; } clearstatcache(); if (is_readable($filename1)) { echo 'The file is readable'; } else { echo 'The file is not readable'; } clearstatcache(); if (file_exists($filename1)) { echo The file exists; } else { echo The file does not exist; } ? -- Have you ever experienced a problem like this? Thanks a lot, Nancy. - This mail sent through IMP: http://horde.org/imp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [PHP4]: Problem with Form not putting Data in Post Request
Jochem Maas wrote: Rasmus Lerdorf wrote: maddog1169 wrote: The one that does not get accepted is Group including the You have something like this? input type=text name=Group / It should work. Make sure you have quotes around it, of course, or weird stuff will happen. IIRC technically the and should be HTML entity encoded. depending on browser/server/doctype combination that also may be giving the OP a problem? e.g. input type=text name=lt;Groupgt; / ... looking into this a little further I discover the following information at w3c: (here: http://www.w3.org/TR/html4/types.html#type-name) ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens (-), underscores (_), colons (:), and periods (.). which suggests that even though a and/or in a name attribute value can/does work it might not be a good idea to use it. That's very true. And I suspect some browsers may not like sending these characters directly without encoding them first. My point was simply that PHP doesn't really care and that if the browser manages to send the POST data with those chars, there is nothing in PHP stopping them from showing up in the $_POST array. A space or a period get converted to underscores, but we don't touch and -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] safe mode
Hey! I presently require hosting with a company that has their servers in Sweden, and I need a shared hosting account, any recommendations are welcome, the server is for a client. I have found quire a few via google but I noticed most of them are with Safemode ON and Register_globals ON which I find to be quite strange because I have always hosted on a regular server with safe mode off, register_ globals does not really metter, as if it was off I didnt do anything but if it was on I used a htaccess file to put the b**ch off :-) I have done a little reading on Safe Mode, but I'm looking for _your_ experiences with safe mode and the problems you have faced or/and any warnings for me. Will continue to read and search via google while i wait for your answer/s. OT-Another difference I have noticed with Swedish hosts and American hosts is...more than 50% of the hosts here are offering _no_ limit to traffic!! (As long as you are not offering music, movies,porn or torrent trackers on the site) Thanks, Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using PHP to get user input via checkbox through a database
Hello everyone, What I want to do is have a form (which is already created) where the user selects (via checkbox) on an item or group of items (almost like a shopping cart). These items are stored in a MySql database and the program was written in PHP. So far I have created an insert form that inserts the products into a database. The database is displayed in a form where the user now needs to click on the select box so that he/she can choose their items. Once they have chosen the items a confirmation page is supposed to come out with the user's choices and the user will confirm that this is correct or not and either click submit or go back to choose again. If they click submit than I am supposed to receive an email with all of the user's choices. The part I am still stuck in is when the user attempts to choose, nothing really happens. Following is the code that displays the database and allows the user to choose via the check boxAny help would be appreciated. ?php require_once('Connections/connBlog.php'); ? ?php mysql_select_db($database_connBlog, $connBlog); $query_Recordset1 = SELECT * FROM ebay_products; $Recordset1 = mysql_query($query_Recordset1, $connBlog) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ? ?php require_once('Connections/connBlog.php'); ? html head titleUntitled Document/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body div align=center pnbsp;/p form action= method=post name=form1 table width=75% height=10% border=10 align=center cellpadding=0 cellspacing=0 bordercolor=#99FFCC tr tddiv align=centerDescription of Product/div/td tddiv align=centerCoupon Amount/div/td tddiv align=centerExpiration Date/div/td tddiv align=centerYour Selection/div/td /tr ?php do { ? tr td width=65% div align=center?php echo $row_Recordset1['product']; ?/div/td td width=8% div align=center$?php echo $row_Recordset1['discount']; ?/div/td td width=15% div align=center?php echo $row_Recordset1['expire']; ?/div/td td width=2% div align=center input name=select type=checkbox id=select value=checkbox /div/td /tr ?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ? /table table width=25% border=0 cellspacing=0 cellpadding=0 tr td div align=center input type=submit name=Submit value=Submit /div/td td div align=center input name=back type=button id=back value=Go Back /div/td /tr /table pnbsp;/p /form pnbsp;/p /div p align=center a href=ebayinsert.phpInsert Data/a/p /body /html ?php mysql_free_result($Recordset1); ?
[PHP] Error default 16 with PHP 5.1b3
I upgraded from PHP 5.0.4 to 5.1b3 yesterday and all my scripts die the only trace being a lone line: default 16 written to the command window. There are a few Notice's that preceed that look like: Notice: Only variable references should be returned by reference in c:\Programs\php\php-5.1b3\extras \log4php\LoggerManager.php on line 92 Call Stack: 0.0043 1. {main}() c:\cvs\ag1\eng\src\php\activegrid\data\test\mysqldataservicetest.php:0 0.0374 2. require_once('C:\cvs\ag1\eng\src\php\activegrid\agunittest.php') c:\cvs\ag1\eng\src\ php\activegrid\data\test\mysqldataservicetest.php:6 11.3656 3. require_once('C:\cvs\ag1\eng\src\php\activegrid\util\xmlutils.php') C:\cvs\ag1\eng\s rc\php\activegrid\agunittest.php:13 11.3915 4. require_once('C:\cvs\ag1\eng\src\php\activegrid\util\xmlmarshaller.php') C:\cvs\ag1\ eng\src\php\activegrid\util\xmlutils.php:8 11.4067 5. LoggerManager::getLogger() C:\cvs\ag1\eng\src\php\activegrid\util\xmlmarshaller.php: 15 PHP 5.1 doesn't seem to like Log4PHPs use of the reference operator. I'm not sure if they're related though. I took all the offending reference operators out of Log4PHP which got rid of the notices. Now it just with that one enigmatic error default 16. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] cURL - is it best for me?
On 26 July 2005 14:38, George Pitcher wrote: So my questions are: Is there a way for me to (using cURL) ask COPAC how many records match the search and if 0, return the data in a way that I can use it as I wish? If not, is there another tool that I should be using? Maybe you should be looking at the YAZ (Z39.50) extension? See http://pecl.php.net/package/yaz and http://indexdata.dk/phpyaz/. I don't know off the top of my head whether COPAC supports Z39.50, but it seems likely. Failing that, I'm absolutely sure the British Library has a Z39.50 server. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Very Basic question: What IDE/tools I need to begin using PHP?
Hi everybody, I am learning PHP, and have this very basic question: What software/tools I need to begin? What is the best IDE I can use? (in windows) Please tell me about FULL-IDEs, not just super text editors that can syntax-highlight PHP code. I want to debug, deploy... ALL! I have just downloaded Zend Studio Client AND Zend Studio Server. Is that all I need to begin?... Tak - Start your day with Yahoo! - make it your home page
Re: [PHP] Very Basic question: What IDE/tools I need to begin using PHP?
You would actually only need Zend Studio Client. It's the best PHP IDE i've ever tried (and believe me, i've been around ;) On 7/26/05, Taksam [EMAIL PROTECTED] wrote: Hi everybody, I am learning PHP, and have this very basic question: What software/tools I need to begin? What is the best IDE I can use? (in windows) Please tell me about FULL-IDEs, not just super text editors that can syntax-highlight PHP code. I want to debug, deploy... ALL! I have just downloaded Zend Studio Client AND Zend Studio Server. Is that all I need to begin?... Tak - Start your day with Yahoo! - make it your home page -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Very Basic question: What IDE/tools I need to begin using PHP?
To expand a little: Zend Client is super for debugging on a localhost but if you want a team of developers to have debug / profile tools then Zend Studio Server is the tool. I would suggest that you apply for the Zend Small Business program if these tools meet your needs for one low yearly price you get both plus the encoder and the server module to handle deployments, or testing... I hope this is helpful. --Jeff On Tue, 2005-07-26 at 18:32 +0100, André Medeiros wrote: You would actually only need Zend Studio Client. It's the best PHP IDE i've ever tried (and believe me, i've been around ;) On 7/26/05, Taksam [EMAIL PROTECTED] wrote: Hi everybody, I am learning PHP, and have this very basic question: What software/tools I need to begin? What is the best IDE I can use? (in windows) Please tell me about FULL-IDEs, not just super text editors that can syntax-highlight PHP code. I want to debug, deploy... ALL! I have just downloaded Zend Studio Client AND Zend Studio Server. Is that all I need to begin?... Tak - Start your day with Yahoo! - make it your home page -- Jeffrey D. Means [EMAIL PROTECTED] MeansPC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Very Basic question: What IDE/tools I need to begin using PHP?
Taksam wrote: Hi everybody, I am learning PHP, and have this very basic question: What software/tools I need to begin? What is the best IDE I can use? (in windows) Please tell me about FULL-IDEs, not just super text editors that can syntax-highlight PHP code. I want to debug, deploy... ALL! I have just downloaded Zend Studio Client AND Zend Studio Server. Is that all I need to begin?... http://www.thelinuxconsultancy.co.uk/phpeditors.php -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: performance.
On Tue, 26 Jul 2005, Matthew Weier O'Phinney wrote: this could be a silly question. Is there some performance penalty when using the operator [in heredoc] Try doing some benchmarks using microtime(). My gut reaction is that there shouldn't be any difference; heredoc syntax is simply another form of quoting strings. I had forgotten the heredoc name for that sintax style. I'll do some benchmarking. My reaction is the same, and even as there just one asignment, I guess the operation is faster Thanks, Rodolfo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is_array() doesn't work on DOM properties?
This is with simplexml_load_file(). Using an empty() check instead of is_array() does the trick (though - note to php hackers - I think is_array() SHOULD work). John --- Jochem Maas [EMAIL PROTECTED] wrote: John Smith wrote: I'm trying to avoid error messages while iterating over DOM properties. e.g. if(is_array($dom-stuff-props)) { maybe you can get roudn the problem by saying?: if($dom-stuff-props) { or?: if(!empty($dom-stuff-props)) { foreach($dom-stuff-props as $prop) { ... } } It works without the is_array() check, but not with my guess is you'll find that $dom-stuff-props is an object which overloads the array accessor stuff... basically it's implementing Iterator (or some other SPL Interface) hard to tell though because you don't mention which DOM related extension you are using. it. I've done var_dumps and $dom-stuff-props is indeed an array. I've also tried using an intermediate variable ($stuff=$dom-stuff) then checking that, but that doesn't work either). John Start your day with Yahoo! - make it your home page http://www.yahoo.com/r/hs __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Object Inheritance, get_class() and a static function call
Hello, following code won't work in the expected way: class ClassA { function getClassName() { return get_class($this); # [1] } } class ClassB extends ClassA { } echo ClassB::getClassName(); this script echoes Object instead of ClassB. but i would like to return the classname of the derived class without writing the method again. this will work: B = new ClassB(); echo ClassB-getClassName(); i tried to use line [2] instead of [1] return get_class(self); # [2] but this only returns an empty string. is there any solution for my problem? i'm using PHP Version 5.0.3 (with Apache 1, Windows XP) greetings axel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is_array() doesn't work on DOM properties?
John Smith wrote: This is with simplexml_load_file(). Using an empty() check instead of is_array() does the trick (though - note to php hackers - I think is_array() SHOULD work). ah simplexml, in that case is_array() shouldn't and won't work because it's 'all' objects (although I can understand why it seems like it should work!) - but the objects allow array(-like) iteration of contained elements. read this again very carefully: http://be2.php.net/simplexml note also that even values are actually objects that implement the __toString() interface (although I'm not sure that is the correct way to explain/name it) where by the object is automatically cast to a string in a sensible way when used with echo/print ... as the exmaples on the simplexml page show you have to cast manually if you want to do other things with the string representation (like using the actually value of the object as the test value of a switch block. here is some more reading material: http://www.onlamp.com/pub/a/php/2004/01/15/simplexml.html good luck John --- Jochem Maas [EMAIL PROTECTED] wrote: John Smith wrote: I'm trying to avoid error messages while iterating over DOM properties. e.g. if(is_array($dom-stuff-props)) { maybe you can get roudn the problem by saying?: if($dom-stuff-props) { or?: if(!empty($dom-stuff-props)) { foreach($dom-stuff-props as $prop) { ... } } It works without the is_array() check, but not with my guess is you'll find that $dom-stuff-props is an object which overloads the array accessor stuff... basically it's implementing Iterator (or some other SPL Interface) hard to tell though because you don't mention which DOM related extension you are using. it. I've done var_dumps and $dom-stuff-props is indeed an array. I've also tried using an intermediate variable ($stuff=$dom-stuff) then checking that, but that doesn't work either). John Start your day with Yahoo! - make it your home page http://www.yahoo.com/r/hs __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ibase_connect...how to specify a port?
How do you specify a port to connect to? I tried using localhost:3050 (3050 is the default port that Firebird) and that didn't work. $host = 'localhost:/path/to/your.gdb' ; $username = 'SYSDBA'; $password = 'masterkey'; $dbh = ibase_connect ( $host , $username , $password ); -- -James
Re: [PHP] Object Inheritance, get_class() and a static function call
Hello axel, Tuesday, July 26, 2005, 8:02:05 PM, you wrote: a class ClassA { afunction getClassName() { a return get_class($this); # [1] a} a } a class ClassB extends ClassA { } a echo ClassB::getClassName(); a this script echoes Object instead of ClassB. but i would like to a return the classname of the derived class without writing the method again. The double colon, is a token that allows access to static, constant, and overridden members or methods of a class. Of which none of yours are (at least not in the code posted) Wouldn't get_parent_class() work in this situation? Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services Zend Certified Engineer I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Object Inheritance, get_class() and a static function call
axel wrote: Hello, following code won't work in the expected way: class ClassA { function getClassName() { return get_class($this); # [1] } } class ClassB extends ClassA { } echo ClassB::getClassName(); this script echoes Object instead of ClassB. but i would like to either you tested some different code to what you posted above OR (your build of?) 5.0.3 is borked. I tested this on 5.0.2 and 5.0.4 and both did exactly what I expected, namely output nothing - $this is not defined when you call ClassB::getClassName() (because you make a static call) so nothing is the only logical output. return the classname of the derived class without writing the method again. this will work: ??? it's not even valid php. B = new ClassB(); echo ClassB-getClassName(); maybe you mean: class ClassA {function getClassName() { return get_class($this); }} class ClassB extends ClassA {} $B = new ClassB(); echo $B-getClassName(); which _does_ work but is fairly pointless because you already know the classname in order to be able to create the object in the first place. i tried to use line [2] instead of [1] return get_class(self); # [2] but this only returns an empty string. again this is what I expect to happen. is there any solution for my problem? I don't really see what the problem is, can you give some more real world detail on what you are trying/want to do? otherwise (re-)read this chapter: http://php.belnet.be/manual/en/language.oop5.php ... if you're _really_ into generic code then the reflection API is maybe you should look into. I have used reflection no and again, very useful stuff although to be honest I don't really grasp the concept/reasoning behind reflection properly (which means I have probably been 'misusing' it :-) rgds i'm using PHP Version 5.0.3 (with Apache 1, Windows XP) greetings axel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ibase_connect...how to specify a port?
James wrote: How do you specify a port to connect to? I tried using localhost:3050 you can't/don't specify the port in your connection string. (3050 is the default port that Firebird) and that didn't work. yeah somebody using the firebird extension! or trying at least. ;-) you have to specify the port that firebird is bound to in the SERVICES file (its name and location differ depending on your platform) - on windows the firebird installer should do this for you. on linux you have to edit /etc/services (the format is pretty simple) also check out the aliases.conf file which lives alongside your fierbird.conf file where you can do stuff like: mydb = '/path/to/your.gdb' and then: ibase_connect ( 'mydb', $username , $password ); which is nice and allows easy to port code :-) $host = 'localhost:/path/to/your.gdb' ; IIRC the localhost part is not required, so the following will do: $host = '/path/to/your.gdb' by all means come back with firebird questions - as far as firebird/php are concerning I am a 1 man [marketing] army :-) computed-fields, multi-db transactions, views, triggers, constraints, stored procedures, PROPER parameterized queries! it's like using Oracle without the pre-requisite second mortgage, without the the nightmare API AND (maybe most important) with the added bonus that you are not making some twat like Larry Elison even richer :-) for those of you who are strong in DBs/SQL give it a try it's great stuff! $username = 'SYSDBA'; $password = 'masterkey'; do change this :-) and/or lock down port 3050 on your firewall. rgds $dbh = ibase_connect ( $host , $username , $password ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using PHP to get user input via checkbox through a data base
Hello everyone, What I want to do is have a form (which is already created) where the user selects (via checkbox) on an item or group of items (almost like a shopping cart). These items are stored in a MySql database and the program was written in PHP. So far I have created an insert form that inserts the products into a database. The database is displayed in a form where the user now needs to click on the select box so that he/she can choose their items. Once they have chosen the items a confirmation page is supposed to come out with the user's choices and the user will confirm that this is correct or not and either click submit or go back to choose again. If they click submit than I am supposed to receive an email with all of the user's choices. The part I am still stuck in is when the user attempts to choose, nothing really happens. Following is the code that displays the database and allows the user to choose via the check boxAny help would be appreciated. ?php require_once('Connections/connBlog.php'); ? ?php mysql_select_db($database_connBlog, $connBlog); $query_Recordset1 = SELECT * FROM ebay_products; $Recordset1 = mysql_query($query_Recordset1, $connBlog) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ? ?php require_once('Connections/connBlog.php'); ? html head titleUntitled Document/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body div align=center pnbsp;/p form action= method=post name=form1 table width=75% height=10% border=10 align=center cellpadding=0 cellspacing=0 bordercolor=#99FFCC tr tddiv align=centerDescription of Product/div/td tddiv align=centerCoupon Amount/div/td tddiv align=centerExpiration Date/div/td tddiv align=centerYour Selection/div/td /tr ?php do { ? tr td width=65% div align=center?php echo $row_Recordset1['product']; ?/div/td td width=8% div align=center$?php echo $row_Recordset1['discount']; ?/div/td td width=15% div align=center?php echo $row_Recordset1['expire']; ?/div/td td width=2% div align=center input name=select type=checkbox id=select value=checkbox /div/td /tr ?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ? /table table width=25% border=0 cellspacing=0 cellpadding=0 tr td div align=center input type=submit name=Submit value=Submit /div/td td div align=center input name=back type=button id=back value=Go Back /div/td /tr /table pnbsp;/p /form pnbsp;/p /div p align=center a href=ebayinsert.phpInsert Data/a/p /body /html ?php mysql_free_result($Recordset1); ? Problems I see right off the bat are: 1) your form tag has no action (action=), therefore no action will be taken upon submit. 2) your checkboxes have no unique value, so even if your form WAS being submitted to some other page, you wouldn't be able to tell which ones were checked. To solve these problems, set your form action to the page that is to process the POST, then change this line: input name=select type=checkbox id=select value=checkbox ...to be something like input name=select type=checkbox id=select value=?php echo $row_Recordset1['product'];? JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Object Inheritance, get_class() and a static function call
Hello Richard, thanks for for your answer. a class ClassA { afunction getClassName() { a return get_class($this); # [1] a} a } a class ClassB extends ClassA { } a echo ClassB::getClassName(); a this script echoes Object instead of ClassB. but i would like to a return the classname of the derived class without writing the method again. The double colon, is a token that allows access to static, constant, and overridden members or methods of a class. Of which none of yours are (at least not in the code posted) Sure! It's the first one: i'm calling a method of the class without instantiaton. it works even though the method isn't declared static. maybe this is the fault!? class ClassA { public static function getClassName() { return get_class($this); // [1] // or [2] return get_class(self); // or [3] return __CLASS__; } } class ClassB extends ClassA { } echo ClassB::getClassName(); Wouldn't get_parent_class() work in this situation? No, because there is no parent class of ClassA and im searching for the name of the derived class. Maybe i will found the solution on http://php.belnet.be/manual/en/language.oop5.static.php Still reading... Best regards, Axel P. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] test (just delete)
test -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] becoming root user within php
Hello, I'm in the process of executing system commands using php. The only problem is that I am not entirely sure how to execute these system commands using root user. (I need root access to do a few things through php). Whenever I use the exec command it uses the www user. Would anyone know? Thanks for any assistance! Tom
Re: [PHP] On register_shutdown_function: What might be the problem?
I really didn't follow all that. But this stuff is not that complex. header() sets a header to be sent when output goes out. header() does not send an actual header at that point. If you don't send any output, then the headers won't go out until the script terminates. If you have any sort of output buffering enabled, then even if you think you are sending something, you may only be buffering it, and in that case again the headers won't go out until the request is done. Also, ignore_user_abort() controls whether or not your script will be terminated when we are able to detect that the user has aborted. A user abort is defined as nobody being around to read the data we are sending out. If you don't send anything, we can't detect if the browser has gone away. Generally browsers will redirect as soon as they see a Location: redirect header, but that could be client-speficic. If the client sticks around after seeing the redirect and doesn't redirect until after the server has closed the connection, then there is no way to force a close. If it does redirect and close its end of the connection, then if you set ignore_user_abort(false) your script will be terminated as soon as it tries to send something further and your shutdown function will be called at that point. -Rasmus Liang ZHONG wrote: Hi Rasmus, This may be a little bit long, sorry for taking your time. It still does not work as expected. I tried some experiment, and found that if I called some function or write some code line other then calling header(), the register_shutdown_function and other part of codes work as expected . For example: ?php set_time_limit(5); function f(){ set_time_limit(10); //doing something time consuming } some_function(); ? The time limit of 5 will be the limit of the some_function() and the 10 will be the limit of function f() respectively. Code example: --- ?php set_time_limit(1); ignore_user_abort(true); function say_goodbye() { $st = connection_status(); print Status 1: .$st.\n; set_time_limit(10); $st = connection_status(); print Status 2: .$st.\n; $count=2000; for($i=0; $i$count; $i++){} print End!\n; exec(touch /home/.nappy/liang/liang.ns2user.info/php/bbb); } register_shutdown_function(say_goodbye); print Sleeping...\n; $count=1000; for($i=0; $i$count; $i++){} print Done!\n; ? -bash-2.05b$ curl -N liang.ns2user.info/php/v.php Sleeping... br / bFatal error/b: Maximum execution time of 1 second exceeded in b/home/.nappy/liang/liang.ns2user.info/php/v.php/b on line b30/bbr / Status 1: 2 Status 2: 2 End! ~~~ if I change the time limit from 10 to 5 in function f() -bash-2.05b$ curl -N liang.ns2user.info/php/v.php Sleeping... br / bFatal error/b: Maximum execution time of 1 second exceeded in b/home/.nappy/liang/liang.ns2user.info/php/v.php/b on line b30/bbr / Status 1: 2 Status 2: 2 br / bFatal error/b: Maximum execution time of 5 seconds exceeded in b/home/.nappy/liang/liang.ns2user.info/php/v.php/b on line b14/bbr / ~~ Change both the time limit to 10 will result: -bash-2.05b$ curl -N liang.ns2user.info/php/v.php Sleeping... Done! Status 1: 0 Status 2: 0 End! ~~ But if the some_function is header() then the rule above does not work. It seems the function f()'s time limit also rule the header(). Only after the registered shutdown function finishes runing normally or by hit the expire time limit, will the header() return page to browser/http user agent. Example code with suggestion from Rasmus as: -- ?php set_time_limit(5); function f(){ set_time_limit(100); $count=5; for($i=0; $i$count; $i++){ //sit here and loop for a bit so we can have time to hit Stop... echo a \n; flush(); } echo end; exec(touch /tmp/aaa); } register_shutdown_function('f'); ignore_user_abort(true); header(Content-type: text/plain); header(Location: y.html); echo foo\n; flush(); for($i=0;$i10;$i++) { echo $i; sleep(1); } $fp = fopen(/tmp/foo.txt,a); fputs($fp,$i); fclose($fp); ? -- After the file /tmp/foo.txt has been created, before the file /tmp/aaa being created, the y.html will not get to the browser or perl program using LWP::UserAgent. I think it is no way to close the connection
[PHP] install or interference problem
Hello, It seems I do not get apache server to run. It shuts down instantly. I installed via http://www.hotscripts.com/PHP/Software_and_Servers/Installation_Kits/ the XAMPP implementation for the PHP-mysql server. I captured the following part of the message of the dos window when activating the apache server. Part is in dutch ...I freely translated that part in the translated dos message. As far as I know I only run zone alarm in the background, and this nicely asks for access to internet for the various components of the XAMPP programs. What do I have to check/change/adapt to make sure the apache server runs. The mysql part does run properly by the way. Thanks _*Original dos message*_ Apache 2 is starting OS 10048 Elk socketadres protocol/netwerkadres/poort kan normaal slechts een keer worden gebruikt. :make_sock: could not bind to address 0,0,0,0:443 no listening sockets available, shutting down Unable to open logs _*Translated dos message:*_ I translated the dutch part and then you get: OS 10048 Every socketaddress protocol/networkaddress/port can normally only be used once. :make_sock: could not bind to address 0,0,0,0:443 no listening sockets available, shutting down Unable to open logs
Re: [PHP] Object Inheritance, get_class() and a static function call
Hello Jochem, either you tested some different code to what you posted above OR (your build of?) 5.0.3 is borked. sorry, I didn't tested the code at all, because my code is more complex. I just tried to show the problem. class ClassA { public static function getClassName() { return get_class($this); // [1] // or [2] return get_class(self); // or [3] return __CLASS__; } } class ClassB extends ClassA { } echo ClassB::getClassName(); I am searching for a function to use in line [1] so that the script's output is ClassB. I tested this on 5.0.2 and 5.0.4 and both did exactly what I expected, namely output nothing - $this is not defined when you call ClassB::getClassName() (because you make a static call) so nothing is the only logical output. my fault, again, sorry. I jumbled the different outputs. I understood that this behaviour is coherent. maybe you mean: class ClassA {function getClassName() { return get_class($this); }} class ClassB extends ClassA {} $B = new ClassB(); echo $B-getClassName(); which _does_ work but is fairly pointless because you already know the classname in order to be able to create the object in the first place. that's true. I don't want to use this. I just checked it. I don't really see what the problem is, can you give some more real world detail on what you are trying/want to do? otherwise (re-)read this chapter: http://php.belnet.be/manual/en/language.oop5.php http://php.belnet.be/manual/en/language.oop5.static.php#48234 is better. but it seems that even debug_backtrace() is not what i'm looking for... ... if you're _really_ into generic code then the reflection API no, no generic code. ;) regards axel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] On register_shutdown_function: What might be the problem?
That's a client-side issue then, because it is certainly sent. Trying your exact script: ?php ignore_user_abort(true); header(Location: redirect2.html); echo foo\n; flush(); for($i=0;$i10;$i++) { echo $i; sleep(1); } $fp = fopen(/tmp/foo.txt,a); fputs($fp,$i); fclose($fp); ? It's at http://lerdorf.com/red.php if you want to test it yourself. 3:53pm colo:/var/www/lerdorf.com telnet localhost 80 Trying 127.0.0.1... Connected to colo. Escape character is '^]'. GET /red.php HTTP/1.0 HTTP/1.1 302 Found Date: Tue, 26 Jul 2005 22:53:40 GMT Server: Apache/1.3.33 (Debian GNU/Linux) PHP/4.4.1-dev X-Powered-By: PHP/4.4.1-dev Location: redirect2.html Connection: close Content-Type: text/html; charset=utf-8 foo 10 second delay here Connection closed by foreign host. -Rasmus Liang ZHONG wrote: Thank you for replying. Sorry for being long again. I tried your suggestion of this: ?php ignore_user_abort(true); header(Location: redirect2.html); echo foo\n; flush(); for($i=0;$i10;$i++) { echo $i; sleep(1); } $fp = fopen(/tmp/foo.txt,a); fputs($fp,$i); fclose($fp); ? The browser did not get the redirect page until the new $i(10) has been appended to file foo.txt. I also tried --- ob_start(); header(Location: http://liang.ns2user.info/php/y.html;); echo foo\n; ob_end_flush(); --- And does not work. I think it might be the case of what you suggest: If the client sticks around after seeing the redirect and doesn't redirect until after the server has closed the connection, then there is no way to force a close. So may I draw the conclusions: 1. Server in php can not actively close the connection to make the client see the redirect page immediately after the header has been set? 2. The connection is not closed even when the main php end and the shutdown function is running? If above conclusions are not true, could be somewhere that might be wrong due to the apache-php configuration or what? If those are true, I think I have to re-design the project flow control and it will take sometime while I have already finished the code assuming no above problem. Also I think this might result an awkward design for the project. (I mean jsp will be easier to achieve a relatively more elegant design). I use several other program langurages for many years, but new to php, so I probably made some assumption base on my experiences of other langurages but not true. The project I am working now to add enhancements is written on php. I try to keep the main design of it. I did not expect it would be difficult to achieve this: 1. write an xml page 2. let http client get this xml page in time 3. continue do something time consuming now I have difficulty in 2 and 3. My client is normally perl LWP::UserAgent, and sometimes browser. I wonder how to let the client get the page in time before I can continue to finish the rest of the work. Otherwise the client will timeout and get no result. Please help! Thank you. Liang I really didn't follow all that. But this stuff is not that complex. header() sets a header to be sent when output goes out. header() does not send an actual header at that point. If you don't send any output, then the headers won't go out until the script terminates. If you have any sort of output buffering enabled, then even if you think you are sending something, you may only be buffering it, and in that case again the headers won't go out until the request is done. Also, ignore_user_abort() controls whether or not your script will be terminated when we are able to detect that the user has aborted. A user abort is defined as nobody being around to read the data we are sending out. If you don't send anything, we can't detect if the browser has gone away. Generally browsers will redirect as soon as they see a Location: redirect header, but that could be client-speficic. If the client sticks around after seeing the redirect and doesn't redirect until after the server has closed the connection, then there is no way to force a close. If it does redirect and close its end of the connection, then if you set ignore_user_abort(false) your script will be terminated as soon as it tries to send something further and your shutdown function will be called at that point. -Rasmus Liang ZHONG wrote: Hi Rasmus, This may be a little bit long, sorry for taking your time. It still does not work as expected. I tried some experiment, and found that if I called some function or write some code line other then calling header(), the register_shutdown_function and other part of codes work as expected . For example: ?php set_time_limit(5); function f(){ set_time_limit(10); //doing something time consuming } some_function(); ? The time limit of 5 will be the limit of the some_function() and the 10 will be the limit
Re: [PHP] On register_shutdown_function: What might be the problem?
Thank you for replying. Sorry for being long again. I tried your suggestion of this: ?php ignore_user_abort(true); header(Location: redirect2.html); echo foo\n; flush(); for($i=0;$i10;$i++) { echo $i; sleep(1); } $fp = fopen(/tmp/foo.txt,a); fputs($fp,$i); fclose($fp); ? The browser did not get the redirect page until the new $i(10) has been appended to file foo.txt. I also tried --- ob_start(); header(Location: http://liang.ns2user.info/php/y.html;); echo foo\n; ob_end_flush(); --- And does not work. I think it might be the case of what you suggest: If the client sticks around after seeing the redirect and doesn't redirect until after the server has closed the connection, then there is no way to force a close. So may I draw the conclusions: 1. Server in php can not actively close the connection to make the client see the redirect page immediately after the header has been set? 2. The connection is not closed even when the main php end and the shutdown function is running? If above conclusions are not true, could be somewhere that might be wrong due to the apache-php configuration or what? If those are true, I think I have to re-design the project flow control and it will take sometime while I have already finished the code assuming no above problem. Also I think this might result an awkward design for the project. (I mean jsp will be easier to achieve a relatively more elegant design). I use several other program langurages for many years, but new to php, so I probably made some assumption base on my experiences of other langurages but not true. The project I am working now to add enhancements is written on php. I try to keep the main design of it. I did not expect it would be difficult to achieve this: 1. write an xml page 2. let http client get this xml page in time 3. continue do something time consuming now I have difficulty in 2 and 3. My client is normally perl LWP::UserAgent, and sometimes browser. I wonder how to let the client get the page in time before I can continue to finish the rest of the work. Otherwise the client will timeout and get no result. Please help! Thank you. Liang I really didn't follow all that. But this stuff is not that complex. header() sets a header to be sent when output goes out. header() does not send an actual header at that point. If you don't send any output, then the headers won't go out until the script terminates. If you have any sort of output buffering enabled, then even if you think you are sending something, you may only be buffering it, and in that case again the headers won't go out until the request is done. Also, ignore_user_abort() controls whether or not your script will be terminated when we are able to detect that the user has aborted. A user abort is defined as nobody being around to read the data we are sending out. If you don't send anything, we can't detect if the browser has gone away. Generally browsers will redirect as soon as they see a Location: redirect header, but that could be client-speficic. If the client sticks around after seeing the redirect and doesn't redirect until after the server has closed the connection, then there is no way to force a close. If it does redirect and close its end of the connection, then if you set ignore_user_abort(false) your script will be terminated as soon as it tries to send something further and your shutdown function will be called at that point. -Rasmus Liang ZHONG wrote: Hi Rasmus, This may be a little bit long, sorry for taking your time. It still does not work as expected. I tried some experiment, and found that if I called some function or write some code line other then calling header(), the register_shutdown_function and other part of codes work as expected . For example: ?php set_time_limit(5); function f(){ set_time_limit(10); //doing something time consuming } some_function(); ? The time limit of 5 will be the limit of the some_function() and the 10 will be the limit of function f() respectively. Code example: --- ?php set_time_limit(1); ignore_user_abort(true); function say_goodbye() { $st = connection_status(); print Status 1: .$st.\n; set_time_limit(10); $st = connection_status(); print Status 2: .$st.\n; $count=2000; for($i=0; $i$count; $i++){} print End!\n; exec(touch /home/.nappy/liang/liang.ns2user.info/php/bbb); } register_shutdown_function(say_goodbye); print Sleeping...\n; $count=1000; for($i=0; $i$count; $i++){} print Done!\n; ? -bash-2.05b$ curl -N
[PHP] Delivery reports about your e-mail
ALERT! This e-mail, in its original form, contained one or more attached files that were infected with a virus, worm, or other type of security threat. This e-mail was sent from a Road Runner IP address. As part of our continuing initiative to stop the spread of malicious viruses, Road Runner scans all outbound e-mail attachments. If a virus, worm, or other security threat is found, Road Runner cleans or deletes the infected attachments as necessary, but continues to send the original message content to the recipient. Further information on this initiative can be found at http://help.rr.com/faqs/e_mgsp.html. Please be advised that Road Runner does not contact the original sender of the e-mail as part of the scanning process. Road Runner recommends that if the sender is known to you, you contact them directly and advise them of their issue. If you do not know the sender, we advise you to forward this message in its entirety (including full headers) to the Road Runner Abuse Department, at [EMAIL PROTECTED] file attachment: document.zip This e-mail in its original form contained one or more attached files that were infected with the [EMAIL PROTECTED] virus or worm. They have been removed. For more information on Road Runner's virus filtering initiative, visit our Help Member Services pages at http://help.rr.com, or the virus filtering information page directly at http://help.rr.com/faqs/e_mgsp.html. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] becoming root user within php
Hi Tom, First of all due to the risks involved in doing something like this.. are you sure you need to do this as root ? Secondly, are you sure this script will not be accessible via an apache server ? (i.e this is not inside your document root?) Your best bet is to use sudo (man sudo, man visudo). I would suggest narrowing down the list of commands you want to run, and only allowing those commands in your sudoers line. The man pages have lots of examples. On Jul 26, 2005, at 5:28 PM, Tom Cruickshank wrote: Hello, I'm in the process of executing system commands using php. The only problem is that I am not entirely sure how to execute these system commands using root user. (I need root access to do a few things through php). Whenever I use the exec command it uses the www user. Would anyone know? Thanks for any assistance! Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] On register_shutdown_function: What might be the problem?
I tested the link (http://lerdorf.com/red.php) using browser (firefox 1.0), it worked as expected, the page of redirect2.html displayed within 2 seconds. I put the exact code to my testing envirionment (2 places), as this one: http://liang.ns2user.info/php/red.php , and the page shows up in about 13 seconds using the SAME browser. Observation 1. Same client(web browser on same mechine), same code on different runing environment make difference. I use perl code (to get page from http://lerdorf.com/red.php) -- #!/usr/bin/perl -w use strict; use LWP::Simple; use LWP::UserAgent; # get input from command line my ($url) = @ARGV; # set default URL if none is given if ( !$url ){ $url = 'http://liang.ns2user.info/liang/y.php'; print STDOUT qq{Using $url as url to fetch\n}; } # get the html page from the web, into a string my $ua = LWP::UserAgent-new(keep_alive=1, timeout=180); my $req = HTTP::Request-new( GET = $url ); my $res = $ua-request( $req ); if(!$res-is_success){ my $error = $res-message(); print STDOUT qq{ERRO: with pid of $$ has ended for the following error: $error}; exit; } my $htmlPage = $res-content; print $htmlPage.\n; exit; -- It takes about 13 seconds to get: ~~ marvin:~/liang.ns2user.info/perl ./http_req.pl http://lerdorf.com/red.php You are now on redirect2.html ~~ Observation 2. = Different clients (browser and perl LWP::UserAgent) request same code on the same mechane result differently. Question: Could it be because of the configuration of linux/apache/php on the server side instead of client side make the difference? (2 of my testing environments are red hat linux with apache 2.0 and one is php5.04 another is 4.3.10.)? The php configuration is: http://liang.ns2user.info/php/info.php. I have no read permission of those httpd.conf files so do not know how apache configured. Any hint? Thank you. Liang That's a client-side issue then, because it is certainly sent. Trying your exact script: ?php ignore_user_abort(true); header(Location: redirect2.html); echo foo\n; flush(); for($i=0;$i10;$i++) { echo $i; sleep(1); } $fp = fopen(/tmp/foo.txt,a); fputs($fp,$i); fclose($fp); ? It's at http://lerdorf.com/red.php if you want to test it yourself. 3:53pm colo:/var/www/lerdorf.com telnet localhost 80 Trying 127.0.0.1... Connected to colo. Escape character is '^]'. GET /red.php HTTP/1.0 HTTP/1.1 302 Found Date: Tue, 26 Jul 2005 22:53:40 GMT Server: Apache/1.3.33 (Debian GNU/Linux) PHP/4.4.1-dev X-Powered-By: PHP/4.4.1-dev Location: redirect2.html Connection: close Content-Type: text/html; charset=utf-8 foo 10 second delay here Connection closed by foreign host. -Rasmus Liang ZHONG wrote: Thank you for replying. Sorry for being long again. I tried your suggestion of this: ?php ignore_user_abort(true); header(Location: redirect2.html); echo foo\n; flush(); for($i=0;$i10;$i++) { echo $i; sleep(1); } $fp = fopen(/tmp/foo.txt,a); fputs($fp,$i); fclose($fp); ? The browser did not get the redirect page until the new $i(10) has been appended to file foo.txt. I also tried --- ob_start(); header(Location: http://liang.ns2user.info/php/y.html;); echo foo\n; ob_end_flush(); --- And does not work. I think it might be the case of what you suggest: If the client sticks around after seeing the redirect and doesn't redirect until after the server has closed the connection, then there is no way to force a close. So may I draw the conclusions: 1. Server in php can not actively close the connection to make the client see the redirect page immediately after the header has been set? 2. The connection is not closed even when the main php end and the shutdown function is running? If above conclusions are not true, could be somewhere that might be wrong due to the apache-php configuration or what? If those are true, I think I have to re-design the project flow control and it will take sometime while I have already finished the code assuming no above problem. Also I think this might result an awkward design for the project. (I mean jsp will be easier to achieve a relatively more elegant design). I use several other program langurages for many years, but new to php, so I probably made some assumption base on my experiences of other langurages but not true. The project I am working now to add enhancements is written on php. I try to keep the main design of it. I did not expect it would be difficult to achieve this: 1. write an xml page 2. let http client get this xml page in time 3. continue do something time consuming now I have difficulty in 2 and 3. My client is normally perl LWP::UserAgent, and sometimes browser. I wonder how to let the
Re: [PHP] On register_shutdown_function: What might be the problem?
Liang ZHONG wrote: The php configuration is: http://liang.ns2user.info/php/info.php. I have no read permission of those httpd.conf files so do not know how apache configured. That shows PHP is running as a CGI. As a CGI PHP has very little control over anything. It is completely at the mercy of the web server to do everything. That's likele the source of your problem. You need a better server with PHP running as an Apache module. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] On register_shutdown_function: What might be the problem?
Sorry for bothering again, but I did not mention the other environment on which I tested, since it has an access control to outsider. I saved the info page to: http://liang.ns2user.info/php/info-train06.htm. The php runing on as apache 2.0 filter module. And the resutl of the experiment is same as the CGI SAPI one. Could you please also take a look for this php configration? I also like to have a look at how the environment looks like of http://lerdorf.com/red.php, if you think it is OK. Another question confruse me a lot is why the browser and perl code behave differently in the return respond to the same link http://lerdorf.com/red.php ? The user clients of our project are mainly harvesters which are written in perl (like the one in my previous email). So I really hope the perl code can work out an example then I will be able to find out a workable configuration. I really appreciate all kindly help from you. Liang Liang ZHONG wrote: The php configuration is: http://liang.ns2user.info/php/info.php. I have no read permission of those httpd.conf files so do not know how apache configured. That shows PHP is running as a CGI. As a CGI PHP has very little control over anything. It is completely at the mercy of the web server to do everything. That's likele the source of your problem. You need a better server with PHP running as an Apache module. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] On register_shutdown_function: What might be the problem?
I have no experience with the Apache2 filter. On the few servers I use Apache2 on I use the handler SAPI and it works fine there as far as I can tell. lerdorf.com is running Apache-1.3 with the standard PHP Apache1 SAPI. No special setup on it. I have no idea why your Perl thing is doing something different on that link. I'm not a Perl guy. At a much higher level, it is a really bad idea to trigger any sort of long-running thing from a web request. It is way too expensive to either fork, or simply tie up an Apache process after the request in order for it to sit around and perform some sort of cleanup or cache operation. You are much better off doing these sorts of things out of band through a cron job or some sort of dedicated lightweight daemon designed explicitly for the task. The Apache process is quite heavy and should be used to handle short dynamic requests. For anything else, there are better tools for the job out there. -Rasmus Liang ZHONG wrote: Sorry for bothering again, but I did not mention the other environment on which I tested, since it has an access control to outsider. I saved the info page to: http://liang.ns2user.info/php/info-train06.htm. The php runing on as apache 2.0 filter module. And the resutl of the experiment is same as the CGI SAPI one. Could you please also take a look for this php configration? I also like to have a look at how the environment looks like of http://lerdorf.com/red.php, if you think it is OK. Another question confruse me a lot is why the browser and perl code behave differently in the return respond to the same link http://lerdorf.com/red.php ? The user clients of our project are mainly harvesters which are written in perl (like the one in my previous email). So I really hope the perl code can work out an example then I will be able to find out a workable configuration. I really appreciate all kindly help from you. Liang Liang ZHONG wrote: The php configuration is: http://liang.ns2user.info/php/info.php. I have no read permission of those httpd.conf files so do not know how apache configured. That shows PHP is running as a CGI. As a CGI PHP has very little control over anything. It is completely at the mercy of the web server to do everything. That's likele the source of your problem. You need a better server with PHP running as an Apache module. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] quick question about using capital letters coding w/ PHP
On 7/26/05, Jochem Maas [EMAIL PROTECTED] wrote: ...somebody beat me with a virtual stick if I am wrong! Why? I'd rather just throw the php.net/manual at you! harddrive or memory stick? just /home/dotan/myfiles/docs/php-manual/ but seriously did I err? Not that I see. But don't forget that to err is human. To really fuck things up we invented computers. Dotan http://lyricslist.com/lyrics/artist_albums/27/alice_in_chains.php Alice In Chains Song Lyrics -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] open_basedir Question
Hi, Has anyone else had a problem with the open_basedir restriction completely ignoring what you tell it? I've added several directories to my allowed path (separated by colons) in my Apache configuration file, and then when I go to run my scripts, I'm told that /home/sites/site1/web/ and so on is not in my allowed path of /home/sites/site1. Trailing slashes don't change anything. A little weird... This is on Linux with PHP 4.3.11. Several bugs on bugs.php.net from 2002 reported similar behavior, but I don't think it's really been corrected. If this is a bug, it's a serious one from my perspective, because it means I turn off those restrictions entirely, which makes my entire server less secure. Thanks, Aaron Aaron Greenspan President CEO Think Computer Corporation http://www.thinkcomputer.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] quick question about using capital letters coding w/ PHP
On 7/26/05, Jochem Maas [EMAIL PROTECTED] wrote: ...somebody beat me with a virtual stick if I am wrong! Why? I'd rather just throw the php.net/manual at you! harddrive or memory stick? just /home/dotan/myfiles/docs/php-manual/ but seriously did I err? Not that I see. But don't forget that to err is human. To really mess things up we invented computers. Dotan http://lyricslist.com/lyrics/artist_albums/27/alice_in_chains.php Alice In Chains Song Lyrics -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php mySql question
I have installed php 5.0.4 on my windows 2000, IIS 6.0 server. PHP works but when I try to connect to MySQL I get the Fatal error: Call to undefined function mysql_connect(). I have uncommented the line in the php.ini file that says 'extension=php_mysql.dll'. I have path variables set for both c:\php and c:\php\ext. One very peculiar thing that I noticed when I ran phpinfo() is that it shows the extension_dir is set to c:\php5 even though in my php.ini file it is set to c:\php. I have a feeling that this is where the problem exists. Any advice would be appreciated. Thanks, NK __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com