php-general Digest 31 Oct 2006 12:50:31 -0000 Issue 4432
php-general Digest 31 Oct 2006 12:50:31 - Issue 4432 Topics (messages 243918 through 243943): Re: How do I get ini_set('output_handler', '') to work?! 243918 by: Daevid Vincent 243923 by: Ed Lazor Re: Decide witch table within a union 243919 by: Ed Lazor 243926 by: Børge Holen Re: only one at atime 243920 by: Ed Lazor 243934 by: Ahmad Al-Twaijiry 243938 by: Ahmad Al-Twaijiry Re: Run script every 30 seconds 243921 by: Ed Lazor 243937 by: Ahmad Al-Twaijiry Re: str_replace on words with an array 243922 by: Ed Lazor help confirming a PDO_SQLITE bug 243924 by: Rick Fletcher 243925 by: Rick Fletcher Re: Imagecopyresampled creates black pictures 243927 by: Martin Hochreiter Stupid question of the day (Editing text file in $HOME via web) 243928 by: Google Kreme IIS Rewrite or Mod_Rewrite 243929 by: Kevin PHP Memory Allocation (checked via TOP) 243930 by: Cabbar Duzayak 243931 by: Cabbar Duzayak Re: counting records in db 243932 by: Ivo F.A.C. Fokkema 243936 by: Roman Neuhauser 243939 by: Robin Vickery need help with foreach 243933 by: melinem.earthlink.net 243935 by: Dave Hamber channels attribute value returns wrong 243940 by: dhatri gmail PHP IMAP with Attachments!? 243941 by: Andy No Error Messages 243942 by: Sancar Saran 243943 by: Jochem Maas 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--- Thank you for the reply Richard (and Tom). That news sucks however. Seems that the PHP pre-parser should handle this better. It's not like it's a one-pass parser (like Ruby). ?php ini_set('output_handler', 'mb_output_handler'); echo \noutput_handler = . ini_get('output_handler') . \n; ? I suppose I could re-compile my command line version with a different php.ini file, but that's kind of lame that I have to have two php.ini files for what ini_set() SHOULD handle. What other undocumented gotchas are there with ini_set() I wonder... DÆVID -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Sunday, October 29, 2006 9:25 PM To: Daevid Vincent Cc: php-general@lists.php.net Subject: Re: [PHP] How do I get ini_set('output_handler', '') to work?! On Fri, October 27, 2006 3:46 pm, Daevid Vincent wrote: What am I doing wrong... In my php.ini I have this for my web pages (and I want it): output_handler = ob_gzhandler But this causes my command line script to not show output until the very end. I thought I could disable it at the top of a script, but it's not working!?! #!/usr/bin/php -q ?php ini_set('output_handler', 'mb_output_handler'); TOO LATE! The ob_start() has already kicked in by this point. ob_flush() until there are no more buffers. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? ---End Message--- ---BeginMessage--- I suppose I could re-compile my command line version with a different php.ini file, but that's kind of lame that I have to have two php.ini files for what ini_set() SHOULD handle. Would modifications via .htaccess work for you? -Ed ---End Message--- ---BeginMessage--- Someone asked what it was to be used for. It's for combining 4 forums into one witch shows the latest movement among them. More like an introduction sort of... Sounds cool. Are you using a pre-made forum package? -Ed ---End Message--- ---BeginMessage--- On Tuesday 31 October 2006 02:27, Ed Lazor wrote: Someone asked what it was to be used for. It's for combining 4 forums into one witch shows the latest movement among them. More like an introduction sort of... Sounds cool. Are you using a pre-made forum package? No Maby it'd been easier, I did that at first... But not much to learn using other ppls tools. -Ed -- --- Børge Kennel Arivene http://www.arivene.net --- ---End Message--- ---BeginMessage--- On Oct 30, 2006, at 10:14 AM, Ahmad Al-Twaijiry wrote: Hi everyone, I create a php script that will run every minute (by cronjob) and update some database tables (php 5, database mysql 5, tables type innodb) the problem is that I want this script to run only one at atime (only one process from this script can run ) for example, if the cronjob start the script and the script takes more than one minute, then after this one minute the cronjob start another process from this script, it should exit once it find there is an old process of it running) what I do now is that when the script start it will check for a tmp file
php-general Digest 1 Nov 2006 01:18:08 -0000 Issue 4433
php-general Digest 1 Nov 2006 01:18:08 - Issue 4433 Topics (messages 243944 through 243979): Re: IIS Rewrite or Mod_Rewrite 243944 by: Jochem Maas 243948 by: Kevin Re: PHP Memory Allocation (checked via TOP) 243945 by: Jon Anderson Re: No Error Messages 243946 by: clive 243957 by: Richard Lynch 243967 by: Børge Holen Re: Imagecopyresampled creates black pictures 243947 by: Martin Hochreiter [ACIDIC HUMOR] Re: [PHP] IIS Rewrite or Mod_Rewrite 243949 by: Jochem Maas 243950 by: Stut Re: Decide witch table within a union 243951 by: Ed Lazor Re: Stupid question of the day (Editing text file in $HOME via web) 243952 by: Ed Lazor 243962 by: Richard Lynch Re: Run script every 30 seconds 243953 by: Ed Lazor Re: channels attribute value returns wrong 243954 by: Ed Lazor Re: Is there such a thing? 243955 by: Rory Browne 243956 by: Jay Blanchard 243958 by: Ed Lazor Sorting Multidimensional Array 243959 by: Keith Spiller 243966 by: Richard Lynch 243968 by: Keith Spiller Re: counting records in db 243960 by: Richard Lynch 243965 by: Robert Cummings Re: need help with foreach 243961 by: Richard Lynch Re: only one at atime 243963 by: Richard Lynch 243970 by: Ed Lazor Re: How do I get ini_set('output_handler', '') to work?! 243964 by: Richard Lynch 243978 by: Daevid Vincent Re: PHP IMAP with Attachments!? 243969 by: Manuel Lemos Manually Inserted Row 243971 by: Keith Spiller 243975 by: Børge Holen Remote Robot Control with PHP 243972 by: Prathaban Mookiah 243973 by: Dan McCullough 243976 by: Manuel Lemos Add buttons on the fly 243974 by: Wang Chen 243977 by: Chris 301 redirect returning 302 instead 243979 by: ianevans.digitalhit.com 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--- Kevin wrote: Hi, I have created a website which is using the iis rewrite module to write the following: index.php?tn_id=5ln_id=4 to something like /contact/directions.html and this works fine however I have a link at the bottom which needs to pass another variable through the query string before it would simply be: index.php?tn_id=5ln_id=4ts=75 however if i run /contact/directions.html?ts=75 it doesn't work and comes up with a 404 page not found error. Is there anyway around this? yes Apache, are you allowed/able to use apache? Thanks Kevin ---End Message--- ---BeginMessage--- Jochem Maas wrote: Kevin wrote: Hi, I have created a website which is using the iis rewrite module to write the following: index.php?tn_id=5ln_id=4 to something like /contact/directions.html and this works fine however I have a link at the bottom which needs to pass another variable through the query string before it would simply be: index.php?tn_id=5ln_id=4ts=75 however if i run /contact/directions.html?ts=75 it doesn't work and comes up with a 404 page not found error. Is there anyway around this? yes Apache, are you allowed/able to use apache? Thanks Kevin no only allowed to use windows server ---End Message--- ---BeginMessage--- Cabbar Duzayak wrote: Hi, I have written a simple test program to see how php allocates memory. Test code allocates ~10 Meg of RAM in an array within a loop till it runs out of memory as: $str = rand(65, 95) . rand(65, 95) . rand(65, 95) . rand(65, 95) . rand(65, 95); $aa[] = str_repeat($str, 200); What I don't understand here is, for every 10 Meg memory it allocates, mem usage goes up about 19 Megs when I look at this via top. Just looked over this really quickly, so I might have missed something, but it seems to me that you're allocating almost 20 megs... your $str is 10 bytes long (plus terminator and PHP overhead, whatever that turns out to be...), and you're repeating it two million times. 10 bytes times 2 million is 20 million bytes. 20 000 000 divided by (1024*1024) is 19.07 - it seems to me that you're allocating 19.07 megs, and top is showing you that it's allocating 19 megs...? Seems about right. jon ---End Message--- ---BeginMessage--- Sancar Saran wrote: If page has some errors it stop producing any error messages. Neither page nor syslog. have you looked at the error_reporting setting in your php.ini file. perhaps set it too E_ALL, mine was set to E_ALL ~E_NOTICE by default on ubuntu 6.10. ---End Message--- ---BeginMessage--- On Tue, October 31, 2006 6:24 am, Sancar Saran wrote: If page has some errors it stop producing any error messages. Neither page nor syslog.
[PHP] IIS Rewrite or Mod_Rewrite
Hi, I have created a website which is using the iis rewrite module to write the following: index.php?tn_id=5ln_id=4 to something like /contact/directions.html and this works fine however I have a link at the bottom which needs to pass another variable through the query string before it would simply be: index.php?tn_id=5ln_id=4ts=75 however if i run /contact/directions.html?ts=75 it doesn't work and comes up with a 404 page not found error. Is there anyway around this? Thanks Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Memory Allocation (checked via TOP)
Hi, I have written a simple test program to see how php allocates memory. Test code allocates ~10 Meg of RAM in an array within a loop till it runs out of memory as: $str = rand(65, 95) . rand(65, 95) . rand(65, 95) . rand(65, 95) . rand(65, 95); $aa[] = str_repeat($str, 200); What I don't understand here is, for every 10 Meg memory it allocates, mem usage goes up about 19 Megs when I look at this via top. Basically, it allocates from physical memory in the beginning, starts using swap when it is out of RES/Physical memory, which makes me assume that garbage collection should kick in for temporary string creations, and each new allocation increases the allocated memory size by 19 Megs. Any idea why this is happening, and why do you think memory allocation is so expensive in PHP? Thanks.. Results of TOP: PID USER PR NI VIRT RES SHR S %CPU %MEMTIME+ COMMAND 21843 apache17 0 19292 5232 3832 S 0.0 0.5 0:00.04 php 21843 apache16 0 38824 24m 3908 S 0.0 2.4 0:00.10 php 21843 apache15 0 58356 43m 3912 S 0.0 4.3 0:00.17 php 21843 apache16 0 77888 62m 3912 S 0.0 6.2 0:00.22 php 21843 apache15 0 97420 81m 3912 S 0.0 8.1 0:00.29 php 21843 apache15 0 114m 100m 3912 S 0.0 9.9 0:00.35 php Results of free -m: total used free sharedbuffers cached Mem: 1011138872 0 2 58 Swap: 2008388 1619 Mem: 1011158852 0 2 58 Swap: 2008388 1619 Mem: 1011177833 0 2 58 Swap: 2008388 1619 Mem: 1011196814 0 2 58 Swap: 2008388 1619 Mem: 1011216795 0 2 58 Swap: 2008388 1619 Mem: 1011234776 0 2 58 Swap: 2008388 1619 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Memory Allocation (checked via TOP)
As a side note, even though user is shown as apache, this code was executed from command line. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] counting records in db
On Mon, 30 Oct 2006 12:28:29 +0100, Robin Vickery wrote: On 30/10/06, Ivo F.A.C. Fokkema [EMAIL PROTECTED] wrote: On Sun, 29 Oct 2006 23:40:47 -0600, Richard Lynch wrote: On Fri, October 27, 2006 4:53 pm, Børge Holen wrote: On Friday 27 October 2006 19:34, Richard Lynch wrote: And the header(Location: ...) requires a full URL. No it doesn't. but he's missing an ' at first glance Yes, it does: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30 Note the use of 'absolute' within that section. Although I always use a full URL as well, doesn't absolute just mean non-relative? As in: Location: /Protocols/rfc2616/rfc2616-sec14.html#sec14.30 (absolute URI) Location: ./rfc2616-sec14.html#sec14.30 (relative URI) If you need contextual information to make sense of the URI (such as the server name from a previous request) then it's not absolute. RFC 2396: Uniform Resource Identifiers An absolute identifier refers to a resource independent of the context in which the identifier is used. In contrast, a relative identifier refers to a resource by describing the difference within a hierarchical namespace between the current context and an absolute identifier of the resource. Ah, thanks. I was confusing it with absolute and relative paths. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] need help with foreach
I want to tell the server to do 2 things when I click on the jobType link. This is the code that I have now which displays the art when I click on jobType foreach($row as $jobType) { $row = mysql_fetch_array($result2,MYSQL_ASSOC); echo a href=client.php?art=.$row['pix']. border='0'{$row ['jobType']}/a\n; } I now want to, with the same click, also show the url if I have a url for that jobType in my database column called url. Thank you for any help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] only one at atime
We have a virtual stock exchange site (for learning purpose) we put all the bids and offers in a table and every minute we run the php script to make the exchange but my customer want to make it less than 1 minute On 10/31/06, Ed Lazor [EMAIL PROTECTED] wrote: On Oct 30, 2006, at 10:14 AM, Ahmad Al-Twaijiry wrote: Hi everyone, I create a php script that will run every minute (by cronjob) and update some database tables (php 5, database mysql 5, tables type innodb) the problem is that I want this script to run only one at atime (only one process from this script can run ) for example, if the cronjob start the script and the script takes more than one minute, then after this one minute the cronjob start another process from this script, it should exit once it find there is an old process of it running) what I do now is that when the script start it will check for a tmp file (/tmp/script.pid) and if it fine it it will exit. if the file (/tmp/script.pid) is not exists, it will create it and start doing the database update and when the script finish it will remove the file any better idea ? It sounds like how I'd approach it, but it depends somewhat on the type of updates your script is performing and how busy your website is. Plus, I'm curious, what kind of updates are needing to occur every 30 seconds? And, if your scripts are at risk of running for more than 30 seconds, does this mean that the volume of data you're working with end up building upon itself? Just wondering, because it sounds like you could end up hammering your database server. -Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] need help with foreach
Its not very clear what you want to achieve with that code snippet. If you are pulling database rows out of your database with mysql_fetch_array(), then you do not need a foreach loop. I think you may want something like this, but without knowing your database table structure and the query you have used it is only a guess. while($row = mysql_fetch_array($result2,MYSQL_ASSOC)){ echo a href=client.php?art=.$row['pix']. border='0'{$row['jobType']}/a\n; if($row['url']!='')echo html to use with .$row['url']; } On 31/10/2006 10:09 [EMAIL PROTECTED] wrote: I want to tell the server to do 2 things when I click on the jobType link. This is the code that I have now which displays the art when I click on jobType foreach($row as $jobType) { $row = mysql_fetch_array($result2,MYSQL_ASSOC); echo a href=client.php?art=.$row['pix']. border='0'{$row['jobType']}/a\n; } I now want to, with the same click, also show the url if I have a url for that jobType in my database column called url. Thank you for any help. --PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] counting records in db
# [EMAIL PROTECTED] / 2006-10-27 20:14:58 +0200: And the header(Location: ...) requires a full URL. Why? HTTP protocol specification[1] says: 14.30 Location The Location response-header field is used to redirect the recipient to a location other than the Request-URI for completion of the request or identification of a new resource. For 201 (Created) responses, the Location is that of the new resource which was created by the request. For 3xx responses, the location SHOULD indicate the server's preferred URI for automatic redirection to the resource. The field value consists of a single absolute URI. Location = Location : absoluteURI An example is: Location: http://www.w3.org/pub/WWW/People.html Note: The Content-Location header field (section 14.14) differs from Location in that the Content-Location identifies the original location of the entity enclosed in the request. It is therefore possible for a response to contain header fields for both Location and Content-Location. Also see section 13.10 for cache requirements of some methods. [1] ftp://ftp.rfc-editor.org/in-notes/rfc2616.txt -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Run script every 30 seconds
yes, I think you can call it ,semi-real-time monitoring because we want the script when it run it should read some records in database and update other records On 10/31/06, Ed Lazor [EMAIL PROTECTED] wrote: On Oct 30, 2006, at 10:26 AM, Ahmad Al-Twaijiry wrote: is it possible to link the script to my php interface (the one that the users is using it) and if the php interface page will run the script (IN background) if it didn't run for the last 30 seconds ? I see this is very hard and almost impossible , what do you think ? PS: also I need to make sure no more than 1 process of the script is running :) Hi Ahmad. Could you describe what your script is doing? What type of information are you wanting users to see? Is this some sort of status page? Is it some sort of semi-real-time monitoring? -Ed -- Ahmad http://www.v-tadawul.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] only one at atime
BTW: we use PDO functions to connect to the database and we also made the tables innodb type so if we use $dbh-beginTransaction(); is it will be safe to run the script more than one in the same time ? On 10/31/06, Ahmad Al-Twaijiry [EMAIL PROTECTED] wrote: We have a virtual stock exchange site (for learning purpose) we put all the bids and offers in a table and every minute we run the php script to make the exchange but my customer want to make it less than 1 minute On 10/31/06, Ed Lazor [EMAIL PROTECTED] wrote: On Oct 30, 2006, at 10:14 AM, Ahmad Al-Twaijiry wrote: Hi everyone, I create a php script that will run every minute (by cronjob) and update some database tables (php 5, database mysql 5, tables type innodb) the problem is that I want this script to run only one at atime (only one process from this script can run ) for example, if the cronjob start the script and the script takes more than one minute, then after this one minute the cronjob start another process from this script, it should exit once it find there is an old process of it running) what I do now is that when the script start it will check for a tmp file (/tmp/script.pid) and if it fine it it will exit. if the file (/tmp/script.pid) is not exists, it will create it and start doing the database update and when the script finish it will remove the file any better idea ? It sounds like how I'd approach it, but it depends somewhat on the type of updates your script is performing and how busy your website is. Plus, I'm curious, what kind of updates are needing to occur every 30 seconds? And, if your scripts are at risk of running for more than 30 seconds, does this mean that the volume of data you're working with end up building upon itself? Just wondering, because it sounds like you could end up hammering your database server. -Ed -- Ahmad http://www.v-tadawul.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] counting records in db
On 30/10/06, Robert Cummings [EMAIL PROTECTED] wrote: On Mon, 2006-10-30 at 12:28 +0100, Robin Vickery wrote: On 30/10/06, Ivo F.A.C. Fokkema [EMAIL PROTECTED] wrote: On Sun, 29 Oct 2006 23:40:47 -0600, Richard Lynch wrote: On Fri, October 27, 2006 4:53 pm, Børge Holen wrote: On Friday 27 October 2006 19:34, Richard Lynch wrote: And the header(Location: ...) requires a full URL. No it doesn't. but he's missing an ' at first glance Yes, it does: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30 Note the use of 'absolute' within that section. Although I always use a full URL as well, doesn't absolute just mean non-relative? As in: Location: /Protocols/rfc2616/rfc2616-sec14.html#sec14.30 (absolute URI) Location: ./rfc2616-sec14.html#sec14.30 (relative URI) If you need contextual information to make sense of the URI (such as the server name from a previous request) then it's not absolute. RFC 2396: Uniform Resource Identifiers An absolute identifier refers to a resource independent of the context in which the identifier is used. In contrast, a relative identifier refers to a resource by describing the difference within a hierarchical namespace between the current context and an absolute identifier of the resource. Please note you are quoting from an RFC with the following title: Uniform Resource Identifiers (URI): Generic Syntax Pay special attention to Generic Syntax in the title. The RFC linked by Richard clearly indicates that for the Location response-header that the field value consists of a single absolute URI. This currently has the final word for the Location response-header and therefore is the standard. What? Pay special attention to what I wrote. I wasn't disagreeing with Richard, or the RFC he quoted. The OP expressed some confusion about what comprised an 'absolute URI' so I quoted the section of the RFC that defined an 'absolute URI'. There's no question that a Location header should contain an absolute URI as its value. -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] channels attribute value returns wrong
Hello, using function getimagesize(); I am trying to get channels attribute value of image, it returns 3 for cmyk image actually it should return 4, can you tell me why it happens so? regds. dmt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP IMAP with Attachments!?
Hi to all, I need a class that reads emails from a server and reads the attachments from the mail. The mailservers is an IMAP for mail reading. The attachment types can be: images/pdf/text documents. Any suggestions? On phpclasses.org did not find any which works well. Regards, Andy.
[PHP] No Error Messages
Hi, Recenly I face very disturbing problem. If page has some errors it stop producing any error messages. Neither page nor syslog. I get blank page. System Debian Unstable Apache 2 Php 5.1.6 Apc Memcached Obhandler with gzip and I store entire page output then printed out. And I found if my error on first pages there was no problem, error message show in page and syslog and if that eroor is in included files. I get absolutely Nothing. Does any one give any clue about it. Regards Sancar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] No Error Messages
Sancar Saran wrote: If page has some errors it stop producing any error messages. Neither page nor syslog. have you looked at the error_reporting setting in your php.ini file. perhaps set it too E_ALL, mine was set to E_ALL ~E_NOTICE by default on ubuntu 6.10. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Imagecopyresampled creates black pictures
Tedd, may I ask you what GD library version and php version are you using? I am using: php5-5.1.2 gd-2.0.32-23 All Suse 10.1 machines using that versions and on all that machines I have the same problem ... lg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IIS Rewrite or Mod_Rewrite
Jochem Maas wrote: Kevin wrote: Hi, I have created a website which is using the iis rewrite module to write the following: index.php?tn_id=5ln_id=4 to something like /contact/directions.html and this works fine however I have a link at the bottom which needs to pass another variable through the query string before it would simply be: index.php?tn_id=5ln_id=4ts=75 however if i run /contact/directions.html?ts=75 it doesn't work and comes up with a 404 page not found error. Is there anyway around this? yes Apache, are you allowed/able to use apache? Thanks Kevin no only allowed to use windows server -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Stupid question of the day (Editing text file in $HOME via web)
On Oct 30, 2006, at 11:34 PM, Google Kreme wrote: So, do I whack up something where I just load the file into a HTML Textarea and then write it back (simple enough, though possibly rather dangerous), or is there something straightforward I should go ahead and use that might find use elsewhere on the server? Playing Devils Advocate here, but why not store the text in a database? The text file should be somewhat secure if you're manually reading and writing to it in PHP, making sure that you're the one controlling the file name, the file extension (file type), the file permissions, and the file size. -Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Run script every 30 seconds
On Oct 31, 2006, at 2:48 AM, Ahmad Al-Twaijiry wrote: yes, I think you can call it ,semi-real-time monitoring because we want the script when it run it should read some records in database and update other records That's kind of vague. I'm not able to give better advice without more information, but it does sound like you'll eventually run into some bottlenecks as system usage increases ( and fairly quickly if you're collecting data every 30 seconds). -Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there such a thing?
Do these qualify? http://www.roadsend.com/home/index.php?SMC=1pageID=compiler http://www.priadoblender.com It would be helpful if people would read the link the OP provided, as opposed to just the URL to that link. The page isn't about compiling PHP source into a binary. It's about creating a method of using web applications ( php ) without the help of a seperate web-server.
Re: [PHP] PHP Memory Allocation (checked via TOP)
Cabbar Duzayak wrote: Hi, I have written a simple test program to see how php allocates memory. Test code allocates ~10 Meg of RAM in an array within a loop till it runs out of memory as: $str = rand(65, 95) . rand(65, 95) . rand(65, 95) . rand(65, 95) . rand(65, 95); $aa[] = str_repeat($str, 200); What I don't understand here is, for every 10 Meg memory it allocates, mem usage goes up about 19 Megs when I look at this via top. Just looked over this really quickly, so I might have missed something, but it seems to me that you're allocating almost 20 megs... your $str is 10 bytes long (plus terminator and PHP overhead, whatever that turns out to be...), and you're repeating it two million times. 10 bytes times 2 million is 20 million bytes. 20 000 000 divided by (1024*1024) is 19.07 - it seems to me that you're allocating 19.07 megs, and top is showing you that it's allocating 19 megs...? Seems about right. jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Stupid question of the day (Editing text file in $HOME via web)
On Tue, October 31, 2006 1:34 am, Google Kreme wrote: So, do I whack up something where I just load the file into a HTML Textarea and then write it back (simple enough, though possibly rather dangerous), or is there something straightforward I should go ahead and use that might find use elsewhere on the server? The unanswered question is: How many people might try to edit it at once, and what will you do to resolve race conditions? Whipping up a TEXTAREA for a single admin person who is in charge of this file, and the only one to edit it under normal circumstances, would work fine. Doing that for a team of 100 people who have access to this file will end up with somebody very cranky when their 1000-entry addition got over-written by another user fixing a small typo. Other solutions to consider: 1. Put the file in a database as individual (AAA) XXX- records, and the file can be generated from the DB every time it changes with a trigger, or every day or something reasonable. Having individual records for each line reduces the damage of the race condition to a single entry needing to be re-done. You can also more easily find code to handle the race condition for the DB in a web environment. 2. Put the file into subversion or CVS, if all editors are developers. 3. Forget the web interface, because the file won't really change that often anyway, and just use 'vi' to make the rare change. :-) There likely *IS* a web tool out there just like you want... My first guess would be to check out the various panel solutions for having a web interface that webhosts provide to edit what is essentially a simple text file, which configures the web server, mail server, ftp server, etc. These all have all the exact same issues you will face, so there might be one that fits your needs. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Decide witch table within a union
On Oct 30, 2006, at 9:20 PM, Børge Holen wrote: On Tuesday 31 October 2006 02:27, Ed Lazor wrote: Someone asked what it was to be used for. It's for combining 4 forums into one witch shows the latest movement among them. More like an introduction sort of... Sounds cool. Are you using a pre-made forum package? No Maby it'd been easier, I did that at first... But not much to learn using other ppls tools. True, a good challenge is always fun :) -Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sorting Multidimensional Array
On Tue, October 31, 2006 11:10 am, Keith Spiller wrote: RE: Sorting Multidimensional Array I'm trying to sort a multidimensional array. The data was taken from a mysql query: $myrow = mysql_fetch_row($result) { query[] = $myrow; } The purpose is to retrieve the table data and manually add a record, then sort ASC by the startdate which is the forth field... Something like: $test = array_multisort($query, $key = '$query[4]'); Any help would be greatly appreciated. Thanks, Don't do that. :-) For starters, sorting in PHP is MUCH less efficient than in a DB. Secondly, getting multi-dimensional (sic) arrays in PHP to sort like you want generates a ton of traffic here, so it must be hard. :-) You can do somethig like this: (SELECT x, y, z FROM real_data UNION SELECT 'manually', 'inserted', 'data' as z ) ORDER BY z And achieve MUCH better results with far less headache. If 'z' is indexed in real_data, add another ORDER BY z right before the UNION -- That will probably make it very fast/easy for the DB to splice in your manually-inserted 'z' value. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] channels attribute value returns wrong
Just getting, but is there a 0, 1, 2, and 3 channel? On Oct 31, 2006, at 3:10 AM, dhatri gmail wrote: Hello, using function getimagesize(); I am trying to get channels attribute value of image, it returns 3 for cmyk image actually it should return 4, can you tell me why it happens so? regds. dmt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IIS Rewrite or Mod_Rewrite
Kevin wrote: Hi, I have created a website which is using the iis rewrite module to write the following: index.php?tn_id=5ln_id=4 to something like /contact/directions.html and this works fine however I have a link at the bottom which needs to pass another variable through the query string before it would simply be: index.php?tn_id=5ln_id=4ts=75 however if i run /contact/directions.html?ts=75 it doesn't work and comes up with a 404 page not found error. Is there anyway around this? yes Apache, are you allowed/able to use apache? Thanks Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] No Error Messages
Sancar Saran wrote: Hi, Recenly I face very disturbing problem. If page has some errors it stop producing any error messages. Neither page nor syslog. I get blank page. System Debian Unstable Apache 2 Php 5.1.6 Apc Memcached Obhandler with gzip and I store entire page output then printed out. And I found if my error on first pages there was no problem, error message show in page and syslog and if that eroor is in included files. I get absolutely Nothing. Does any one give any clue about it. probably your error_reporting level or display_errors setting is not what you think it is at the time the include occurs/runs. alternatively something (3rd party) maybe setting an error handler that is trapping your errors but not showing/logging them lastly maybe your output buffer is the problem ... you might try a registering a shutdown function that clears/outputs all buffers so that it is run even if an error occurs. Regards Sancar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [ACIDIC HUMOR] Re: [PHP] IIS Rewrite or Mod_Rewrite
Jochem Maas wrote: Kevin wrote: Jochem Maas wrote: yes Apache, are you allowed/able to use apache? no only allowed to use windows server ah and I see your company lives off ill-managed/spent NHS-pork - i.e. the latest bullshit multi-billion pound NHS IT overhaul with a zero net gain in efficiency or insight for end users (you know, nurses, doctors, people actually practice medicine) but plenty of new managerial posts to supervise all the fantastic (read: over budget and behind schedule) new IT projects. governments should run their core IT infrastructures on proprietary, buggy (and overly expensive) software (especially not when said enterprise has been found guilt of anti-trust violations in multiple regions) given that I know kust enough about IIS to stay away from it I can only recommend that you get yourself a better* job * better as in less morally abhorent, rather better as in more money - although if you can achieve both all the better for you :-) Plus, being forced to use Windows is not a reason not to use Apache!! -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sorting Multidimensional Array
Thanks Richard, But wouldn't order by z interfere with my original order by values? My code is as follows: $fields1 = ID, Title, Label, Location, Start, End, Time, ; $fields1 .= Description, Organization, Department, Contact, ; $fields1 .= Phone, Email, Global, Board, Committee, Status, TBD_Time ; $command = SELECT $fields1, TO_DAYS(End) - TO_DAYS(Start) + 1 AS Days ; $command .= FROM $tablename ; $command .= $WHERETXT ORDER BY $sortby $sortorder ; I just need to add a new record, but I have to use PHP because the Start and End dates for that record must match the current month... If I could add the record to the Select statement as you suggest that would be wonderful. Keith - Original Message - From: Richard Lynch [EMAIL PROTECTED] To: Keith Spiller [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Tuesday, October 31, 2006 10:48 AM Subject: Re: [PHP] Sorting Multidimensional Array On Tue, October 31, 2006 11:10 am, Keith Spiller wrote: RE: Sorting Multidimensional Array I'm trying to sort a multidimensional array. The data was taken from a mysql query: $myrow = mysql_fetch_row($result) { query[] = $myrow; } The purpose is to retrieve the table data and manually add a record, then sort ASC by the startdate which is the forth field... Something like: $test = array_multisort($query, $key = '$query[4]'); Any help would be greatly appreciated. Thanks, Don't do that. :-) For starters, sorting in PHP is MUCH less efficient than in a DB. Secondly, getting multi-dimensional (sic) arrays in PHP to sort like you want generates a ton of traffic here, so it must be hard. :-) You can do somethig like this: (SELECT x, y, z FROM real_data UNION SELECT 'manually', 'inserted', 'data' as z ) ORDER BY z And achieve MUCH better results with far less headache. If 'z' is indexed in real_data, add another ORDER BY z right before the UNION -- That will probably make it very fast/easy for the DB to splice in your manually-inserted 'z' value. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sorting Multidimensional Array
Hi, RE: Sorting Multidimensional Array I'm trying to sort a multidimensional array. The data was taken from a mysql query: $myrow = mysql_fetch_row($result) { query[] = $myrow; } The purpose is to retrieve the table data and manually add a record, then sort ASC by the startdate which is the forth field... Something like: $test = array_multisort($query, $key = '$query[4]'); Any help would be greatly appreciated. Thanks, Keith -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] need help with foreach
On Tue, October 31, 2006 4:09 am, [EMAIL PROTECTED] wrote: I want to tell the server to do 2 things when I click on the jobType link. This is the code that I have now which displays the art when I click on jobType foreach($row as $jobType) { $row = mysql_fetch_array($result2,MYSQL_ASSOC); echo a href=client.php?art=.$row['pix']. border='0'{$row ['jobType']}/a\n; echo a href=\$row[url]\$row[url]/a\n; I now want to, with the same click, also show the url if I have a url for that jobType in my database column called url. I'm assuming you don't mean that you want the user to see the image and then be auto-forwarded to the 'url' from the db... That's a fish of a different color. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] only one at atime
On Tue, October 31, 2006 4:50 am, Ahmad Al-Twaijiry wrote: we use PDO functions to connect to the database and we also made the tables innodb type so if we use $dbh-beginTransaction(); is it will be safe to run the script more than one in the same time ? It should be safe from the standpoint of the transaction model. But it may or may not be safe from the standpoint of your DB server getting swamped and bogged down with transactions driving it to its death in 60 seconds... Transactions do not alter the Laws of Physics. Your DB can only handle so many operations per second, and doing more than that will kill it. Actually, Transactions add SIGNIFICANT overhead, and if raw speed is the primary goal, finding a way to avoid full-blown transactions, and only doing the minimum necessary for your specific transaction-like needs is the way to go, most likely. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How do I get ini_set('output_handler', '') to work?!
On Mon, October 30, 2006 7:19 pm, Daevid Vincent wrote: Thank you for the reply Richard (and Tom). That news sucks however. Seems that the PHP pre-parser should handle this better. It's not like it's a one-pass parser (like Ruby). ?php ini_set('output_handler', 'mb_output_handler'); echo \noutput_handler = . ini_get('output_handler') . \n; ? I suppose I could re-compile my command line version with a different php.ini file, but that's kind of lame that I have to have two php.ini files for what ini_set() SHOULD handle. There is nothing to re-compile here. The command line has an existing flag for you to specify the php.ini file, or to override any setting[s] within the php.ini file. What other undocumented gotchas are there with ini_set() I wonder... Most of these ARE documented in that PER INI DIR page on php.net This one probably is as well. Bottom line, you can't step in the same river twice, and if php.ini tells PHP to set up an ob_* handler before your script runs, it's impossible to undo that just because you changed a setting that's already been acted upon. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Is there such a thing?
[snip] The page isn't about compiling PHP source into a binary. It's about creating a method of using web applications ( php ) without the help of a seperate web-server. [/snip] That is an oxymoron, a web app w/o a web-server? The items mentioned have built-in webservers which is as close to not having a separate web server as you can get for a web app. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] counting records in db
On Tue, October 31, 2006 4:58 am, Robin Vickery wrote: On 30/10/06, Robert Cummings [EMAIL PROTECTED] wrote: On Mon, 2006-10-30 at 12:28 +0100, Robin Vickery wrote: On 30/10/06, Ivo F.A.C. Fokkema [EMAIL PROTECTED] wrote: On Sun, 29 Oct 2006 23:40:47 -0600, Richard Lynch wrote: On Fri, October 27, 2006 4:53 pm, Børge Holen wrote: On Friday 27 October 2006 19:34, Richard Lynch wrote: And the header(Location: ...) requires a full URL. No it doesn't. but he's missing an ' at first glance Yes, it does: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30 Note the use of 'absolute' within that section. Although I always use a full URL as well, doesn't absolute just mean non-relative? As in: Location: /Protocols/rfc2616/rfc2616-sec14.html#sec14.30 (absolute URI) Location: ./rfc2616-sec14.html#sec14.30 (relative URI) If you need contextual information to make sense of the URI (such as the server name from a previous request) then it's not absolute. RFC 2396: Uniform Resource Identifiers An absolute identifier refers to a resource independent of the context in which the identifier is used. In contrast, a relative identifier refers to a resource by describing the difference within a hierarchical namespace between the current context and an absolute identifier of the resource. Please note you are quoting from an RFC with the following title: Uniform Resource Identifiers (URI): Generic Syntax Pay special attention to Generic Syntax in the title. The RFC linked by Richard clearly indicates that for the Location response-header that the field value consists of a single absolute URI. This currently has the final word for the Location response-header and therefore is the standard. Please note that the link I posted is part of this document: http://www.w3.org/Protocols/rfc2616/rfc2616.html Also note that THIS section of that document: http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.2.1 clearly states: For definitive information on URL syntax and semantics, see Uniform Resource Identifiers (URI): Generic Syntax and Semantics, and provides a link to: http://www.w3.org/Protocols/rfc2616/rfc2616-sec17.html#bib42 which in turn links to: http://www.ietf.org/rfc/rfc2396.txt which is, in fact, the document cited. Are we all on the same page now? Is there any doubt in anybody's mind that the standards clearly require an absoluteURI, complete with scheme (e.g., http://)? :-) :-) :-) I just wanted to make it clear to any newbie reader whose wishful thinking was leading them astray that they should NOT rely on a non-absolute URI if they want to be standards-compliant. It is rare that one cannot take an extra few seconds and compose the standards-compliant URI. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there such a thing?
On Oct 31, 2006, at 8:25 AM, Rory Browne wrote: It would be helpful if people would read the link the OP provided, as opposed to just the URL to that link. The page isn't about compiling PHP source into a binary. It's about creating a method of using web applications ( php ) without the help of a seperate web-server. I could be wrong, because I haven't used them, but I do think that some of the links I sent do what you're looking for. For example, one of the links had information about storing the executables on CD for distributing presentations. Good news tho, if those don't work for you, odds are good that you're not going to find what you're looking for... mainly because PHP is designed to be an interpretive web language and there are other tools more suited for what you're trying to accomplish. -Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] counting records in db
On Tue, 2006-10-31 at 11:58 +0100, Robin Vickery wrote: On 30/10/06, Robert Cummings [EMAIL PROTECTED] wrote: On Mon, 2006-10-30 at 12:28 +0100, Robin Vickery wrote: On 30/10/06, Ivo F.A.C. Fokkema [EMAIL PROTECTED] wrote: On Sun, 29 Oct 2006 23:40:47 -0600, Richard Lynch wrote: On Fri, October 27, 2006 4:53 pm, Børge Holen wrote: On Friday 27 October 2006 19:34, Richard Lynch wrote: And the header(Location: ...) requires a full URL. No it doesn't. but he's missing an ' at first glance Yes, it does: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30 Note the use of 'absolute' within that section. Although I always use a full URL as well, doesn't absolute just mean non-relative? As in: Location: /Protocols/rfc2616/rfc2616-sec14.html#sec14.30 (absolute URI) Location: ./rfc2616-sec14.html#sec14.30 (relative URI) If you need contextual information to make sense of the URI (such as the server name from a previous request) then it's not absolute. RFC 2396: Uniform Resource Identifiers An absolute identifier refers to a resource independent of the context in which the identifier is used. In contrast, a relative identifier refers to a resource by describing the difference within a hierarchical namespace between the current context and an absolute identifier of the resource. Please note you are quoting from an RFC with the following title: Uniform Resource Identifiers (URI): Generic Syntax Pay special attention to Generic Syntax in the title. The RFC linked by Richard clearly indicates that for the Location response-header that the field value consists of a single absolute URI. This currently has the final word for the Location response-header and therefore is the standard. What? Pay special attention to what I wrote. Seems a bit ambiguous :) I wasn't disagreeing with Richard, or the RFC he quoted. The OP expressed some confusion about what comprised an 'absolute URI' so I quoted the section of the RFC that defined an 'absolute URI'. There's no question that a Location header should contain an absolute URI as its value. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] No Error Messages
PHP 5.1 is broken in debian testing right now. Dunno 'bout Sid On Tuesday 31 October 2006 18:00, Richard Lynch wrote: On Tue, October 31, 2006 6:24 am, Sancar Saran wrote: If page has some errors it stop producing any error messages. Neither page nor syslog. I get blank page. If it's a fatal error, or one too serious to be trapped by an error handler, then your script will just stop. System Debian Unstable Apache 2 Php 5.1.6 Apc Memcached Obhandler with gzip and I store entire page output then printed out. You may have installed something which does something like: while (ob_get_level()) ob_end_flush(); And I found if my error on first pages there was no problem, error message show in page and syslog and if that eroor is in included files. I get absolutely Nothing. The included files could easily be re-setting your error handling, or an included file *BEFORE* the one you are examining could do it: ?php require 'include_file_that_resets_error_reporting.inc'; require 'include_file_that_generates_error_you_are_worried_about.inc'; ? PEAR error handling did this to me years ago, so I wasted more time figuring out what was going on than it would have taken me to solve the original problem I wanted PEAR for, and that's one of the reasons I never use PEAR much. [shrug] Back then, the PEAR error handler was tightly-woven into the whole thing. Or maybe I'm thinking of phpLib on that one... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- --- Børge Kennel Arivene http://www.arivene.net --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] No Error Messages
On Tue, October 31, 2006 6:24 am, Sancar Saran wrote: If page has some errors it stop producing any error messages. Neither page nor syslog. I get blank page. If it's a fatal error, or one too serious to be trapped by an error handler, then your script will just stop. System Debian Unstable Apache 2 Php 5.1.6 Apc Memcached Obhandler with gzip and I store entire page output then printed out. You may have installed something which does something like: while (ob_get_level()) ob_end_flush(); And I found if my error on first pages there was no problem, error message show in page and syslog and if that eroor is in included files. I get absolutely Nothing. The included files could easily be re-setting your error handling, or an included file *BEFORE* the one you are examining could do it: ?php require 'include_file_that_resets_error_reporting.inc'; require 'include_file_that_generates_error_you_are_worried_about.inc'; ? PEAR error handling did this to me years ago, so I wasted more time figuring out what was going on than it would have taken me to solve the original problem I wanted PEAR for, and that's one of the reasons I never use PEAR much. [shrug] Back then, the PEAR error handler was tightly-woven into the whole thing. Or maybe I'm thinking of phpLib on that one... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [ACIDIC HUMOR] Re: [PHP] IIS Rewrite or Mod_Rewrite
Kevin wrote: Jochem Maas wrote: Kevin wrote: Hi, I have created a website which is using the iis rewrite module to write the following: index.php?tn_id=5ln_id=4 to something like /contact/directions.html and this works fine however I have a link at the bottom which needs to pass another variable through the query string before it would simply be: index.php?tn_id=5ln_id=4ts=75 however if i run /contact/directions.html?ts=75 it doesn't work and comes up with a 404 page not found error. Is there anyway around this? yes Apache, are you allowed/able to use apache? Thanks Kevin no only allowed to use windows server ah and I see your company lives off ill-managed/spent NHS-pork - i.e. the latest bullshit multi-billion pound NHS IT overhaul with a zero net gain in efficiency or insight for end users (you know, nurses, doctors, people actually practice medicine) but plenty of new managerial posts to supervise all the fantastic (read: over budget and behind schedule) new IT projects. governments should run their core IT infrastructures on proprietary, buggy (and overly expensive) software (especially not when said enterprise has been found guilt of anti-trust violations in multiple regions) given that I know kust enough about IIS to stay away from it I can only recommend that you get yourself a better* job * better as in less morally abhorent, rather better as in more money - although if you can achieve both all the better for you :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP IMAP with Attachments!?
Hello, on 10/31/2006 01:36 PM Andy said the following: I need a class that reads emails from a server and reads the attachments from the mail. The mailservers is an IMAP for mail reading. The attachment types can be: images/pdf/text documents. Any suggestions? On phpclasses.org did not find any which works well. I think the PHP IMAP extension can do all you need, if you have it installed. Otherwise, you can just use pure PHP IMAP client class and the use this MIME message parser to extract the message body parts into a string or a separate file: http://www.phpclasses.org/mimeparser This gets the messages without using the PHP IMAP extension: http://www.phpclasses.org/imap -- Regards, Manuel Lemos Metastorage - Data object relational mapping layer generator http://www.metastorage.net/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] only one at atime
On Oct 31, 2006, at 2:29 AM, Ahmad Al-Twaijiry wrote: We have a virtual stock exchange site (for learning purpose) we put all the bids and offers in a table and every minute we run the php script to make the exchange but my customer want to make it less than 1 minute I can tell there's something I'm missing here. I suspect it has to do with the operation of how the bid/offer exchange process actually works. I'm assuming that the bid is the asking price for the stock, one bid will receive multiple offers, and your script sells the stock to the highest bidder within a given time frame. Is that right? -Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Manually Inserted Row
Hi, RE: Manually Inserted Row I'm using PHP to retrieve the values for the manual insert... I originally tried using an array created from the mysql query and adding one row manaually and then sorting the multidimensional array. As Richard pointed out, sorting using the database would be much more efficient. So here I am. Stuck again... (SELECT ID, Title, Label, Location, Start, End, Time, Description, Organization, Department, Contact, Phone, Email, Global, Board, Committee, Status, TBD_Time , TO_DAYS(End) - TO_DAYS(Start) + 1 AS Days FROM site_calendar_v2 UNION SELECT '9', 'No events exist for this month...', '', '', '', '-00-00', '00:00:00', '', '', '', '', '', '', '1', 'BOX', 'EOG', '', '', as z ) WHERE Board='BOX' AND Committee='EOG' ORDER BY z This fails. Any ideas how I can fix this manually inserted row? Thanks, Keith -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Remote Robot Control with PHP
Hello List, I thought of sharing my experience of writing a controller to remotely control a robot through a webserver using PHP. Though I could not use PHP alone to do the entire job due the high delay it takes to connect to the telnet port on the robot, (I adopted the PHPTelnet class written by Antone Roundy - http://www.geckotribe.com/php-telnet/), I could not resist using it for some part of the application. So the model I used for my purpose is this: Browser - WebServer - Java Robot AJAX PHP I used PHP to communicate between the Java program which I run in the background and the AJAX calls from the browser. This setup works fine for my purposes and satisifies the strict time constraints. If someone has a better idea of implementing this thing in PHP, please do let me know your comments. There is a lot more to do in this project and I hope to make use of PHP a lot along the way. This is a NSF funded project and this work will be published in some leading journals. What I am excited about is the prospect of putting in a word about PHP in these journals, since as far as I know, it is not too well known in the academic circles. Regards, Prathap -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Remote Robot Control with PHP
Cool! On 10/31/06, Prathaban Mookiah [EMAIL PROTECTED] wrote: Hello List, I thought of sharing my experience of writing a controller to remotely control a robot through a webserver using PHP. Though I could not use PHP alone to do the entire job due the high delay it takes to connect to the telnet port on the robot, (I adopted the PHPTelnet class written by Antone Roundy - http://www.geckotribe.com/php-telnet/), I could not resist using it for some part of the application. So the model I used for my purpose is this: Browser - WebServer - Java Robot AJAX PHP I used PHP to communicate between the Java program which I run in the background and the AJAX calls from the browser. This setup works fine for my purposes and satisifies the strict time constraints. If someone has a better idea of implementing this thing in PHP, please do let me know your comments. There is a lot more to do in this project and I hope to make use of PHP a lot along the way. This is a NSF funded project and this work will be published in some leading journals. What I am excited about is the prospect of putting in a word about PHP in these journals, since as far as I know, it is not too well known in the academic circles. Regards, Prathap -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Add buttons on the fly
I would like to add two buttons on a page form infomation confirmation, however, the html code in php nest can not be known by browser if I put form xxx input xx /form into there. Besically, there is a mail form to enter iterm infomaiton, if it exist before, prompt its iterm id., if it is new, query a next available inerm id for it, then, show a page to ask such as, do you accept this id?, two buttons below this question, yes and no. Is there any fountion in php which can make it? Thanks.
Re: [PHP] Manually Inserted Row
Have a look at my (and others previous mails) with the Topic : Decide witch table within a union There you'll find my orginal post with a working union, easy to figure out how it works. Hi, RE: Manually Inserted Row I'm using PHP to retrieve the values for the manual insert... I originally tried using an array created from the mysql query and adding one row manaually and then sorting the multidimensional array. As Richard pointed out, sorting using the database would be much more efficient. So here I am. Stuck again... (SELECT ID, Title, Label, Location, Start, End, Time, Description, Organization, Department, Contact, Phone, Email, Global, Board, Committee, Status, TBD_Time , TO_DAYS(End) - TO_DAYS(Start) + 1 AS Days FROM site_calendar_v2 UNION SELECT '9', 'No events exist for this month...', '', '', '', '-00-00', '00:00:00', '', '', '', '', '', '', '1', 'BOX', 'EOG', '', '', as z ) WHERE Board='BOX' AND Committee='EOG' ORDER BY z This fails. Any ideas how I can fix this manually inserted row? Thanks, Keith -- --- Børge Kennel Arivene http://www.arivene.net --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Remote Robot Control with PHP
Hello, on 10/31/2006 10:54 PM Prathaban Mookiah said the following: I thought of sharing my experience of writing a controller to remotely control a robot through a webserver using PHP. Though I could not use PHP alone to do the entire job due the high delay it takes to connect to the telnet port on the robot, (I adopted the PHPTelnet class written by Antone Roundy - http://www.geckotribe.com/php-telnet/), I could not resist using it for some part of the application. I am not sure why you have such an high delay to connect to the robot. Anyway, you may want to take advantage of the fact that PHP supports persistent socket connections using the pfsockopen function. This certainly avoids the overhead of establishing a socket connection on every request. So the model I used for my purpose is this: Browser - WebServer - Java Robot AJAX PHP I used PHP to communicate between the Java program which I run in the background and the AJAX calls from the browser. This setup works fine for my purposes and satisifies the strict time constraints. If someone has a better idea of implementing this thing in PHP, please do let me know your comments. For using AJAX, you may want to take a look at this forms class. It comes with a plug-in that lets you submit forms without reloading the current page. It uses an AJAX approach named COMET. This may be important for your project because in COMET applications the browser establishes a single connection to the Web server and uses it to return multiple responses from the server without reconnecting. COMET is great in particular for monitoring server site activity that may take a long time to finish. While the activity is not finished, the server can send new messages to update the browser. http://www.phpclasses.org/formsgeneration There is a lot more to say about COMET based responsive PHP AJAX applications. You may want to read about it here: http://www.phpclasses.org/blog/post/58-Responsive-AJAX-applications-with-COMET.html -- Regards, Manuel Lemos Metastorage - Data object relational mapping layer generator http://www.metastorage.net/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Add buttons on the fly
Wang Chen wrote: I would like to add two buttons on a page form infomation confirmation, however, the html code in php nest can not be known by browser if I put form xxx input xx /form into there. Besically, there is a mail form to enter iterm infomaiton, if it exist before, prompt its iterm id., if it is new, query a next available inerm id for it, then, show a page to ask such as, do you accept this id?, two buttons below this question, yes and no. PHP only works server side. Once the page is generated, php's job is done. To change anything once it's already there, you need javascript (probably an AJAX type solution so you post a question, get the answer back and decide what to do in javascript). -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How do I get ini_set('output_handler', '') to work?!
There is nothing to re-compile here. The command line has an existing flag for you to specify the php.ini file, or to override any setting[s] within the php.ini file. Mebbe so, but that's equally obnoxious to pass this command line parameter to a lot of existing scripts. It's just easier to re-compile and 'globally' set the output_handler in a different php.ini file to what it used to be before we optimized. This script issue has just started to rear it's ugly head as we used to just use the default handler till recently. Our web pages work great (obviously), but we've noticed strangeness with the CLI stuff. Hence this dilemna. Bottom line, you can't step in the same river twice, and if php.ini tells PHP to set up an ob_* handler before your script runs, it's impossible to undo that just because you changed a setting that's already been acted upon. I would agree if PHP used a one-pass parser. But there is a pre-parsing to lint check and other 'setup' stuff. Seems that could utilize and prepare the set_ini() for the second pass which runs the actual script. Nothing is impossible. It's just not implemented. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 301 redirect returning 302 instead
Having a problem here trying to redirect some old pages. I've recently noticed using a server header check that my 301 redirects in PHP are returning 302 instead. I'm using the following code: header('HTTP/1.1 301 Moved Permanently'); header('Location: newurl'); exit(); The header checker is returning this: #1 Server Response: oldurl HTTP Status Code: HTTP/1.0 302 Found Connection: close X-Powered-By: PHP/5.1.4 Location: newurl Any reason why we're getting a 302 instead of a 301? This is keeping the pages in Google instead of removing them and using the new location. BTW, my server is lighttpd. -- Ian Evans Chairman Executive Producer DigitalHit.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php.ini ini_set
I am working on a website for a friend that is being hosted by a third party (which uses Linux) and I don't have access to the php.ini or any other system files. The problem I am having is this. When an email is sent from the website and the user receives it, it says it is from [EMAIL PROTECTED] instead of the websites email address. How can I get it to say it is coming from the website address. I do have access to a cgi bin, and maybe .htaccess if something can be done with these. I thought though that I could use ini_set to do this. Any thoughts. Thanks
Re: [PHP] php.ini ini_set
Beauford wrote: I am working on a website for a friend that is being hosted by a third party (which uses Linux) and I don't have access to the php.ini or any other system files. The problem I am having is this. When an email is sent from the website and the user receives it, it says it is from [EMAIL PROTECTED] instead of the websites email address. How can I get it to say it is coming from the website address. I do have access to a cgi bin, and maybe .htaccess if something can be done with these. I thought though that I could use ini_set to do this. http://www.php.net/mail Check the 5th parameter usage and associated comments. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php.ini ini_set
Can you be more specific. I only see 4 parameters and none of them apply. -Original Message- From: Chris [mailto:[EMAIL PROTECTED] Sent: October 31, 2006 9:13 PM To: Beauford Cc: PHP Subject: Re: [PHP] php.ini ini_set Beauford wrote: I am working on a website for a friend that is being hosted by a third party (which uses Linux) and I don't have access to the php.ini or any other system files. The problem I am having is this. When an email is sent from the website and the user receives it, it says it is from [EMAIL PROTECTED] instead of the websites email address. How can I get it to say it is coming from the website address. I do have access to a cgi bin, and maybe .htaccess if something can be done with these. I thought though that I could use ini_set to do this. http://www.php.net/mail Check the 5th parameter usage and associated comments. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.ini ini_set
Beauford wrote: Can you be more specific. I only see 4 parameters and none of them apply. Oops sent you to the wrong page. http://www.php.net/manual/en/function.mail.php There are 5 parameters: bool mail ( string to, string subject, string message [, string additional_headers [, string additional_parameters]] ) Look for this: additional_parameters (optional) and look at example 3. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Memory Allocation (checked via TOP)
$str is 10 bytes then you repeat it 200 times That gives you 2000 bytes. That's 20M not 10M -Rasmus Cabbar Duzayak wrote: Hi, I have written a simple test program to see how php allocates memory. Test code allocates ~10 Meg of RAM in an array within a loop till it runs out of memory as: $str = rand(65, 95) . rand(65, 95) . rand(65, 95) . rand(65, 95) . rand(65, 95); $aa[] = str_repeat($str, 200); What I don't understand here is, for every 10 Meg memory it allocates, mem usage goes up about 19 Megs when I look at this via top. Basically, it allocates from physical memory in the beginning, starts using swap when it is out of RES/Physical memory, which makes me assume that garbage collection should kick in for temporary string creations, and each new allocation increases the allocated memory size by 19 Megs. Any idea why this is happening, and why do you think memory allocation is so expensive in PHP? Thanks.. Results of TOP: PID USER PR NI VIRT RES SHR S %CPU %MEMTIME+ COMMAND 21843 apache17 0 19292 5232 3832 S 0.0 0.5 0:00.04 php 21843 apache16 0 38824 24m 3908 S 0.0 2.4 0:00.10 php 21843 apache15 0 58356 43m 3912 S 0.0 4.3 0:00.17 php 21843 apache16 0 77888 62m 3912 S 0.0 6.2 0:00.22 php 21843 apache15 0 97420 81m 3912 S 0.0 8.1 0:00.29 php 21843 apache15 0 114m 100m 3912 S 0.0 9.9 0:00.35 php Results of free -m: total used free sharedbuffers cached Mem: 1011138872 0 2 58 Swap: 2008388 1619 Mem: 1011158852 0 2 58 Swap: 2008388 1619 Mem: 1011177833 0 2 58 Swap: 2008388 1619 Mem: 1011196814 0 2 58 Swap: 2008388 1619 Mem: 1011216795 0 2 58 Swap: 2008388 1619 Mem: 1011234776 0 2 58 Swap: 2008388 1619 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php.ini ini_set
That doesn't work. Here is what I have. mail($email,$subject,$body,$from); Which is (senders address, the subject, the body of the message, and the from address) The from address is taken from this, and I added the -f in front of it. define(regaddress, [EMAIL PROTECTED]); It still says it comes from: Nobody [EMAIL PROTECTED]; on behalf of; Registrar [EMAIL PROTECTED] Thanks -Original Message- From: Chris [mailto:[EMAIL PROTECTED] Sent: October 31, 2006 9:38 PM To: Beauford Cc: 'PHP' Subject: Re: [PHP] php.ini ini_set Beauford wrote: Can you be more specific. I only see 4 parameters and none of them apply. Oops sent you to the wrong page. http://www.php.net/manual/en/function.mail.php There are 5 parameters: bool mail ( string to, string subject, string message [, string additional_headers [, string additional_parameters]] ) Look for this: additional_parameters (optional) and look at example 3. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
FW: [PHP] php.ini ini_set
Sorry, this should be. Which is (to address, the subject, the body of the message, and the from address) - That doesn't work. Here is what I have. mail($email,$subject,$body,$from); Which is (senders address, the subject, the body of the message, and the from address) The from address is taken from this, and I added the -f in front of it. define(regaddress, [EMAIL PROTECTED]); It still says it comes from: Nobody [EMAIL PROTECTED]; on behalf of; Registrar [EMAIL PROTECTED] Thanks -Original Message- From: Chris [mailto:[EMAIL PROTECTED] Sent: October 31, 2006 9:38 PM To: Beauford Cc: 'PHP' Subject: Re: [PHP] php.ini ini_set Beauford wrote: Can you be more specific. I only see 4 parameters and none of them apply. Oops sent you to the wrong page. http://www.php.net/manual/en/function.mail.php There are 5 parameters: bool mail ( string to, string subject, string message [, string additional_headers [, string additional_parameters]] ) Look for this: additional_parameters (optional) and look at example 3. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.ini ini_set
Beauford wrote: That doesn't work. Here is what I have. mail($email,$subject,$body,$from); Which is (senders address, the subject, the body of the message, and the from address) The from address is taken from this, and I added the -f in front of it. define(regaddress, [EMAIL PROTECTED]); It still says it comes from: Nobody [EMAIL PROTECTED]; on behalf of; Registrar [EMAIL PROTECTED] That's something different entirely to what your original email said. Your mail server is adding that, it's not a php setting you can change. If you look at the mail source, it will have an extra header in there (can't remember what it is but check against this email - something like Sender or Sender-Address). -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Stupid question of the day (Editing text file in $HOME via web)
On 31 Oct 2006, at 09:20 , Ed Lazor wrote: On Oct 30, 2006, at 11:34 PM, Google Kreme wrote: So, do I whack up something where I just load the file into a HTML Textarea and then write it back (simple enough, though possibly rather dangerous), or is there something straightforward I should go ahead and use that might find use elsewhere on the server? Playing Devils Advocate here, but why not store the text in a database? Because the text file is used by egrep/procmail. The text file should be somewhat secure if you're manually reading and writing to it in PHP, making sure that you're the one controlling the file name, the file extension (file type), the file permissions, and the file size. Yeah, so just dump it into a textarea and go? On 31 Oct 2006, at 10:32 , Richard Lynch wrote: On Tue, October 31, 2006 1:34 am, Google Kreme wrote: So, do I whack up something where I just load the file into a HTML Textarea and then write it back (simple enough, though possibly rather dangerous), or is there something straightforward I should go ahead and use that might find use elsewhere on the server? The unanswered question is: How many people might try to edit it at once, and what will you do to resolve race conditions? There will be only one person able to access the file, but I will need to somehow 'time-out' a edit if it doesn't get committed. 1. Put the file in a database as individual (AAA) XXX- records, and the file can be generated from the DB every time it changes with a trigger, or every day or something reasonable. Having individual records for each line reduces the damage of the race condition to a single entry needing to be re-done. You can also more easily find code to handle the race condition for the DB in a web environment. That's not a bad idea. It might be worth the effort to setup the database and then simply have a php scriptlette generate the actual plaintext. Hmm. Worth considering, at least. Some way of generating the plain text only when the file changes would be needed though,a s I don't expect it to change all that often. 2. Put the file into subversion or CVS, if all editors are developers. Nope, it needs to be luser friendly. 3. Forget the web interface, because the file won't really change that often anyway, and just use 'vi' to make the rare change. :-) See above. There likely *IS* a web tool out there just like you want... Yeah, that's what I was thinking. My first guess would be to check out the various panel solutions for having a web interface that webhosts provide to edit what is essentially a simple text file, which configures the web server, mail server, ftp server, etc. These all have all the exact same issues you will face, so there might be one that fits your needs. Any specific recommendations? The only one of these I am familiar with is the absurdly expensive cpanel. -- You can think and you can fight, but the world's always movin', and if you wanna stay ahead you gotta dance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Probably a dumb question but...
I've just installed PHP 4.4.4 with CLI disabled and CGI enabled. With CLI I can find the PHP executable in $prefix/bin/php but with CGI I can't find it. I need the path to the PHP executable so I can install suPHP but $prefix/bin/php no longer exists and all I have in $prefix/bin is php-config and phpize if I want to replace a call to $prefix/bin/php with the CGI version what would the system path be? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Probably a dumb question but...
[snip] I've just installed PHP 4.4.4 with CLI disabled and CGI enabled. With CLI I can find the PHP executable in $prefix/bin/php but with CGI I can't find it. I need the path to the PHP executable so I can install suPHP but $prefix/bin/php no longer exists and all I have in $prefix/bin is php-config and phpize if I want to replace a call to $prefix/bin/php with the CGI version what would the system path be? [/snip] I trust that you have typed which php at the command prompt? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.ini ini_set
Why can't you just add a From: Registrar [EMAIL PROTECTED] header? =/ - tul Chris wrote: Beauford wrote: That doesn't work. Here is what I have. mail($email,$subject,$body,$from); Which is (senders address, the subject, the body of the message, and the from address) The from address is taken from this, and I added the -f in front of it. define(regaddress, [EMAIL PROTECTED]); It still says it comes from: Nobody [EMAIL PROTECTED]; on behalf of; Registrar [EMAIL PROTECTED] That's something different entirely to what your original email said. Your mail server is adding that, it's not a php setting you can change. If you look at the mail source, it will have an extra header in there (can't remember what it is but check against this email - something like Sender or Sender-Address). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php