RE: [PHP] apache_child_terminate?
Curt Zirzow wrote: I should be able to turn this on with 'child_terminate' in php.ini However, I do this, and when I do a phpinfo(); it returns a: apache2handler with only three Directives: - engine - last_modified - xbithack Are you running apache in multithreaded per chance? http://php.net/manual/en/function.apache-child-terminate.php Of course this begs the question why you want all php script's to terminage apache, this will only provide extra cpu usage. I have a download script that for some reason, seems to be consuming lots of memory - no matter what I do. Someone suggested apache_child_terminate after the download is done, to kill the apache process, and make sure that the memory is released back to the OS. -Robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php fastcgi win, only 1 concurrent thread?
i'm using external fastcgi it seems all other request is blocked until the 1 have finished any work arround? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php5 webhosting
Hello Greg, Tuesday, January 4, 2005, 4:54:31 AM, you wrote: GD Anyone found any good deals with webhosts supporting PHP5 yet? I use http://www.textdrive.com/ for a personal PHP5 site. Very well configured servers. Recommended by someone else on this list who works for them I believe. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I am not young enough to know everything. - Oscar Wilde -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] GMT
Hi you all, How do you work with GMT time-zones? I mean, I´ve developed a support system, with projects, bugs, tasks, etc... but as I user date()ç,I is 6 hours late from my client´s time-zone... And I would like to make it a little more dynamic than just put a variable in the code and add to the hour. Regards, Bruno B B Magalhães -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] migrating to PHP 5 + Apache 2 from PHP 4.3.8 + Apache 1.3.33.
Rasmus Lerdorf wrote: I thought I just explained that. The problem is that the dozens of libraries you are likely to link into you Apache+PHP system may or may not be threadsafe. We are only thinking of using standard libraries,that is the libraries which allow us to access the functions listed in chapter VI. Function Reference of official PHP Manual version 03-01-2005. Are these libraries all thread safe? If not, is there a list explaining which libraries are thread safe (not thread safe)? -- symbulos partners -.- symbulos - ethical services for your organisation http://www.symbulos.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] handling large files w/readfile
On Sunday 02 January 2005 16:43, Robin Getz wrote: Rasmus Lerdorf wrote: $buff = 0; while (!feof($fp)) { $buff = fread($fp, 4096); print $buff; } unset($buff); fclose ($fp); Well, the above code does not use more than 4K of ram plus a bit of overhead. So if something is causing your processes to grow to 450M you need to look elsewhere because this code is definitely not the cause. Well, the test case is: 1) above with big files = big apache processes - machine crashes Are you using the above code on its own (ie not within some other code that may affect the memory usage)? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to argue with ASP people...
[snip] I'm a passionate freak of PHP from the past 4 years (that i can remember). And i love everything that php can do. But just 2 days ago i came along a situation where i have to write a hit counter for my website without using a database or a text file. Just using a global variable i wanted to do this. I dont know whether php can do this...(or may b i missed it out)...but i couldnt get any equivalent thing in php like we have GLOBAL.ASA in ASP. [/snip] What do you think GLOBAL.ASA is? From M$, - A file that stores information about an Internet Information Services (IIS) application, such as initialization in structures, and objects that have been given application scope. So, you still have to use a text file. Next! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to argue with ASP people...
Sagar C Nannapaneni wrote: I'm a passionate freak of PHP from the past 4 years (that i can remember). And i love everything that php can do. But just 2 days ago i came along a situation where i have to write a hit counter for my website without using a database or a text file. Just using a global variable i wanted to do this. Not possible in any language. Well, it's possible in a way I guess. The count could be stored in memory, but as soon as the box is restarted, memory is dumped, etc., you'll lose the count. I dont know whether php can do this...(or may b i missed it out)...but i couldnt get any equivalent thing in php like we have GLOBAL.ASA in ASP. GLOBAL.ASA uses a file to retain it's settings. -- 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] handling large files w/readfile
Jason Wong wrote: Are you using the above code on its own (ie not within some other code that may affect the memory usage)? Well, herethe entire file (It is pretty short - only a 2 pages, but sorry in advance if anyone considers this bad form). site is called with something like http://blackfin.uclinux.org/frs/download.php/123/STAMP.jpg Files are stored in: $sys_upload_dir.$group_name.'/'.$filename -- frs/download.php - ?php /** * GForge FRS Facility * * Copyright 1999-2001 (c) VA Linux Systems * The rest Copyright 2002-2004 (c) GForge Team * http://gforge.org/ * * @version $Id: download.php,v 1.6 2004/10/08 23:05:29 gsmet Exp $ * * This file is part of GForge. * * GForge is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * GForge is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GForge; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ $no_gz_buffer=true; require_once('pre.php'); $arr=explode('/',$REQUEST_URI); $file_id=$arr[3]; $res=db_query(SELECT frs_file.filename,frs_package.is_public, frs_file.file_id,groups.unix_group_name,groups.group_id FROM frs_package,frs_release,frs_file,groups WHERE frs_release.release_id=frs_file.release_id AND groups.group_id=frs_package.group_id AND frs_release.package_id=frs_package.package_id AND frs_file.file_id='$file_id'); if (db_numrows($res) 1) { Header(Status: 404); exit; } $is_public =db_result($res,0,'is_public'); $group_name=db_result($res,0,'unix_group_name'); $filename = db_result($res,0,'filename'); $release_id=db_result($res,0,'release_id'); $group_id = db_result($res,0,'group_id'); $Group = group_get_object($group_id); if (!$Group || !is_object($Group) || $Group-isError()) { exit_no_group(); } if(!$Group-isPublic()) { session_require(array('group' = $group_id)); } // Members of projects can see all packages // Non-members can only see public packages if(!$is_public) { if (!session_loggedin() || (!user_ismember($group_id) !user_ismember(1,'A'))) { exit_permission_denied(); } } /* echo $group_name.'|'.$filename.'|'.$sys_upload_dir.$group_name.'/'.$filename; if (file_exists($sys_upload_dir.$group_name.'/'.$filename)) { echo 'br /file exists'; passthru($sys_upload_dir.$group_name.'/'.$filename); } */ if (file_exists($sys_upload_dir.$group_name.'/'.$filename)) { Header('Content-disposition: filename='.str_replace('', '', $filename).''); Header(Content-type: application/binary); length = filesize($sys_upload_dir.$group_name.'/'.$filename); Header(Content-length: $length); # Here is where all the problems start readfile($sys_upload_dir.$group_name.'/'.$filename); if (session_loggedin()) { s = session_get_user(); us=$s-getID(); } else { us=100; } res=db_query(INSERT INTO frs_dlstats_file (ip_address,file_id,month,day,user_id) VALUES ('$REMOTE_ADDR','$file_id','.date('Ym').','.date('d').','$us')); } else { Header(Status: 404); } ? = If this runs for awhile things go very bad. This seems to be related to a specific download manager called NetAnts that seems to be popular in China. http://www.netants.com/ Which attempts to open the same url for downloading 10-15 times at the same instant. If I replace things with: snip = if (file_exists($sys_upload_dir.$group_name.'/'.$filename)) { # if the file is too big to download (10Meg) - use a different method than php $length = filesize($sys_upload_dir.$group_name.'/'.$filename); Header('Content-disposition: filename='.str_replace('', '', $filename).''); Header(Content-type: application/binary); Header(Content-length: $length); fp = fopen($sys_upload_dir.$group_name.'/'.$filename,'rb'); buff=0; while (!feof($fp)) { buff = fread($fp, 4096); print $buff; } unset($buff); fclose ($fp); === snip - rest is the same = I get exactly the same problem - I come back and there are 2-3-4 apache processes that are consuming memory the size of the largest downloads. The only way I can make things work with large downloads is to use this: snip if
Re: [PHP] How to argue with ASP people...
Leif Gregory wrote: Hello Richard, Monday, January 3, 2005, 11:27:05 AM, you wrote: RL ASP has no include function. This makes life very very very RL difficult to write decent code. Not that I like ASP, and I'm not an ASP guru by any means, but this statement is incorrect AFAICS. I use to do this all the time in ASP. !-- #include virtual=includes/databaseconnect.asp -- I'm not an ASP guru either, but this doesn't look like ASP syntax to me. This looks like an Apache SSI. -- 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
[PHP] variable hell
Hi all I have few variables in this format: $isproductssorttext = 150; $isofferssorttext = 250; $isnewproductssorttext = 350; $isproductscount = 50; $isofferscount = 30; $isnewproductscount = 20; etc What I want to do is have a variable e.g. $x = products; and create from that, the variable $is'products'sorttext (--$isproductssorttext) and use its value so if $x was offers on echo I would have (250) -- $isofferssorttext if $x was newproducts on echo I would have (350) -- $isnewproductssorttext Thanks in advance Mario -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GMT
Here has always been a problem I run into with GMT translation. You have to make sure that the system you are working with is set to the correct time zone so that any application trying to automatically figure out the time have the starting point. This is easy enough in Windows, but can mean making sure your /etc/localtime (See http://www.linuxforum.com/linux_tutorials/68/1.php) is correct in linux. Of course there are GUI tools to help with this also for those non-console people. Unfortunately some people rely on shared servers where you do not have root access to change /etc/localtime. Therefore you must have an overloadable function to return the time in GMT. Where it can accept an offset or rely on the systems timezone. To me, it seems best to just use a variable. Print out the time, then do a correct offset for it. But for something already done, see http://us3.php.net/manual/en/function.gmdate.php Travis - Original Message - From: Bruno B B Magalhães [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Tuesday, January 04, 2005 5:04 AM Subject: [PHP] GMT Hi you all, How do you work with GMT time-zones? I mean, I´ve developed a support system, with projects, bugs, tasks, etc... but as I user date()ç,I is 6 hours late from my client´s time-zone... And I would like to make it a little more dynamic than just put a variable in the code and add to the hour. Regards, Bruno B B Magalhães -- 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] How to argue with ASP people...
[EMAIL PROTECTED] wrote: !-- #include virtual=includes/databaseconnect.asp -- is html... :-) /G @varupiraten.se Standard comment in HTML, but it has another use with Apache, and I didn't find any reference to this type of syntax for ASP. From the Apache Docs at http://httpd.apache.org/docs/howto/ssi.html... Including the results of a CGI program This is one of the more common uses of SSI - to output the results of a CGI program, such as everybody's favorite, a ``hit counter.'' !--#include virtual=/cgi-bin/counter.pl -- Including a standard footer If you are managing any site that is more than a few pages, you may find that making changes to all those pages can be a real pain, particularly if you are trying to maintain some kind of standard look across all those pages. Using an include file for a header and/or a footer can reduce the burden of these updates. You just have to make one footer file, and then include it into each page with the include SSI command. The include element can determine what file to include with either the file attribute, or the virtual attribute. The file attribute is a file path, relative to the current directory. That means that it cannot be an absolute file path (starting with /), nor can it contain ../ as part of that path. The virtual attribute is probably more useful, and should specify a URL relative to the document being served. It can start with a /, but must be on the same server as the file being served. !--#include virtual=/footer.html -- -- 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] variable hell
From: mario [mailto:[EMAIL PROTECTED] Hi all I have few variables in this format: $isproductssorttext = 150; $isofferssorttext = 250; $isnewproductssorttext = 350; $isproductscount = 50; $isofferscount = 30; $isnewproductscount = 20; etc What I want to do is have a variable e.g. $x = products; and create from that, the variable $is'products'sorttext (--$isproductssorttext) and use its value so if $x was offers on echo I would have (250) -- $isofferssorttext if $x was newproducts on echo I would have (350) -- $isnewproductssorttext I'd imagine, at this point, you'd need to move into the realm of associative arrays. $x = 'products'; $issorttext[$x] = 150; $isnewsorttext[$x] = 350; $iscount[$x] = 50; $isnewcount[$x] = 20; After this, you'd end up with four arrays of one key each ('products'), referenced as such: echo $issorttext['products']; // echoes 150 Then do the same for the key 'offers' and you'd have the same four arrays, but now each with two keys. Hope this wasn't too confusing an explanation. :) -- Mike Johnson Smarter Living, Inc. Web Developerwww.smarterliving.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] variable hell
On Tue, 4 Jan 2005, mario wrote: Hi all I have few variables in this format: $isproductssorttext = 150; $isofferssorttext = 250; $isnewproductssorttext = 350; $isproductscount = 50; $isofferscount = 30; $isnewproductscount = 20; etc What I want to do is have a variable e.g. $x = products; and create from that, the variable $is'products'sorttext (--$isproductssorttext) and use its value so if $x was offers on echo I would have (250) -- $isofferssorttext if $x was newproducts on echo I would have (350) -- $isnewproductssorttext Hello I believe what you are after is ${'is'.$x.'sorttext'} but I would rather use the nfollowing approach as it is much more readable and easier to debug: $issorttext = array('offers' = 250, 'newproducts' = 250, ...) and then use it: echo $issorttext['offers']; -- Cheers, --Jyry C|:-(C|:-/C|8-OC|8-/C|:-( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PDFlib-Lite-6.0.1
2wsxdr5 wrote: http://www.pdflib.com/products/pdflib/download/601src/PDFlib-Lite-6.0.1.tar.gzI am trying to install PDFlib-Lite-6.0.1 on my testing server. So far no luck. I am starting with php 4.3.3 and apache 2.0 on an SUSE 9.0 machine. Apache and php were installed with the OS. I started by getting tiff-3.7.1.tar.gz and jpegsrc.v6b.tar.gz and those both installed with out a problem then I got PDFlib-Lite-6.0.1.tar.gz and that configured compiled fine then came the problems. Here is the command and out put... PIII500x2:~ # pear install pdflib downloading pdflib-2.0.4.tgz ... ...done: 36,082 bytes 7 source files, building running: phpize Configuring for: PHP Api Version: 20020918 Zend Module Api No: 20020429 Zend Extension Api No: 20021010 `phpize' failed Any ideas? This is a question for pear-general. Please specify the output of pear -V, and if you don't see 1.3.4, upgrade and try again. Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] How to argue with ASP people...
Hello John, Tuesday, January 4, 2005, 2:52:27 PM, you wrote: JN Standard comment in HTML, but it has another use with Apache, and I JN didn't find any reference to this type of syntax for ASP. !--#include file=whatever.asp -- and !--#include virtual=whatever.asp -- are both perfectly valid ASP syntax that will work on **IIS** Obviously you can do the usual stuff as in PHP, with: % filen = header.inc % !--#include file=%=filen%-- etc etc It's no different really. PHP might be significantly better than ASP, but it's still not *that* archaic! Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I am not young enough to know everything. - Oscar Wilde -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] handling large files w/readfile
On Tuesday 04 January 2005 22:04, Robin Getz wrote: Jason Wong wrote: Are you using the above code on its own (ie not within some other code that may affect the memory usage)? Well, herethe entire file (It is pretty short - only a 2 pages, but sorry in advance if anyone considers this bad form). I should have added that if you're not running that snippet of code on its own then try running it on its own, give it a fixed filename (so you don't have to go through the $_REQUEST and database business). Clouding the issue by running it in conjunction with other code (however innocuous) just complicates matters. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] variable hell
mario wrote: Hi all I have few variables in this format: $isproductssorttext = 150; $isofferssorttext = 250; $isnewproductssorttext = 350; $isproductscount = 50; $isofferscount = 30; $isnewproductscount = 20; etc What I want to do is have a variable e.g. $x = products; and create from that, the variable $is'products'sorttext (--$isproductssorttext) and use its value so if $x was offers on echo I would have (250) -- $isofferssorttext if $x was newproducts on echo I would have (350) -- $isnewproductssorttext Thanks in advance Mario You probably want to look into arrays... http://us4.php.net/manual/en/language.types.array.php http://us4.php.net/array -- 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] GMT
i Travis and Tobias, I've modified a simple function, and incorporated it to my framework's datetime.class.php witch handles all date and time conversion... Here it is: = var $server_timezone_offset = -5; var $default_timezone_offset = +1; var $local_timezone_offset = 0; function timezone($offset=null) { if(is_integer($offset)) { $this-local_timezone_offset = $offset-$this-server_timezone_offset; return time()+3600*$this-local_timezone_offset; } elseif(is_integer($this-default_timezone_offset)) { $this-local_timezone_offset = $this-default_timezone_offset - $this-server_timezone_offset; return time()+3600*$this-local_timezone_offset; } else { return time(); } } = Nice regards to you all, Bruno B B Magalhães On Jan 4, 2005, at 12:44 PM, Travis Conway wrote: Here has always been a problem I run into with GMT translation. You have to make sure that the system you are working with is set to the correct time zone so that any application trying to automatically figure out the time have the starting point. This is easy enough in Windows, but can mean making sure your /etc/localtime (See http://www.linuxforum.com/linux_tutorials/68/1.php) is correct in linux. Of course there are GUI tools to help with this also for those non-console people. Unfortunately some people rely on shared servers where you do not have root access to change /etc/localtime. Therefore you must have an overloadable function to return the time in GMT. Where it can accept an offset or rely on the systems timezone. To me, it seems best to just use a variable. Print out the time, then do a correct offset for it. But for something already done, see http://us3.php.net/manual/en/function.gmdate.php Travis - Original Message - From: Bruno B B Magalhães [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Tuesday, January 04, 2005 5:04 AM Subject: [PHP] GMT Hi you all, How do you work with GMT time-zones? I mean, I´ve developed a support system, with projects, bugs, tasks, etc... but as I user date()ç,I is 6 hours late from my client´s time-zone... And I would like to make it a little more dynamic than just put a variable in the code and add to the hour. Regards, Bruno B B Magalhães -- 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] whats happen fsockopen function?
Dear Sirs, my fsockopen function is not working, for last 1 day. And I get following error on log. Any idea why? PHP Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of fsockopen(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. Best Regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to argue with ASP people...
Richard Davey wrote: Hello John, Tuesday, January 4, 2005, 2:52:27 PM, you wrote: JN Standard comment in HTML, but it has another use with Apache, and I JN didn't find any reference to this type of syntax for ASP. !--#include file=whatever.asp -- and !--#include virtual=whatever.asp -- are both perfectly valid ASP syntax that will work on **IIS** Obviously you can do the usual stuff as in PHP, with: % filen = header.inc % !--#include file=%=filen%-- etc etc It's no different really. PHP might be significantly better than ASP, but it's still not *that* archaic! But, is !--#include virtual=whatever.asp -- actually calling the file from the ASP script like include() and require() will do in PHP? Or is it ISS calling the file after the script is processed in the same manner that Apache would call !--#include virtual=whatever.html -- with SSI? -- 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] How to argue with ASP people...
--- Sagar C Nannapaneni [EMAIL PROTECTED] wrote: But just 2 days ago i came along a situation where i have to write a hit counter for my website without using a database or a text file. Just using a global variable i wanted to do this. I dont know whether php can do this...(or may b i missed it out)...but i couldnt get any equivalent thing in php like we have GLOBAL.ASA in ASP. If GLOBAL.ASA isn't considered a text file, then you can probably use SQLite. Just don't call it a database. :-) What sort of situation did you encounter where you were required to persist data without the two primary means of doing so? You can persist data in memory, I guess, depending on how permanent you need this to be - your hit counter would be reset when the server reboots. It could be like the high scores on an arcade machine. :-) Chris = Chris Shiflett - http://shiflett.org/ PHP Security - O'Reilly HTTP Developer's Handbook - Sams Coming Soon http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] whats happen fsockopen function?
QT wrote: Dear Sirs, my fsockopen function is not working, for last 1 day. And I get following error on log. Any idea why? PHP Warning: Call-time pass-by-reference has been deprecated - argument passed Get rid of the signs in your code inside the fsockopen( ) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Persistent PHP web application?
Wow thanks for the helpful breakdown. PHP's model is to be completely sandboxed such that every request is completely separate from every other. Having a persistent interpreter as you describe would break that rule and break the infinite horizontal scalability model of PHP. Understood. A persistent interpreter is a whole different approach. I appreciate your perspective on that, it helps me to reconsider overall what I'm doing and why I want to do it :) Of course, there is nothing that prevents you from storing persistent data somewhere more permanent. If it is just simple read-only data you have a lot of options. For example, you could put them in a .ini file that is only loaded on Apache startup and use get_cfg_var() to fetch them. If you compile PHP with the --with-config-file-scan-dir switch to configure a configuration scan directory you can just drop your own ini file in that directory and it will be read on startup. This is just key=value pairs and not PHP code, of course. I'm dealing with large multidimensional arrays, like this: $categories = array ( 1 = array ( 'name' = 'Autos', 'depth' = 1, ... :( If you need to do something fancier you can stick things in shared memory. Many of the accelerators give you access to their shared memory segments. For example, the CVS version of pecl/apc provides apc_store() and apc_fetch() which lets you store PHP datatypes in shared memory directly without needing to serialize/unserialize them. That pecl/apc feature sounds like a great, cheap solution to my giant global variable definition problem, which takes the biggest single chunk of parsing time. The key AFAICS is avoiding the (un)serialization time. I'd love to see an example if you have one, just to show me a target to aim for. I'm unfamiliar with C / reading C source code and with shared memory so I'm having a tough time figuring out how to use that feature. (It doesn't solve the function definition problem but that is OK - the functions take FAR less time to parse than the global variable definitions.) And finally, the big hammer is to write your own PHP extension. This is a lot easier than people think and for people who are really looking for performance this is the only way to go. You can write whatever code you want in your MINIT hook which only gets called on server startup and in that hook you can create whatever persistent variables you need, pull stuff from a DB, etc. At the same time you will likely want to pull some of your heavier business logic identified by your profiling into the extension as well. This combination of C and PHP is extremely hard to beat performance-wise regardless of what you compare it to. This is something I'm VERY interested in. It is encouraging to hear that it is easier than I expect, and I will look into it further. Based on the responses from the list I've gotten, this seems like the most promising total solution. Any outstanding books/articles on the topic, considering I'm not a C programmer? Thanks again /josh w. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Persistent PHP web application?
Why don't you just create a daemon started from the command line (shell/DOS) and have it accept socket connections from your Web server PHP scripts and provide a SOA (Services Oriented API) to the code that accesses your data structures pre-loaded in memory? Setting up a separate persistent daemon PHP script is appealing to me because It implements exactly what I want, which is a persistent PHP application server, and also would allow me to abstract the implementation behind an API, move it to other servers when load increases, etc. However, would a single process PHP server daemon be able to appropriately handle the incoming load from Apache, which will be running multiple processes handling concurrent incoming requests? Implementing a multi-process forking SOAP server in pure PHP seems inefficient, but maybe I'm not understanding the basic premise/implementation of the suggestion? Any good links/tutorials/examples/books for this? Thanks! /josh w. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PEAR] Re: PDFlib-Lite-6.0.1
`phpize' failed Any ideas? Do you have php-devel installed? If not install it and try again. Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP5 Namespace ?
is really that the support for namespace in php5 is removed ? or there are replacment for it ? -- Alawi Albaity Jeddah - KSA Mobile : +966506660442 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to argue with ASP people...
John Nichel wrote: Richard Davey wrote: Hello John, Tuesday, January 4, 2005, 2:52:27 PM, you wrote: JN Standard comment in HTML, but it has another use with Apache, and I JN didn't find any reference to this type of syntax for ASP. !--#include file=whatever.asp -- Sorry. I left out the word dynamic when I type the original complaint. You can't do: include /known/safe/path/$whatever.asp and have it pull in ASP and evaluate it. Or am I mis-remembering the horrors of ASP? It's been awhile since I've used it, and you don't have enough money to make me use it again. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session ID in query string
Using PHP 4.3.9, we have these settings: session.use_cookies = 1 session.use_only_cookies = 1 session.use_trans_sid = 0 (verified by a display of phpinfo() ) with the goal of preventing URLs with session IDs appended. That works fine, but when a page is validated by W3C, it throws an error, and indicates that a link on the page (which contains a query string), also contains the session ID. If I click the link, it doesn't show the session ID, but W3C can see it. Any ideas appreciated. Sandy Keathley -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] How to argue with ASP people...
Hello John, Tuesday, January 4, 2005, 4:32:13 PM, you wrote: JN But, is !--#include virtual=whatever.asp -- actually calling the JN file from the ASP script like include() and require() will do in PHP? Yes. We used to split all of our ASP projects up this way - a class includes for the database abstraction, one for templating, an overall config one that held global vars and loaded the rest of the includes, etc - sound familiar? :) Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I am not young enough to know everything. - Oscar Wilde -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Apache Server with php
Hi, I am having issues with the installation and configuration of my Apache server 2.0.52(win32). All is well when I restart the server with the exception of, when I load the following lines. I opened up the httpd.conf file and searched for #LoadModule ssl_module modules/mod_ssl.so. Directly underneath that line, I added LoadModule php4_module D:/php/sapi/php4apache2.dll. My plan was to run PHP as a module for Apache, instead of as a CGI binary but every time I add this line my server will not restart but I get an error stating The requested operation has failed. I checked to ensure the path was correct to this dll and all is well. Any suggestions? Thanks, Ramiro
[PHP] Updated: Calendar Script
Hey Harry, I haven't ever had the time to get into the smarty templating... I keep coming across apps that use it though.. I may spend some time checking it out... I've included the script with some updates... Also some CSS stuff and there is a second page that shows the hour break down of that day Enjoy! Joe 04 Jan 2005 - - !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; html head titleCalendar/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 style type=text/css !-- body { font-family: Tahoma, Verdana, Helvetica, Arial, sans-serif; font-size: 11px; color: #00; } -- /style /head body leftmargin=1 marginwidth=1 ?php // Created By Joe Harman - [EMAIL PROTECTED] function Cal_Month() { // Get Today's Date $todays_date = getdate(); // Determine what month to display if(isset($_GET['month'])) { $resolve_time = 1 .$_GET['month']. .$_GET['year']; $resolve_first_day_of_month = strtotime($resolve_time); $resolved_date = getdate($resolve_first_day_of_month); } else { $resolved_date = $todays_date; } // if this is the current month - say it's okay to mark today on the calendar if($todays_date['year'] == $resolved_date['year'] $todays_date['month'] == $resolved_date['month']) { $mark_today_on_calendar = TRUE; } // HOW MANY DAYS ARE IN THIS MONTH $days_in_current_month = cal_days_in_month(CAL_GREGORIAN, $resolved_date['mon'], $resolved_date['year']); // STRING TO START THE CALENDAR ON THE FIRST DAY OF THE MONTH $show_month = $resolved_date['month']; $show_year = $resolved_date['year']; // Get Info for Current Displayed Month $string_time = 1 .$show_month. .$show_year; $first_day_of_month = strtotime($string_time); $the_first_day_of_the_month = getdate($first_day_of_month); // Starts from the 1st $num_days_week = 7; $num_days_in_month = cal_days_in_month(CAL_GREGORIAN, $resolved_date['mon'], $resolved_date['year']); // Get info for PREV month $show_prev = strtotime(-1 Month, $first_day_of_month); $show_prev_month_first_day = getdate($show_prev); // Get info for NEXT month $show_next = strtotime(+1 Month, $first_day_of_month); $show_next_month_first_day = getdate($show_next); $next_month = $show_next_month_first_day['month']; $next_year = $show_next_month_first_day['year']; $prev_month = $show_prev_month_first_day['month']; $prev_year = $show_prev_month_first_day['year']; $link_next_month = a href=\?month=.$next_month.year=.$next_year.\Next Month /a; $link_prev_month = a href=\?month=.$prev_month.year=.$prev_year.\Prev Month /a; // Table Size Variables... will be moved to CSS eventually $table_align = center; $table_width = 550; $table_height = 60; $cell_width = $table_width/7; $table_bgcolor = #CC; $header_cell_bgcolor = #FF; $weekday_cell_color = #FF; $date_cell_color = #FF; $blank_cell_color = #FEFEFE; $hover_cell_color = #F4DFDF; $Hover_Cell = onMouseOver=\this.style.backgroundColor='.$hover_cell_color.'\ onMouseOut=\this.style.backgroundColor='.$date_cell_color.'\; $Hover_Cell_On = onMouseOver=\this.style.backgroundColor='#FF'\ onMouseOut=\this.style.backgroundColor='#33'\; $Hover_Cell_Today = onMouseOver=\this.style.backgroundColor='#FFCC66'\ onMouseOut=\this.style.backgroundColor='#FF'\; // Start HTML for Building Calendar
Re: [PHP] Persistent PHP web application?
Josh Whiting wrote: Wow thanks for the helpful breakdown. PHP's model is to be completely sandboxed such that every request is completely separate from every other. Having a persistent interpreter as you describe would break that rule and break the infinite horizontal scalability model of PHP. Understood. A persistent interpreter is a whole different approach. I appreciate your perspective on that, it helps me to reconsider overall what I'm doing and why I want to do it :) Of course, there is nothing that prevents you from storing persistent data somewhere more permanent. If it is just simple read-only data you have a lot of options. For example, you could put them in a .ini file that is only loaded on Apache startup and use get_cfg_var() to fetch them. If you compile PHP with the --with-config-file-scan-dir switch to configure a configuration scan directory you can just drop your own ini file in that directory and it will be read on startup. This is just key=value pairs and not PHP code, of course. I'm dealing with large multidimensional arrays, like this: $categories = array ( 1 = array ( 'name' = 'Autos', 'depth' = 1, ... :( If you need to do something fancier you can stick things in shared memory. Many of the accelerators give you access to their shared memory segments. For example, the CVS version of pecl/apc provides apc_store() and apc_fetch() which lets you store PHP datatypes in shared memory directly without needing to serialize/unserialize them. That pecl/apc feature sounds like a great, cheap solution to my giant global variable definition problem, which takes the biggest single chunk of parsing time. The key AFAICS is avoiding the (un)serialization time. I'd love to see an example if you have one, just to show me a target to aim for. I'm unfamiliar with C / reading C source code and with shared memory so I'm having a tough time figuring out how to use that feature. It's trivial. You check to see if your data is in shared memory. If it isn't, you create it and store it there using some identifier. Like this: $huge_array = apc_fetch('my_huge_array'); if(!$huge_array) { $huge_array = array( ... ); apc_store('my_huge_array', $huge_array); } You can optionally add a 3rd argument to apc_store() which is a timeout for the data. That means you can tell APC that the data is only valid for 600 seconds, for example. apc_store('my_huge_array', $huge_array, 600); And finally, the big hammer is to write your own PHP extension. This is a lot easier than people think and for people who are really looking for performance this is the only way to go. You can write whatever code you want in your MINIT hook which only gets called on server startup and in that hook you can create whatever persistent variables you need, pull stuff from a DB, etc. At the same time you will likely want to pull some of your heavier business logic identified by your profiling into the extension as well. This combination of C and PHP is extremely hard to beat performance-wise regardless of what you compare it to. This is something I'm VERY interested in. It is encouraging to hear that it is easier than I expect, and I will look into it further. Based on the responses from the list I've gotten, this seems like the most promising total solution. Any outstanding books/articles on the topic, considering I'm not a C programmer? If you don't know any C at all it is going to be an uphill battle. Either spend some time and learn C, or hire someone to write this for you. When I said it was easier than people expect, I was assuming some level of C proficiency. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] migrating to PHP 5 + Apache 2 from PHP 4.3.8 + Apache 1.3.33.
symbulos partners wrote: Rasmus Lerdorf wrote: I thought I just explained that. The problem is that the dozens of libraries you are likely to link into you Apache+PHP system may or may not be threadsafe. We are only thinking of using standard libraries,that is the libraries which allow us to access the functions listed in chapter VI. Function Reference of official PHP Manual version 03-01-2005. Are these libraries all thread safe? No. If not, is there a list explaining which libraries are thread safe (not thread safe)? No. If you re-read the previous emails from Rasmus, you will find that these questions are already answered within them. So I'm going to go on at length here telling you (again) what you don't want to hear. If you can narrow your focus down a bit from *ALL* of Section VI to *just* the libraries you *really* need, you might get the answer you want to hear: Oh, those are all thread-safe. But there is NO WAY you'll hear that any time soon for *ALL* of Section VI. There is no list of which ones are thread-safe -- Actually, it would be virtually impossible to compile such a list. It's more like a probability game. We're pretty sure PHP and MySQL are thread-safe, because they are used so extensively on so many high-volume sites that they'd have blown up already if they were not thread-safe. If you *HAD* to make a list, you'd be best started by listing the most popular Modules, and assuming that the ones near the very top of the list were probably thread-safe, and the ones near the bottom were most likely not thread-safe (or, at least, completely untested for all practical purposes) But you're not going to find anybody willing to stake their reputation on a list of what is or isn't thread-safe because there's NO WAY [*] to prove it. * Some computer scientist mathematician may have some algorithm to prove a process thread-safe, but not in any practical sense that can be applied to the real-life code that encompasses PHP. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GMT
Bruno B B Magalhães wrote: Hi you all, How do you work with GMT time-zones? I mean, I´ve developed a support system, with projects, bugs, tasks, etc... but as I user date()ç,I is 6 hours late from my client´s time-zone... And I would like to make it a little more dynamic than just put a variable in the code and add to the hour. Store all your stuff as GMT or UTC -- or even in your own local time. But allow your users to set a preference for their own time zone. You should be able to find a simple preferences system out there in http://phpclasses.org or on http://zend.com or even http://google.com Anyway, after that, you just convert with their preference from your stored time. You just have to be REALLY careful that you are consistent when you show them a time, and when you GET a time from them, and *always* remember to convert back-and-forth before you store it. Your database may also support time-zone input in some manner, and can maybe be helpful in this task. That's gonna be database-dependent, almost for sure. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php fastcgi win, only 1 concurrent thread?
is fastcgi of php active? how much ppl using this? is there any list show activity of each sapi? On Tue, 4 Jan 2005 17:22:34 +0800, Xuefer Tinys [EMAIL PROTECTED] wrote: i'm using external fastcgi it seems all other request is blocked until the 1 have finished any work arround? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] apache_child_terminate?
Robin Getz wrote: Curt Zirzow wrote: I should be able to turn this on with 'child_terminate' in php.ini However, I do this, and when I do a phpinfo(); it returns a: apache2handler with only three Directives: - engine - last_modified - xbithack Are you running apache in multithreaded per chance? http://php.net/manual/en/function.apache-child-terminate.php Of course this begs the question why you want all php script's to terminage apache, this will only provide extra cpu usage. I have a download script that for some reason, seems to be consuming lots of memory - no matter what I do. Someone suggested apache_child_terminate after the download is done, to kill the apache process, and make sure that the memory is released back to the OS. Just for fun, try putting an exit; at the end of the script. I've seen cases where PHP didn't seem to exit when it should, and would just sort of site there... I toss in 'exit;' and it works fine. I've never found a pattern to when this happens, and it's so easy to work-around I've never dug into it much... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] whats happen fsockopen function?
hi, I clean all signs, but still no result. This code was working perfect last two years. I don't know what happen? Richard Lynch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] QT wrote: Dear Sirs, my fsockopen function is not working, for last 1 day. And I get following error on log. Any idea why? PHP Warning: Call-time pass-by-reference has been deprecated - argument passed Get rid of the signs in your code inside the fsockopen( ) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Persistent PHP web application?
Thanks for taking the time for your comprehensive repsonse! However, given your programming philosophy so far, and the fact that you are worried about 7ms and that you specifically requested some kind of shared memory space in PHP, you should Read This: http://us4.php.net/manual/en/ref.sem.php That pretty much is exactly what you asked for. Be forewarned that few PHP scripters have needed this stuff, and it's not anywhere near as hammered on (read: debugged) as the other options above. I had the thought of using shared memory but I've found a scarce supply of introductory material and examples on the subject. The documentation assumes a level of familiarity with shared memory that I don't have, so I'm struggling. Examples of how to store and retreive a set of large multidimensional arrays to/from shared memory would be wonderful to look at, if you have some pointers to articles/books/etc I am also curious if the the shared memory solution would be a significant performance improvement, since, AFAIK, the data is serialized/unserialized for storage/retreival. Since the Zend Accelerator already uses a shared memory cache for the intermediate code, would using my own shared memory be any different? Consider that my global variable definition scripts are nothing more than giant unserialize statements. (Incidentally, I've benchmarked the difference between big unserialize statements and big PHP code array definition statements and found almost no difference, only a marginal improvement in performance using PHP code instead of unserialize on long strings.) Additionally, there are a large number of function definitions (more than 13,000 lines of code in all just for these global definitions). You should look into breaking these up into groups of functionality -- I'm willing to bet you could segment these and have many pages that only call in a few functions. That is good practice, I know i've been a bit lazy in that respect :) However, it is the variable definitions (big arrays) that take the most significant time, executing all the function definition code is actually only a small fraction of the time taken to parse the arrays, so it's a secondary concern, though you are right I should sit down and rework my includes so I'm only bringing in what I need. I'll set aside a week for that :) So if what your application mostly does is load in all this data and respond to requests, you could write a *SINGLE* PHP application which listened on port 12345 (or whatever port you like) and responded with the data requested. Like writing your own web-server, only it's a _-server where you get to fill in the blank with whatever your application does. Please see my repsonse to Manuel Lemos and his suggestion to run a SOAP server. Basically my concern is the lack of having a multi-process/forking server to handle concurrent incoming requests (which may or may not be a problem - not sure). We're talking about a persistent PHP server (SOAP or otherwise), and I'm having trouble groking how that would work in an environment with many concurrent requests. (Other than, of course, running a PHP SOAP server inside Apache which brings me back to square one :) Actually, Zend and others could be interested in your comparisons of with and without cache... If folks are interested in my benchmarks I could spend some time and put together a summary. Incidentally I did end up doing some comparison of cached code and uncached code because I unwittingly had the accelerator turned off for while until I realized it :) Hope that helps... Almost feel like I ought to invoice you at this point :-) :) Thanks for the pro bono consulting, you have indeed helped! Regards, /josh w. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] png.h not found, something's going wrong in my PHP installation
Curt Zirzow wrote: * Thus wrote Aaron Paulley: I found a thread a couple of weeks ago where someone had to create symbolic links in order to get their install of PHP to work because PHP wasn't able to find png.h. A reference to that thread could be helpfull. http://marc.theaimsgroup.com/?l=php-generalm=110288456229253w=2 -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] How to argue with ASP people...
Hello Richard, Tuesday, January 4, 2005, 5:28:18 PM, you wrote: RL You can't do: RL include /known/safe/path/$whatever.asp RL and have it pull in ASP and evaluate it. Actually, you can. RL and you don't have enough money to make me use it again. Likewise, I have no intentions of using ASP again either, but it can still do it. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I am not young enough to know everything. - Oscar Wilde -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Updated: Calendar Script
On Wednesday 05 January 2005 01:38, Joe Harman wrote: I haven't ever had the time to get into the smarty templating... I keep coming across apps that use it though.. I may spend some time checking it out... I've included the script with some updates... Also some CSS stuff and there is a second page that shows the hour break down of that day This list is not an appropriate channel for disseminating code that you have written. Instead, please use one or more of the following: freshmeat.net sourceforge.net www.phpclasses.org www.hotscripts.com Or even your own website. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] variable hell
On Tue, 2005-01-04 at 16:54 +0200, mario wrote: Hi all I have few variables in this format: $isproductssorttext = 150; $isofferssorttext = 250; $isnewproductssorttext = 350; $isproductscount = 50; $isofferscount = 30; $isnewproductscount = 20; etc What I want to do is have a variable e.g. $x = products; and create from that, the variable $is'products'sorttext (--$isproductssorttext) and use its value so if $x was offers on echo I would have (250) -- $isofferssorttext if $x was newproducts on echo I would have (350) -- $isnewproductssorttext Thanks in advance Mario This seems like an odd approach to doing this.. but here goes: $isproducttext = 120; $x = product; $y = is . $x . text; print $$y; -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development *--- Now supporting PHP5 --- / -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP5 Namespace ?
* Alawi Albaity [EMAIL PROTECTED]: is really that the support for namespace in php5 is removed ? or there are replacment for it ? It's been removed as it's not currently working: http://php.net/ChangeLog-5.php My understanding is that it will be at least 5.1 before namespaces are added -- if then. -- Matthew Weier O'Phinney | mailto:[EMAIL PROTECTED] Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTML attribute / url safe wordwrap function
Howdy, Yes, I've googled - and yes, I've searched the archives - but didn't find a solution for my problem. Here's the deal: On a website ppl can react on articles and post messages. The content of a message is given to a function which parses it all, taking care of long words which could mess up the interface. Or actually - it does do that. It all wraps perfectly fine with the following lines of code: ?php $txt = 'website ppl can react on articles a href=http://aspn.activestate.com/ASPN/docs/PHP/function.wordwrap.html;wordwrap/a'; $txt = preg_replace('#(a.*)((http|ftp|www).{13})(.*)(.{20})(/a)#U', ' $1$2(...)$5$6 ', $txt); $txt = preg_replace('/([\.\?\w\)\(\:\',!\-\=]{30})/', '$1 ', $txt); ? Unfortunately, this also breaks the weblink address. So, some wordwrapping function that doesn't do that would be cool. So far, I haven't been able to find it or create it myself. Somebody out there feels like giving it a shot? Thanks, Wouter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Calculate No Of Days
On Mon, 03 Jan 2005 22:58:49 -0500, Jerry Kita [EMAIL PROTECTED] wrote: Khuram Noman wrote: Hi Is there any function avialable in PHP to calculate the no of days by passing 2 dates like 1 argument is 1/1/2005 and the second one is 1/2/2005 then it returns the no of days or how can i do that if there is no builtin function . Regards Khuram Noman Maybe you can try the pear Date package - it has some handy function that does exactly what you're asking for: http://pear.php.net/package/Date/docs/1.4.2/apidoc/Date-1.4.2/Date_Calc.html#methoddateDiff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache Server with php
On Tue, 4 Jan 2005 08:37:26 -0800, Ramiro Trevino [EMAIL PROTECTED] wrote: Hi, I am having issues with the installation and configuration of my Apache server 2.0.52(win32). All is well when I restart the server with the exception of, when I load the following lines. I opened up the httpd.conf file and searched for #LoadModule ssl_module modules/mod_ssl.so. Directly underneath that line, I added LoadModule php4_module D:/php/sapi/php4apache2.dll. My plan was to run PHP as a module for Apache, instead of as a CGI binary but every time I add this line my server will not restart but I get an error stating The requested operation has failed. I checked to ensure the path was correct to this dll and all is well. Any suggestions? Thanks, Ramiro there's some *more* dll's you need to copy from the php package to somewhere under your PATH. I'm not really sure which ones, but the install notes do explain a lot. Or you can try to point your cmd line to the apache bin dir, and execute apache.exe . That should tell you why it can't start. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Persistent PHP web application?
Josh Whiting wrote: However, would a single process PHP server daemon be able to appropriately handle the incoming load from Apache, which will be running multiple processes handling concurrent incoming requests? I don't think you've quite got the right picture here... When you write your single process PHP server daemon, Apache's not even in the same picture frame any more. The requests aren't coming from Apache -- PHP is listening to a port you select, exactly in the same way that Apache listens to port 80, MySQL listens to 3306, your SSH server listens to 22, your Mail server listens to 25, your FTP server listens to [I forgot]... In other words, you are giving PHP a promotion from a Module of Apache, to being its own web server, only it won't be a web server, it will be a Whatever You Want server. I'll call it WYW (Whatever You Want) for the rest of this post. Just don't ask me how to pronounce WYW. :-) So you're going to write you own WYW server, which will: while (true){ Listen to port X for requests from WYW clients. make a socket back to them for the request send back your response in the WYW protocol } What you're really asking, or should be asking, is: Is PHP fast enough to handle heavy load as a WYW server? That should be fairly easy to test. There are pre-existing packages out there to make PHP sockets easy, or you could roll your own test in a day (max) of programming. Throw Apache Benchmark at it, or whatever you like to stress-test it. I'm betting the do-nothing PHP socket-server will handle VERY heavy load. That code is all thinly-disguised wrappers around the C socket library on your server -- The same library Apache, FTP servers, and so on are all using to handle their load, almost for sure. Whether or not what you need to *DO* with the incoming data and your calculations needed to compose a valid response will be fast enough really depends on what you want your WYW server to *DO*... You might even want to have multiple PHP processes going, just like Apache, if you need to handle really have load. Or, you might want to fork right before you calculate your response. Or... PHP is probably not the FASTEST language to do these things in -- but it's not going to slow you down horribly either. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session ID in query string
Sandy Keathley wrote: Using PHP 4.3.9, we have these settings: session.use_cookies = 1 session.use_only_cookies = 1 session.use_trans_sid = 0 (verified by a display of phpinfo() ) with the goal of preventing URLs with session IDs appended. That works fine, but when a page is validated by W3C, it throws an error, and indicates that a link on the page (which contains a query string), also contains the session ID. If I click the link, it doesn't show the session ID, but W3C can see it. W3C can't see anything you can't see with View Source in your browser. So is the session ID there or not?... W3C claims it is: You claim it isn't. One of you has to be wrong. :-) Your PHP code could easily be creating a URL with the session ID in it. Or W3C could be incorrectly interpreting your HTML. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache Server with php
Ramiro Trevino wrote: I am having issues with the installation and configuration of my Apache server 2.0.52(win32). All is well when I restart the server with the exception of, when I load the following lines. I opened up the httpd.conf file and searched for #LoadModule ssl_module modules/mod_ssl.so. Directly underneath that line, I added LoadModule php4_module D:/php/sapi/php4apache2.dll. My plan was to run PHP as a module for Apache, instead of as a CGI binary but every time I add this line my server will not restart but I get an error stating The requested operation has failed. I checked to ensure the path was correct to this dll and all is well. Any suggestions? I don't think you are allowed to specify a full path to your DLL. Copy the php4apache2.dll into the same directory where the SSL DLL is, and change the LoadModule to match as much as possible. Actually, if there are *ANY* other *working* Apache modules, use those as your guideline instead. You've got SSL commented out, so it's not much of a guideline to follow, since it's not working (on purpose) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] How to argue with ASP people...
On Tue, 4 Jan 2005, Richard Davey wrote: Hello John, Tuesday, January 4, 2005, 2:52:27 PM, you wrote: JN Standard comment in HTML, but it has another use with Apache, and I JN didn't find any reference to this type of syntax for ASP. !--#include file=whatever.asp -- and !--#include virtual=whatever.asp -- are both perfectly valid ASP syntax that will work on **IIS** Obviously you can do the usual stuff as in PHP, with: % filen = header.inc % !--#include file=%=filen%-- When you do % then you have broken out of ASP and are now writing HTML. You then do %=filen% to go back into ASP to get the value of the variable into the HTML code that you wrote. ASP is not including the file, it is only supplying a file name for SSI includes whether apache SSI or IIS SSI. The server parsing the HTML recognizes the HTML comment is sentax for server side include and includes the suppplied file name. Ron Clark Sysadmin/Webmaster Armstrong Atlantic State University -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Persistent PHP web application?
However, would a single process PHP server daemon be able to appropriately handle the incoming load from Apache, which will be running multiple processes handling concurrent incoming requests? I don't think you've quite got the right picture here... When you write your single process PHP server daemon, Apache's not even in the same picture frame any more. The requests aren't coming from Apache -- PHP is listening to a port you select, exactly in the same way that Apache listens to port 80, MySQL listens to 3306, your SSH server listens to 22, your Mail server listens to 25, your FTP server listens to [I forgot]... In other words, you are giving PHP a promotion from a Module of Apache, to being its own web server, only it won't be a web server, it will be a Whatever You Want server. I'll call it WYW (Whatever You Want) for the rest of this post. Just don't ask me how to pronounce WYW. :-) pronounce it like wha u as in wha u say? :) What I envision is an apache server running mod_php, opening sockets to a standalone WIW (whatever I want) server (a long-running PHP script) on some other port. Apache/mod_php handles the remote HTTP clients, the WIW server treats the php scripts running from apache as clients. This is what I meant by the incoming load from Apache. I'm betting the do-nothing PHP socket-server will handle VERY heavy load. That code is all thinly-disguised wrappers around the C socket library on your server -- The same library Apache, FTP servers, and so on are all using to handle their load, almost for sure. Whether or not what you need to *DO* with the incoming data and your calculations needed to compose a valid response will be fast enough really depends on what you want your WYW server to *DO*... You might even want to have multiple PHP processes going, just like Apache, if you need to handle really have load. Ok I'm getting the picture. Am I barking up the wrong tree with this whole concern for persistent PHP native variables and code? It seems like the implementation of a standalone PHP server is overkill and I ought to just throw more loadbalanced servers at the application rather than cut the application init time with a solution like this... or at least that is how I'm starting to see it. Not to say you're suggestions are in vain, if anything they're helping me to see the bigger picture. Regards, /josh w. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Persistent PHP web application?
Hello, on 01/04/2005 03:01 PM Josh Whiting said the following: Why don't you just create a daemon started from the command line (shell/DOS) and have it accept socket connections from your Web server PHP scripts and provide a SOA (Services Oriented API) to the code that accesses your data structures pre-loaded in memory? Setting up a separate persistent daemon PHP script is appealing to me because It implements exactly what I want, which is a persistent PHP application server, and also would allow me to abstract the implementation behind an API, move it to other servers when load increases, etc. However, would a single process PHP server daemon be able to appropriately handle the incoming load from Apache, which will be running multiple processes handling concurrent incoming requests? You can always make your daemon pre-fork a few processes using pcntl extension and delegate the execution of the requests to those processes keeping the parent daemon process there free most of the time just managing the requests and responses and child processes lifetime. This is basically how Apache works in pre-fork mode, except that there is a lot of overhead dealing with the HTTP protocol specifics. Implementing a multi-process forking SOAP server in pure PHP seems inefficient, but maybe I'm not understanding the basic premise/implementation of the suggestion? Forget SOAP. SOAP is meant for heterogenous environments on which client and server machines are independent and so they may not represent data in the same format. That is mostly why it uses XML (a text based format) to exchange messages. There is at least one PHP SOAP extension but that does not avoid the overhead of marshalling and unmarshalling request and response messages in XML. Since you will be doing your own client and servers and do not have the need to share it to the world, you can crank your own proprietary format probably with marshalling based on PHP pack and unpack functions. -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session ID in query string
Richard Lynch wrote: Sandy Keathley wrote: Using PHP 4.3.9, we have these settings: session.use_cookies = 1 session.use_only_cookies = 1 session.use_trans_sid = 0 (verified by a display of phpinfo() ) with the goal of preventing URLs with session IDs appended. That works fine, but when a page is validated by W3C, it throws an error, and indicates that a link on the page (which contains a query string), also contains the session ID. If I click the link, it doesn't show the session ID, but W3C can see it. W3C can't see anything you can't see with View Source in your browser. So is the session ID there or not?... W3C claims it is: You claim it isn't. One of you has to be wrong. :-) Your PHP code could easily be creating a URL with the session ID in it. Or W3C could be incorrectly interpreting your HTML. if you're using a decent browser, try turning OFF cookies and reloading the same page. Then make sure that the link REALLY doesn't contain the sid -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML attribute / url safe wordwrap function
On Tue, 4 Jan 2005 16:41:16 -0500, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I don't know if I understand exactly what you're trying to do, but you might try the HTML tag nobr/nobr to get the HTML not to wrap the line. See if that helps at all. Good luck! -TG = = = Original message = = = Howdy, Yes, I've googled - and yes, I've searched the archives - but didn't find a solution for my problem. Here's the deal: On a website ppl can react on articles and post messages. The content of a message is given to a function which parses it all, taking care of long words which could mess up the interface. Or actually - it does do that. It all wraps perfectly fine with the following lines of code: ?php $txt = 'website ppl can react on articles a href=http://aspn.activestate.com/ASPN/docs/PHP/function.wordwrap.html;wordwrap/a'; $txt = preg_replace('#(a.*)((http|ftp|www).13)(.*)(.20)(/a)#U', ' $1$2(...)$5$6 ', $txt); $txt = preg_replace('/([\.\?\w\)\(\:\',!\-\=]30)/', '$1 ', $txt); ? Unfortunately, this also breaks the weblink address. So, some wordwrapping function that doesn't do that would be cool. So far, I haven't been able to find it or create it myself. Somebody out there feels like giving it a shot? Thanks, Wouter Nono .. this is actually quite the opposite ;). Thing is, I'm expecting input like: Hi I aM sOmeBodY whO Is anNoyiNg *-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*= looK heRe: a href=www.somewhere.com/some/long/path/exceeding/30/chars/and/even?more=notlesswww.somewhere.com/some/long/path/exceeding/30/chars/and/even?more=notless/a this long line of sequential characters causes the website interface to stretch and thus needs to be wrapped. Using php's wordwrap() function won't do, cuz it will also wrap the URL so I'd be looking for some function that only adds some whitespace to strings outside and signs. Or: not between and (input is shown as it eventually reaches the mentioned calls - I do not actually allow thtml to be entered :P) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Calculate No Of Days
Is there any function avialable in PHP to calculate the no of days by passing 2 dates If you happen to be pulling both dates from MySQL you could use the MySQL date functions: http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html http://dev.mysql.com/doc/mysql/en/Date_calculations.html If that is not possible and you don't/can't use the Pear Date library recommended previously you could do date arithmetic using unix timestamps. So, take the timestamp of 1/1/2005 and subtract the timestamp of 1/2/2004. That will give you the number of seconds between the two dates and from there you can figure out how many days are between the two. - Jamie Hi Is there any function avialable in PHP to calculate the no of days by passing 2 dates like 1 argument is 1/1/2005 and the second one is 1/2/2005 then it returns the no of days or how can i do that if there is no builtin function . Regards Khuram Noman Maybe you can try the pear Date package - it has some handy function that does exactly what you're asking for: http://pear.php.net/package/Date/docs/1.4.2/apidoc/Date-1.4.2/Date_Calc.html#methoddateDiff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] oscommerce
hi i have a site using oscommerce script, i made some modifications but i am stuck with a variable there. i can't describe it here cause no one will understand what i mean, so is there any one familiar with oscommerce , so he can guide me, it won't take more than 5 minutes if yes plz add me to msn messenger with [EMAIL PROTECTED] or yahoo msn with ID me2resh thanks -- Ahmed Abdel-Aliem Web Developer www.ApexScript.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache Server with php
richard... i'm not sure of the email/list name.. but there is an apache email list.. if you get to the apache.org site.. they could help you.. they're actually pretty good.. sorry i don't have the name right at my fingers right now!! good luck... -Original Message- From: Richard Lynch [EMAIL PROTECTED] Sent: Jan 4, 2005 12:31 PM To: Ramiro Trevino [EMAIL PROTECTED] Cc: php-general@lists.php.net Subject: Re: [PHP] Apache Server with php Ramiro Trevino wrote: I am having issues with the installation and configuration of my Apache server 2.0.52(win32). All is well when I restart the server with the exception of, when I load the following lines. I opened up the httpd.conf file and searched for #LoadModule ssl_module modules/mod_ssl.so. Directly underneath that line, I added LoadModule php4_module D:/php/sapi/php4apache2.dll. My plan was to run PHP as a module for Apache, instead of as a CGI binary but every time I add this line my server will not restart but I get an error stating The requested operation has failed. I checked to ensure the path was correct to this dll and all is well. Any suggestions? I don't think you are allowed to specify a full path to your DLL. Copy the php4apache2.dll into the same directory where the SSL DLL is, and change the LoadModule to match as much as possible. Actually, if there are *ANY* other *working* Apache modules, use those as your guideline instead. You've got SSL commented out, so it's not much of a guideline to follow, since it's not working (on purpose) -- Like Music? http://l-i-e.com/artists.htm -- 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] Re: Persistent PHP web application?
On Tue, 2005-01-04 at 16:06, Josh Whiting wrote: However, would a single process PHP server daemon be able to appropriately handle the incoming load from Apache, which will be running multiple processes handling concurrent incoming requests? I don't think you've quite got the right picture here... When you write your single process PHP server daemon, Apache's not even in the same picture frame any more. FWIW, I can't see how a WYW server is going to make his application run faster. The transfer of the data he wants will still have to be serialized and unserialized (in an optimal WYW server only unserialized) and this is is exactly his bottleneck using an include. Actually I'd imagine because he's using an accelerator it's fast as it can get without using some kind of shared memory system. Correct me if I'm confused and you know how to transfer raw zend vars over a socket without the need to unserialize on the receiver end. 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[3]: [PHP] How to argue with ASP people...
Hello Ron, Tuesday, January 4, 2005, 5:59:31 PM, you wrote: RC You then do %=filen% to go back into ASP to get the value of the RC variable into the HTML code that you wrote. ASP is not including the file, RC it is only supplying a file name for SSI includes whether apache SSI or RC IIS SSI. The server parsing the HTML recognizes the HTML comment is RC sentax for server side include and includes the suppplied file name. Perhaps this is a better example for you: script1.asp % StrName = bob % script2.asp !--#include file=script1.asp-- % Response.Write Hello StrName % Clearer now? I understand what you're saying perfectly, but in the context of ASP scripts I am afraid it's wrong. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I am not young enough to know everything. - Oscar Wilde -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[3]: [PHP] How to argue with ASP people...
--- Richard Davey [EMAIL PROTECTED] wrote: Perhaps this is a better example for you: script1.asp % StrName = bob % script2.asp !--#include file=script1.asp-- % Response.Write Hello StrName % Clearer now? It looked to me like he understood before. If your example is the only way to include files, it demonstrates that ASP cannot do it (ASP stuff happens between % and %), but that this limitation doesn't prevent an ASP developer from modularizing code when there is support for SSI. The point is that you're relying on a mechanism in the server (e.g., Apache or IIS) and not in the language. The include and require language constructs in PHP can be used independently of support for SSI. Hope that helps. Chris = Chris Shiflett - http://shiflett.org/ PHP Security - O'Reilly HTTP Developer's Handbook - Sams Coming Soon http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache Server with php
Bruce Douglas wrote: richard... i'm not sure of the email/list name.. but there is an apache email list.. if you get to the apache.org site.. they could help you.. they're actually pretty good.. sorry i don't have the name right at my fingers right now!! good luck... http://httpd.apache.org/lists.html -- By-Tor.com ...it's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] multiple deleting and updating raw
Hi all, I meet a problem when I want to deleting a multiple row, I have a table that contain columns UserID, name, company name, and bill. UserID is uniq. perhaps, some of UserID, say it five UserID I have to delete, how to delete all raw that contain that UserID ? and if I want to update bill of a users (multiple user) that data of users taking from a file ( so the file contain user UserId and bill), how to make it ? Thanks, Aji __ Do you Yahoo!? Meet the all-new My Yahoo! - Try it today! http://my.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[5]: [PHP] How to argue with ASP people...
Hello Chris, Wednesday, January 5, 2005, 12:58:43 AM, you wrote: CS but that this limitation doesn't prevent an ASP developer from CS modularizing code when there is support for SSI. There is always support for SSI on IIS, infact removing this support is a registry editing hassle in its own right. So to assume you will have this functionality is, unlike with Apache, perfectly valid for the vast majority of ASP developers. Still, you are right it is indeed a server controlled feature, it is however one you can actually rely on having. I guess from M$'s point of view it makes sense - to them you only host ASP pages on IIS boxes, and IIS always pushes scripts through the SSI DLL, so there was probably no real need to duplicate an already existing feature. It is a testament to PHPs vision they think more outside the box than this, but the net result is the same. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I am not young enough to know everything. - Oscar Wilde -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP5 Namespace ?
Matthew Weier O'Phinney wrote: * Alawi Albaity [EMAIL PROTECTED]: is really that the support for namespace in php5 is removed ? or there are replacment for it ? It's been removed as it's not currently working: http://php.net/ChangeLog-5.php My understanding is that it will be at least 5.1 before namespaces are added -- if then. It will not be added in PHP 5.x. 6.0 is the next version that will consider adding them, unless someone comes up with a brilliant implementation that doesn't break everything. Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Saving Files
Hi all. Note, this may be a bit off topic. With that said... I am wanting to save a file off my website to a certain location on my computer. Is there a way to click on a button (or something) and that invokes the download, which then saves to (for example) C:\SomePlace\Directory\Pizza\sausage.txt? The whole process: 1. User uploads from a specific location (that I already know) 2. Modifies the file via the web 3. Saves/downloads the file to that exact location as pulled from and replaces the old file It seems as though this can be done but I have not found a way to do it, and I have searched a lot. Any thoughts on how to? Thanks in advance, ~Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] multiple deleting and updating raw
Sejati Opreker wrote: Hi all, I meet a problem when I want to deleting a multiple row, I have a table that contain columns UserID, name, company name, and bill. UserID is uniq. perhaps, some of UserID, say it five UserID I have to delete, how to delete all raw that contain that UserID ? and if I want to update bill of a users (multiple user) that data of users taking from a file ( so the file contain user UserId and bill), how to make it ? http://lists.mysql.com/ -- By-Tor.com ...it's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] making FORM dissapear when successful login
I had this code working the way i wanted it to (as far as correct username and password allowing successful login)...but what i want to happen now is when a user successfully logs it it will make the login form disappear and just say successfully logged in or welcome user and a link below it so they can log off and make the form re-appear. Below is the code that i have where i tried to get it to disappear on successful login, but it stays disappeared all the time. Can someone please point out what im doing wrong. I have tried everything i can think of...and nothing works. Im a PHP newbie...so im sure some of you might get a laugh out of this...if it is real easy. ---snippet !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; html head link href=style.css rel=stylesheet type=text/css / /head body div id=container div id=top h1header/h1 /div div id=leftnav p ?php $username=$_POST['username']; $password=$_POST['password']; $db=user; $server=localhost; $db_username=root; $db_password=***; $connect = mysql_connect($server,$db_username,$db_password); if (!$connect) { die (could not connect to database); } $select = mysql_select_db($db,$connect); if (!$select) { die (could not select database $db); } /*username='$username';*/ $sql = SELECT * FROM passwords, user_info where id=PID and username='$username'; $result = mysql_query($sql); /*$num_rows = mysql_num_rows($result);*/ while ($user = mysql_fetch_array($result)) { $id = $user['id']; $username2 = $user['username']; $password2 = $user['password']; $firstname = $user['firstname']; $email = $user['email_address']; IF ($username==$username2 $password==$password2) { echo(\Welcome, b$firstname/b\);?br? echo (\Your email address is b$emailb\);?/tdtr a href=?$_SERVER['PHP_SELF']??username=?password=Logoff/a? break; } else { ? FORM action=?$_SERVER['PHP_SELF']? method=post INPUT type=hidden name=id table tdb*/bUsername:/td tdINPUT class=input size=8 type=text name=username value=?echo $username?/tdtr tdb*/bPassword:/td tdINPUT class=input size=8 type=password name=password/tdtr td class=xsmallb* Case Sensitive/b/td tdINPUT type=submit value=Login/tdtr tdnbsp /td /table /FORM ? break; } } //IF ($username != $username2 || $password != $password2) {// ?br ? if ($username == $password == ) { echo (Please type in a Username and Password);} if ($username != $password == ) { echo (Please type in a password);} if ($username == $password != ) { echo (Please type in a username and password);} ? /p /div ?if (($username2==$username $password2==$password) ($username2!= || $password2!=)){? div id=rightnav class=box p /p /div ?}? div id=content h2Subheading/h2 p /p p /p /div div id=footer p Today is ?php echo( date(F dS Y.)); ? /p /div /div /body /html snippet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Saving Files
Hello prthomp, Wednesday, January 5, 2005, 1:24:24 AM, you wrote: pue The whole process: pue 1. User uploads from a specific location (that I already know) pue 2. Modifies the file via the web pue 3. Saves/downloads the file to that exact location as pue pulled from and replaces the old file pue It seems as though this can be done but I have not found a pue way to do it, and I have searched a lot. Any thoughts on how to? Not possible with PHP. Perhaps with a signed Java applet, but otherwise no - you'll fall over on the final saves to exact location and replaces old file stage, every single time. You just don't have that level of control over what happens when you send the file back to the browser. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I am not young enough to know everything. - Oscar Wilde -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] png.h not found, something's going wrong in my PHP installation
* Thus wrote Richard Lynch: Curt Zirzow wrote: * Thus wrote Aaron Paulley: I found a thread a couple of weeks ago where someone had to create symbolic links in order to get their install of PHP to work because PHP wasn't able to find png.h. A reference to that thread could be helpfull. http://marc.theaimsgroup.com/?l=php-generalm=110288456229253w=2 The symlinc'ing this is doing makes sense. According to your original post you had png.h in your /usr/lib directory wich doesn't make sense. Curt -- Quoth the Raven, Nevermore. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] oscommerce
* Thus wrote Ahmed Abdel-Aliem: hi i have a site using oscommerce script, i made some modifications but i am stuck with a variable there. i can't describe it here cause no one will understand what i mean, so is there any one familiar with oscommerce , so he can guide me, it won't take more than 5 minutes if yes plz add me to msn messenger with [EMAIL PROTECTED] or yahoo msn with ID me2resh You might want to research or ask a question on ths oscommerce forum. Curt -- Quoth the Raven, Nevermore. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] XML File validation using PHP????
We are running PHP 4.3.2 Is there a class out there that can validate an xml file against a schema? I know in PHP 5+ that the dom package includes simple validation function, but until we upgrade, that's not an option. Can anybody point me in the write direction? I want something simple to where I can: ?php include xmlvalidator.class.php; $xmlvalidator = new xmlvalidator(); $xmlvalidator-xmlfile('/foolocation/foo.xml'); $xmlvalidator-schemafile('/foolocation/foo.xsd'); echo $xmlvalidator-validate(); ? If there is someting out there similiar that'd be great, if not can someone please explain to me the basics of validating xml against a schema file? Thanks, Brent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to argue with ASP people...
Hello Richard, Tuesday, January 4, 2005, 10:28:18 AM, you wrote: RL Or am I mis-remembering the horrors of ASP? It's been awhile since RL I've used it, and you don't have enough money to make me use it RL again. You're telling me!!! grin I wrote three, count 'em, all of three ASP database front ends before I'd even heard of PHP. I then got into PHP and just a month ago I was asked to make a few changes to one of those ASP apps I did a cpl years back and I sat there staring at the code going Where the H*ll did all the opening and closing curly braces go? I can't tell where a while statement ends and a for loop begins. It actually took me a while of staring at it before anything started coming back to me. After I made the changes, I just felt, well, so dirty ;-) Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site http://www.PCWize.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Persistent PHP web application?
Robert Cummings wrote: FWIW, I can't see how a WYW server is going to make his application run faster. The transfer of the data he wants will still have to be serialized and unserialized (in an optimal WYW server only unserialized) and this is is exactly his bottleneck using an include. Actually I'd imagine because he's using an accelerator it's fast as it can get without using some kind of shared memory system. Correct me if I'm confused and you know how to transfer raw zend vars over a socket without the need to unserialize on the receiver end. You are correct, serialization tends to be the bottleneck when it comes to restoring large data structs. So you either avoid recreating the data structure and just use the data directly, or use an in-process mechanism like apc_store/apc_fetch which does a straight memcpy and doesn't need top serialize. Of course, this still doesn't match writing your own extension to manage your persistent data directly without needing to shuffle it around back and forth between process and shared memory. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] apache 1 vs 2 w/php
I am undecided whether to upgrade to apache 2 (currently running 1.3.33) I've heard some bad stuff (some good maybe) about using apache 2 with php.. does anyone have an opinions? I know everything has cons/pros but i am just looking for advice on whether my site will benifit from the upgrade. I'm curious to know if a site that normally sees 300-500 users online would see any improvements. any on going issues? is php faster/slower? downsides? advantages? anything in general that can help me decide. thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php