Re: [PHP] IPs comparing
On Thu, 28 Nov 2002 02:19:18 +0800 Jason Wong <[EMAIL PROTECTED]> wrote: > > I have several subnets in my network and want to show different webs > > depending on the subnet the user was. > > I know how to get the IP but not how to compare two IPs numeracally, > > I mean: > > If ((USER-IP > 192.168.0.1) && (USER-IP < 192.168.0.255)) > > Else if ((USER-IP > 192.168.1.1) && (USER-IP < 192.168.1.255)) > > What do you suggest me? > > If the cases are as simple as the examples above then you can just use > string comparison functions Or look at the ip2long/long2ip functions (and there's a couple of other IP handling classes in PEAR) Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Alternate location for PEAR downloadable documentation
On Fri, 13 Dec 2002 08:41:12 -0600 "Chris Boget" <[EMAIL PROTECTED]> wrote: > Is there one? > http://pear.php.net/distributions/manual/pear_manual_en.html.gz > (and all the other downloadable documentation) seem to have gone > awol. I saw that yesterday when I went to download it myself. I put an entry into the bug-tracker about it. http://bugs.php.net/bug.php?id=20959 Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] AAAAGGGHHHH!!! Help!!
On Fri, 11 Jul 2003 16:41:06 -0400 "Mike Mannakee" <[EMAIL PROTECTED]> wrote: > I am running a query in mysql : > ... WHERE > visitors.created > DATE_SUB( CURRENT_DATE, INTERVAL 1 HOUR ) > AND > id = pixeldata_.remote > GROUP BY > visitors.id CURRENT_DATEnow( ) DATE_SUB( CURRENT_DATE, INTERVAL 1 HOUR ) 2003-07-11 2003-07-11 22:02:022003-07-10 23:00:00 I think you'd want: DATE_SUB( NOW( ) , INTERVAL 1 HOUR ) 2003-07-11 21:02:02 Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail() question
> On Mon, 25 Aug 2003 01:09:29 +0200 Matthias Wulkow <[EMAIL PROTECTED]> > writes: > > > > Hi php-general, > > I have followig error reported: > > > > Fatal error: Call to undefined function: mail() in > > /usr/local/www/login.php on line 235 > > What is the trouble here? If I would have trouble because of > > delivery, normally mail would return false. But here... > > I have php4.3.1 running on linux. I just installed postfix to have > > the > > sendmail binary at the right place. Did you install postfix _after_ PHP? Did you have a sendmail binary in place before you configured PHP? If it's not there are configure time, it won't even compile the 'mail' function. I've had the same problem before - now that PHP can recognise it's got a way to send email, re-running ./configure / make / make install should work. It did for me. Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail() question
On Mon, 25 Aug 2003 14:24:25 +0200 Matthias Wulkow <[EMAIL PROTECTED]> wrote: > A> Did you install postfix _after_ PHP? Did you have a sendmail > A> binary in place before you configured PHP? If it's not there are > A> configure time, it won't even compile the 'mail' function. > Yes and there was no sendmail binary before... > > A> I've had the same problem before - now that PHP can recognise it's > A> got a way to send email, re-running ./configure / make / make > A> install should work. It did for me. > > I did that, but I forgot to do 'make clean'... now it seems to work. > But I have still one question: > when sending mail with this sendmail binary, is it possible to pass > the mail to a local mail server instead of sending it directly to the > recipient? Thats a mail configuration issue. Alternatively you can have the send the email by SMTP to your primary mail server which then sends it on from there. Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Register Globals Off in .htacces
On Fri, 25 Oct 2002 13:16:27 +0300 Tjoumaidis <[EMAIL PROTECTED]> wrote: > Hi to Everyone, > I just want to know if there is a way that i can have register_globals > On in my php.ini file but for some application i can turn that Off > perhaps with a .htacces file. I prefer it Off in php.ini and On in the .htaccess file. php_flag register_globals On Yes, you can do it. Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] standardization across apps?
On Tue, 29 Oct 2002 00:14:06 -0500 taylor <[EMAIL PROTECTED]> wrote: > i might be crazy, but why don't the many CMS, forum, link directory, > etc packages integrate with a unified user manager? > is this possible? is there perhaps an xml standard for contact > datatypes that could be used? There is a system in PEAR that does that - and I think if they can really get it right - and get it widely used, it will be a killer tool - avoiding all the problems you say. XML is, I think, the wrong tool for this job though. As others have said, making better use of classes to package up applications, even if it means that a program is just a very thin layer that calls the class, would also be incredibly useful - if they just dump output to screen - or use one common template solution (like http://Smarty.php.net). then programmers (like me) could really take different systems and with some very simple configuration, they would just all work together, and without having to write inside a particular framework, like phpNuke or Horde. Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anti Spam software
On Thu, 21 Nov 2002 07:26:34 +1100 "electroteque" <[EMAIL PROTECTED]> wrote: > anyone know of any good anti spam software for linux ?? and maybe be > able to monitor it with php ? SpamAsassin. You could probably set the spam to be fed to a PHP script as well, but I just throw it all to a text file, or filter it (or not) in the email program. Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with Displaying RSS feed links
On Tue, 9 Sep 2003 15:35:48 -0500 "Frank Miller" <[EMAIL PROTECTED]> wrote: > Hello all, > > I'm working on an entry page where I would like to show some of the > current headlines from technology websites. I've been following and > pretty much understand the article on devshed > http://www.devshed.com/Server_Side/PHP/PHPRDF/page1.html Plugging RDF > content into your Website. From what I gather from the article is that > he uses a foreach loop to display the Title, link and description > which could be anywhere from 5 to 15 links. I only have room on my > page for 3 and then I plan on putting a more link taking visitors to a > page where I'll have more room. > Can anyone point me in the right direction? Right now I don't get an > error but I also don't get any text or results. http://pear.php.net/manual/en/package.xml.xml-rss.example.php require_once "XML/RSS.php"; $rss =& new XML_RSS("http://slashdot.org/slashdot.rdf";); $rss->parse(); echo "Headlines from http://slashdot.org\";>Slashdot\n"; echo "\n"; >$i = 0; foreach ($rss->getItems() as $item) { >if ($i == 3) > break; echo "" . $item['title'] . "\n"; $i++; } echo "\n"; ?> Done. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] "Too many connections" fix?
On Wed, 1 Oct 2003 21:17:09 -0700 (PDT) Chris Shiflett <[EMAIL PROTECTED]> wrote: > --- Nicole <[EMAIL PROTECTED]> wrote: > > So I switched to connect, with no luck in fixing the "too many > > connections" problem. > > Now that's some helpful information. The first thing you need to do is > forget about persistent connections being the problem. > > I don't claim to be an expert at debugging MySQL issues such as this, > but I have always found Jeremy Zawodny's mytop to be a very handy > tool: > > http://jeremy.zawodny.com/mysql/mytop/ You problem may well be that 100 apache processes * dozens of tables = thousands of open mysql-connected threads, and they are not being closed for a default 8 HOURS. You can see them in PhpMyAdmin's process list. You'll want something like this in your mysql.ini file to reduce the time-outs: [mysqld] set-variable= max_connections=750 set-variable= wait_timeout=60 set-variable= thread_cache_size=40 # after 60 secs, expire any waiting threads # but keep up to 40 available in a cache for easy re-use. JZ mentions thread caching here: http://jeremy.zawodny.com/blog/archives/000173.html Running a PHP cache like PHP Accellerator will also help, so the PHP isn't being reparsed all the time as well. Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] variable variables
On Thu, 17 Jan 2002 11:11:43 -0500, you wrote: >I can not wrap my head around variable variables today, not awake yet or >something. > >For instance I trying something like this: > >while ($i<$loopcounter) { > $temp = "size"; > $valueofsize = $$temp$i; > $i++; >} What about $i = 0; // set the start (or use for()) while ($i<$loopcounter) { > $temp = "size". $i; // $temp = 'size1', 'size2'... $valueofsize = $$temp; $i++; # untested code, should be OK though } No messing around with evals neccessary. Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Feature?
Follow up to my own message: If you want to also skip even needing the empty 'array()' (new fianl example) - check if it is an array, and only do the first extract of the parameters if there's something there. 'default fred', 'foo_banana' => 'default bananananana', ); if (is_array($p)) extract ($p, EXTR_PREFIX_ALL, 'foo'); // get values extract ($foodefault, EXTR_SKIP, "foo");// get defaults echo "$foo_fred / $foo_banana"; } echo "Both in place: "; foo(array('fred' => 'hello', 'banana' => 'world')); echo " Now with a missing param: "; foo(array('fred' => 'hello')); echo " Now both missing params: "; foo(array()); echo " and with no array: "; foo(); ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Extract. Was Re: Feature?
On Wed, 26 Sep 2001 09:47:57 -0500, you wrote: >Just looking up that extract function, the manual says it extracts into >the current symbol table. I assume that means that within foo() the >array would be extracted into local variables. Is that right? As http://www.php.net/manual/en/function.extract.php says: This function is used to import variables from an array into the current symbol table. You might want to try declaring the variables that are to be extracted as global - and see what happens, but I tend to prefer keeping things to large configuration arrays and then local vars only where I can. >> $foodefault = array( >> 'foo_fred'=> 'default fred', >> 'foo_banana' => 'default bananananana', >> ); Caveat Programmer: don't name the default array foo_default (or '{PREFIX}_') - if you had a parameter called 'default', the first extract would overwrite it, and the second would probably fail (or if it was an array, extract it - but still not what you wanted). Caveat Programmer 2: You have to name the default variables in the array the full and proper post-prefixed name, extract does not appear to be able to (currently) EXTR_PREFIX_ALL _and_ EXTR_SKIP. Alister Please don't send the mailing lists and CC me - getting two copies just bugs me. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] exists max number of case block in switch steatment ?
Gianni Pirini wrote: Hello !! First of all, sorry for my english... I've one question, what is a reasonable max number of case block in a switch steatment? If i want to redirect 300 pages, for example, to one page index.php?id=32 and include in this page, in base of the id value, 300 different pages, i can have some problem or not ? If mod_rwwrite wasn't suitable, I'd use a lookup table: $callFunc = array( 32 => 'ShowIndex', 92 => 'InputForm', ); if (isset($callFunc[$_GET['id']]) and function_exists($callFunc[$_GET['id']])) { $func = $callFunc[$_GET['id']]; $retval = $func(); } Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Conditional include based on virtual host ?
On Fri, 26 Jan 2001 14:52:28 +0100, you wrote: >Hello, > >I have developed a large web application the contents of which (language and >data) depends on the URL the site is accessed from, e.g. en.site.com would >display the "english" site, and "fr.site.com" would display the french site It's a good way to do it, I wrote an extension to FastTemplates (and the phplib templates.inc) to help with such an event so you could have multiple levels of templates, falling back eventually (and hopefully, or it's broken) to a default set. The defaults could be English (and no-language, others could be fr, es, pt, Klingon, whatever. A different name to access the site could look utterly different, just have most of the same content on the page, in different places. I was going to use it to re-skin websites according to who it was for (originally it was going to be a 'virtual bookshop' that companies could brand for themselves). >The whole thing is "parameterized" through a set of global variables (or >defines) that reside in a file called settings.php. The question is: how can >I include the "right" settings.php file, depending on the virtual host used >to access the site? Take a look at the output of phpinfo() for the two virtual sites, especially HTTP_SERVER_VARS["HTTP_HOST"] HTTP_SERVER_VARS["SERVER_NAME"] Server_name is likely to be the 'main name' (www.example.com), but http_host should be the name it's called by (not always the same thing) Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Optimizing Tips
On Thu, 5 Aug 2004 16:17:34 +0530, Vinayakam Murugan <[EMAIL PROTECTED]> wrote: > I am a fresh PHP programmer and am part of a team developing a LAMP based > website. The problem we are facing is that when the site was hosted on a > local server, it was quite fast. Now that we have to use the internet to get > to it, it has become very slow even keeping in mind considerations like > connection speed . > Any pointers on what & how optimizations can be done? How big are the pages you are sending around? How much data are you getting from external sources (like a mysql database or draged in from other sites). How fast is the ilnk from the webserver? There's a lot of good questions you can ask to figure it out. For the first, you can trim the html and images you are sending, and gzip the output (see mod_gzip or http://php.net/ob_gzhandler Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Appending into associative arrays
On 15/04/07, Zoltán Németh <[EMAIL PROTECTED]> wrote: 2007. 04. 15, vasárnap keltezéssel 21.20-kor Otto Wyss ezt írta: > I want to sort directories according there modification time and thought > accociative arrays would be perfect. But when I add an element like > > $dirs = array (filemtime($d) => $d) (sorry the previous one is incorrect, I misunderstood what you wanted...) so: $dirs[filemtime($d)] = $d; Better, I think, to put the unique thing - the name, as the index. Two directories may have the same modification time. $dirs[$d] = filemtime($d); Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Appending into associative arrays
On 15/04/07, Robert Cummings <[EMAIL PROTECTED]> wrote: On Sun, 2007-04-15 at 20:36 +0100, Alister Bulman wrote: > On 15/04/07, Zoltán Németh <[EMAIL PROTECTED]> wrote: > > 2007. 04. 15, vasárnap keltezéssel 21.20-kor Otto Wyss ezt írta: > > > I want to sort directories according there modification time and thought > > > accociative arrays would be perfect. But when I add an element like > Better, I think, to put the unique thing - the name, as the index. > Two directories may have the same modification time. > $dirs[$d] = filemtime($d); Has he even retrieved the directories in sorted order by modification time? If not he still needs to sort. Then he'll need an asort($dirs); They would not have come in any particular order, so you have to sort them for whatever you need anyway. Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Queuing servers
On Thu, Dec 2, 2010 at 10:10 PM, la...@garfieldtech.com wrote: > Hi folks. > > I have a project coming up where I will need to process a bazillion (OK, a > few million) records, possibly with multiple steps. (In this case I'm > reading data from one data archive into an Apache Solr server.) This is a > natural use case for a queue server, I believe, and while the requirements > of the project do not dictate a language it makes sense to me to use PHP for > the processing code since 1) Other parts of the project will be using it for > web-facing logic and 2) It's the language I know best. > > I'm trying to select a queue server to use. The two I'm investigating in > particular are Beanstalkd (http://kr.github.com/beanstalkd/) and Gearman > (http://gearman.org/). In this case I do need a reliable queue, even if > that means a record gets processed multiple times by accident (which in this > use case is fine). > > Has anyone worked with either of these systems? Any war stories to share, > good or bad? Any guidelines on the number of resources we need? I did a presentation at the PHP London meetup in May - my slides with some good Beanstalk points are at: http://abulman.co.uk/2010/05/queues-and-beanstalkd/ Gearman does have the advantage of being pretty much drop-in and work, calling remote PHP functions (or other languages that are setup as workers). With beanstalkd, there is no solid framework in place yet (though there are a couple of things around, I've seen one for CakePHP, and something for Drupal I think). That said, it's not hard to write one, depending on your personal choice of development framework, or not. Both have solid C-based daemons backing them up (which are so much easier to run than the original Perl daemon). I see Beanstalk as more flexible though, the Priorities, TTR limits, tubes and optional delays make for a powerful set of tools within the queue itself. Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multipart Email Problem
On Thu, 24 Jun 2004 12:27:17 +0100, Matt MacLeod <[EMAIL PROTECTED]> wrote: > > I have a script that sends a multipart email from a php page. > > The script appears to work fine on my mail client (Mail on Mac OSX) and > on an online email reader (mail2web.com). > > However a colleague using Outlook on Windows 2003 views the whole email > (ie the raw code - both the text only and the HTML) and when I sent an > email to his hotmail account, hotmail simply displayed a blank page. Sorting out the MIME headers is not easy. So user http://pear.php.net/package/Mail_Mime to do the hard work. Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Selecting a special row from the database
On 04/05/07, Marcelo Wolfgang <[EMAIL PROTECTED]> wrote: I'm building a news display page for a website, and since the user has 2 ways to arrive there, I want to know if this is possible: 1) the user arrive at news.php I will run a query at the db, and get the latest news to be the main one (full display) and display the others news in a list 2) the user arrived from a link to a specific news to news.php?id=10 It should display the news with id = 10 as the main news and get the latest ones to display in a list of other news Here is the code I have so far, I hope it serve as a better explanation than mine! Yep, thats pretty classic. One thing I would do - assuming $newsId should always be an integer $whereClause = ''; if (isset($_GET['id']) { $newsId = intval($_GET['id']); if ($newsId) // if not 0 $whereClause = 'WHERE auto_id ='.$newsId; } . Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question
On 13/05/07, Robert Cummings <[EMAIL PROTECTED]> wrote: On Sat, 2007-05-12 at 23:03 -0500, Richard Lynch wrote: > You may find this entertaining, and even useful: > http://richardlynch.blogspoot.com I'm sure Richard meant http://richardlynch.blogspot.com Unless he's trying to promote bondage and S&M >:) Well, I found this entertaining. As for useful? I'll say no. Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include???
On 23/05/07, Dan Shirah <[EMAIL PROTECTED]> wrote: Okay, I think I'm doing everything right, but for whatever reason my include isn't working. if ($_POST['status_code'] = "C") { It's a pretty classic error, Not one that I make very often though - because I will generally write: if ('C' = $_POST['status_code']) { If I wrote that, it would fail instantly - because you can't assign to a constant, so you use double - or triple, as appropriate - equals. if ('C' == $_POST['status_code']) Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array difficulty
On 31/07/07, Carlton Whitehead <[EMAIL PROTECTED]> wrote: >> Couldn't you just do >> arsort($chance); >> $lastItem = chance[( count( $chance ) - 1 )]; > I tried that earlier, but the problem is: > count( $chance ) - 1 ); returns an integer, so I would be asking for > something like $chance[1] or $chance[0], neither of which exist in the array. > Keep in mind $chance only has keys with string names: http://uk3.php.net/current $chance = array("lowercase" => 27, "uppercase" => 62, "integer" => 46); arsort($chance); $lastItem = current($chance); echo "$lastItem\n\n"; // 62 Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File extension for PHP's serialization format?
On 27/10/06, Stut <[EMAIL PROTECTED]> wrote: Hamish Lawson wrote: > I have a web application (not written in PHP) that can return data in > various formats, including JSON and PHP's serialization format. At the > moment my URL scheme looks like this: > staff/engineering?format=json > but I'd like to switch to using a file extension to denote the format: > staff/engineering.json Given that file extensions are purely for association purposes and no application I am aware of knows what to do with PHP serialised data, personally I would use .dat. Or, if I wanted it to be more descriptive, something like .phpdata. But to be perfectly frank it doesn't matter. I know of one website (Livejournal) that has /url.../data/rss or /data/atom etc. /data/php, /data/wddx or /data/json are pretty obvious extensions to that. That said, since all are them are designed for a script to consume, and not a person, I'd call them entirely 'clean' and obvious enough for the task, though ultimately, it's about having a pretty URL, as the program that reads it won't care what the extension is, if any, and people won't be typing it in regularly anyway. Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why Should I Use Zend Optimizer?
On 27/03/06, Jonathan Duncan <[EMAIL PROTECTED]> wrote: > I posted this on the Zend.com forums but have not been able to get a > response yet. So I decided to ask the people that know. > > I do not understand the need for an optimizer. What exactly is Zend > Optimizer optimizing? If it is changing my code, then how about if I just > learn how to code better? Is that all that Zend Optimizer is doing? > Making my code better? There is no good reason to use ZO unless you have bought code that requires it, and the code has been encrypted to require it. If you run your own server, you would be far better served with something to actually speed your code, like APC (http://pecl.php.net/apc) or Eaccellerator (http://eaccelerator.net/) that is a compiled-code cache. And then learn how to write good code as well. Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Common Files
On 16/04/06, Jochem Maas <[EMAIL PROTECTED]> wrote: > Shaun wrote: > > Hi, > > > > We have a dedicated UNIX server running FreeBSD, is it possible to set a > > directory where we can place a set of common files that can be used by all > > of our web sites? > also check out PEAR (pear.php.net) which does exactly what you asked about, > the pear system may give you more/some ideas about how to structure and access > you common files. I tend to collect all my common code into a single directory heirarchy, and put a copy into the systems' PEAR directory. Then I can just go require_once 'MyCompany/filename.php'; from anywhere on the system. Until PEAR produces a module called 'MyCompany' (unlikely), it will live there entirely happily. Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multi-threaded port listener
On 28/04/06, René Fournier <[EMAIL PROTECTED]> wrote: Anyone find any good tutorials, code samples, etc. on such a thing? Basically, I want to write server (in PHP) that listeners on a particular port, and spins off a thread/process (essentially, execute a separate script) for each incoming connection. There won't be a lot of data to process, but there will be many simultaneous connections— upwards of 1000s of connections (each spun off as seperate threads). it's possible in PHP - but you'll unlikely want to do it as seperate processes, even as threads (besides, PHP doesn't have threads?) Check out http://php.net/stream_select and http://netevil.org/node.php?uuid=427d6d12-c107-9816-7428-27d6d128f5e5 With stream_select and the other stream handling software, there are some guys writing a mail server in PHP. I've got a script opening a dozen outbound connections to an external website to push it data myself, and that saves a lot of time rather than waiting for a connection to come back from fopen/fsockopen Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and mySQL getting smashed...
On 17/05/06, Dave Goodchild <[EMAIL PROTECTED]> wrote: I have a site that is getting 30K+ traffic daily and it is smashing mySQL - > any ideas on what to do to make the mysql connections more efficient, or > anything in general. No bandwidth issue here, just the server getting > killed. > > ...I may be wrong but using persistent connections (mysql_pconnect) may help. Also, optimise your tables and use the explain command to see how efficient your queries are. And caching things that don't need to looked up form the database right now. Even the fastest server in the world would wilt under a slashdotting, if it had to do a dozen big queries for every page display. Meanwhile a Pentium3 with a decent network can serve hundreds of requests a second of a few static pages. Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php