php-general Digest 20 Dec 2008 15:22:32 -0000 Issue 5856

2008-12-20 Thread php-general-digest-help

php-general Digest 20 Dec 2008 15:22:32 - Issue 5856

Topics (messages 284870 through 284883):

Using php in custom built http server
284870 by: Mr. Gecko
284872 by: Nathan Rixham
284875 by: Nathan Nobbe
284876 by: mike
284877 by: Nathan Nobbe
284878 by: mike

Re: de-bug no input file specified
284871 by: Nathan Rixham
284873 by: Nathan Rixham
284874 by: Nathan Rixham
284879 by: Gary Maddock-Greene
284880 by: Gary Maddock-Greene

Re: Require error
284881 by: Jochem Maas

Re: search for person by comparing his data with data in mysql
284882 by: Jochem Maas

filter function vs regular expression
284883 by: Alain Roger

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---
Hey, I built my own http server, and I'm wanting to add php to it. the  
server is in Objective-C.
I know I can use terminal commands to do it, but if I was to do that  
how would I get headers and stuff php sends, and how would I send php  
HTTP_REMOTE_ADDRESS and stuff like that?
I would prefer doing it with terminal commands, but I am willing it do  
it with a library or however I have to do it.


Thanks,
Mr. Gecko
---End Message---
---BeginMessage---

Mr. Gecko wrote:
Hey, I built my own http server, and I'm wanting to add php to it. the 
server is in Objective-C.
I know I can use terminal commands to do it, but if I was to do that how 
would I get headers and stuff php sends, and how would I send php 
HTTP_REMOTE_ADDRESS and stuff like that?
I would prefer doing it with terminal commands, but I am willing it do 
it with a library or however I have to do it.


Thanks,
Mr. Gecko


I'd get the php source if i was you and go from there..
---End Message---
---BeginMessage---
On Fri, Dec 19, 2008 at 5:58 PM, Mr. Gecko grmrge...@gmail.com wrote:

 Hey, I built my own http server, and I'm wanting to add php to it. the
 server is in Objective-C.
 I know I can use terminal commands to do it, but if I was to do that how
 would I get headers and stuff php sends, and how would I send php
 HTTP_REMOTE_ADDRESS and stuff like that?


there is a well known book, by sara golemon, extending  embedding
phphttp://tinyurl.com/a75bbk.
youll almost certainly want to grab that.  there are also some nice pdf's
and articles online, mostly for writing extensions afaict.  only a small
portion of the book about embedding php, but to give you a quick overview,
the most simple approach to embedding essentially boils down to including
libphp, and invoking it with a string of php  the C level eval().  the book
will get you going from there.

im sure if you know what youre doing, which if you could write a webserver
in objc, i suppose you would, should be able to get the eval-based approach
working 'pretty quickly'TM.  from there you can experiment w/ the info the
book has and it would probly be good to find some smaller webserver projects
that support php, like lighttpd http://www.lighttpd.net/download.
lighttpd is stricly C tho, if im not mistaken, but im sure youll find some
nice example segments there.

I would prefer doing it with terminal commands, but I am willing it do it
 with a library or however I have to do it.


well, im not sure what you need to do, make-file-wise, to get C to compile
into an objective-C application, but i know it can be done, b/c i did it on
an iphone app where we used the C interface to sqlite3.  im sure if youre
webserver is using objective-C classes, and some of its neat runtime
features, you might wind up writing some sort of OO wrapper around phps
embedding api, but thats just a guess.

btw, is this a private project or is the code out there somewhere ?

-nathan
---End Message---
---BeginMessage---
Also could look at using fastcgi and would not have to embed libphp  
and such.


On Dec 19, 2008, at 9:58 PM, Nathan Nobbe quickshif...@gmail.com  
wrote:


On Fri, Dec 19, 2008 at 5:58 PM, Mr. Gecko grmrge...@gmail.com  
wrote:


Hey, I built my own http server, and I'm wanting to add php to it.  
the

server is in Objective-C.
I know I can use terminal commands to do it, but if I was to do  
that how

would I get headers and stuff php sends, and how would I send php
HTTP_REMOTE_ADDRESS and stuff like that?



there is a well known book, by sara golemon, extending  embedding
phphttp://tinyurl.com/a75bbk.
youll almost certainly want to grab that.  there are also some nice  
pdf's
and articles online, mostly for writing extensions afaict.  only a  
small
portion of the book about embedding php, but to give you a quick  
overview,
the most simple approach to embedding essentially boils down to  
including
libphp, and invoking it 

[PHP] Re: de-bug no input file specified

2008-12-20 Thread Gary Maddock-Greene
hi .. info.php works fine ... php is installed and working ok. Its just this 
connection to a database that throws the error.


Server API is ISAPI

I'm not sure that I'm running php as a cgi app. I was reading something that 
was pointing me to that but tbh my knowledge level is very basic so I am not 
sure what I am looking for. That's always a problem with trying to find or 
understand a bug .. if you don't know what you should be looking at.


How can I check the cgi .. and why could this be causing the problem?

Many thanks guys

- Gary

Nathan Rixham nrix...@gmail.com wrote in message 
news:494c524d.40...@gmail.com...

Gary Maddock-Greene wrote:
Hi, is it possible to de-bug a 'no input file specified' error. I get the 
error when trying to run my search script but do not know whats causing 
it. Is it a common error?


PHP5 with MySQL adn IIS7

Thanks

- Gary


.. just did some more reading.. are you running php as a CGI app? 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Require error

2008-12-20 Thread Jochem Maas
sean greenslade schreef:
 So, I have this code in a php file called testing.php:
 $incl = '/webs/www.zootboy.com/sl/sql.inc';
  if(!is_readable($incl)) die('ERROR: MySQL Include file does not
 exist??!?');
  require $incl or die('MySQL page not found. Unable to continue.');
 

your require line is doing this:

require ($incl or die(foo);

the expression results in 1 which translates to the string 1
which require then tries to include.

do something like:

if (!require $incl)
die(foo);

although you might consider just doing

require $incl;

and removing the is_readable() check, die()s, etc ... the script
will die anyway if the require failed.

 
 When I run the code in command line, it outputs this:
 
 [r...@localhost ~]# php -f /webs/www.zootboy.com/sl/testing.php
 PHP Warning:  require(1): failed to open stream: No such file or directory
 in /webs/www.zootboy.com/sl/testing.php on line 13
 PHP Fatal error:  require(): Failed opening required '1'
 (include_path='/var/php/inc/') in /webs/www.zootboy.com/sl/testing.php on
 line 13
 
 I have no idea what's going on. All the files have 777 perms.
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] search for person by comparing his data with data in mysql

2008-12-20 Thread Jochem Maas
c...@l-i-e.com schreef:
 select 
   first_name like '%$first_name%' 
 + 3 * last_name like '%$last_name%'
 + 7 * email = '$email'
 as score,

that works?? I guess the expressions (e.g. email = '$email')
evaluate to bools and are auto-cast to ints.

Im guess there needs to be some parenthesis in there somewhere, no?

anyway nice snippet :-)

 first_name, last_name, email, person_id
 from person
 .
 .
 .
 order by score desc
 limit 10
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] filter function vs regular expression

2008-12-20 Thread Alain Roger
Hi,

i'm reading a book about PHP and i was wondering why regular expressions are
so often used to check format of variables or emails while the function
filter exists since version 5.2.
What are the plus of regular expression while checking variable format ?
thx.

-- 
Alain
---
Windows XP x64 SP2
PostgreSQL 8.3.5 / MS SQL server 2005
Apache 2.2.10
PHP 5.2.6
C# 2005-2008


Re: [PHP] Require error

2008-12-20 Thread Jochem Maas
Wolf schreef:
  Kyle Terry k...@kyleterry.com wrote: 
 On Fri, Dec 19, 2008 at 9:43 AM, Wolf lonew...@nc.rr.com wrote:

 Bottom Post

  sean greenslade zootboys...@gmail.com wrote:
 No. The file is called testing.php and it is trying to include sql.inc

 On Fri, Dec 19, 2008 at 12:36 PM, Kyle Terry k...@kyleterry.com wrote:


 On Fri, Dec 19, 2008 at 9:28 AM, sean greenslade 
 zootboys...@gmail.comwrote:
 So, I have this code in a php file called testing.php:
 $incl = '/webs/www.zootboy.com/sl/sql.inc';
  if(!is_readable($incl)) die('ERROR: MySQL Include file does not
 exist??!?');
  require $incl or die('MySQL page not found. Unable to continue.');


 When I run the code in command line, it outputs this:

 [r...@localhost ~]# php -f /webs/www.zootboy.com/sl/testing.php
 PHP Warning:  require(1): failed to open stream: No such file or
 directory
 in /webs/www.zootboy.com/sl/testing.php on line 13
 PHP Fatal error:  require(): Failed opening required '1'
 (include_path='/var/php/inc/') in /webs/
 www.zootboy.com/sl/testing.php on
 line 13

 I have no idea what's going on. All the files have 777 perms.

 --
 --Zootboy

 Are you trying to require itself?
 Change your line to:
 require('$incl') or die('File not found');

 Require can be dork about things like this, I normally wind up handling to
 fiddle with the coding for them.

 Wolf

 Actually, single quoted will be string literal. He would need to encase them
 in double quotes so the parser knows it might be looking for a variable.
 require($incl) is what he wants.

 
 See!  I told you I always have problems with those!  :)
 
 Normally I'm not so literal though. 
 
 so yeah:
 require($incl);
 include($incl);

brilliant, stick a variable containing a string into an interpolated and
otherwise empty string.

require($incl);

... the quotes are a complete waste of time/cpu.

 
 I prefer the includes over the requires, but that is personal preference.
 
 Wolf
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] filter function vs regular expression

2008-12-20 Thread Richard Heyes
 i'm reading a book about PHP and i was wondering why regular expressions are
 so often used to check format of variables or emails while the function
 filter exists since version 5.2.

That's not so long.

 What are the plus of regular expression while checking variable format ?

They' more versatile. Far more in the case of PCRE.

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated December 5th)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] filter function vs regular expression

2008-12-20 Thread Nathan Nobbe
On Sat, Dec 20, 2008 at 9:06 AM, Richard Heyes rich...@php.net wrote:

  i'm reading a book about PHP and i was wondering why regular expressions
 are
  so often used to check format of variables or emails while the function
  filter exists since version 5.2.

 That's not so long.

  What are the plus of regular expression while checking variable format ?

 They' more versatile. Far more in the case of PCRE.


to elaborate, in general, the filter extension should be faster than
corresponding preg_* calls from user space.  why?  b/c, they essentially are
compiled calls to pcre (in many cases) for specific cases, such as email.
check out the C for filter_validate_email(), its pretty simple:

void php_filter_validate_email(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
{
/* From
http://cvs.php.net/co.php/pear/HTML_QuickForm/QuickForm/Rule/Email.php?r=1.4*/
const char regexp[] =
/^((\\\[^\f\\n\\r\\t\\b]+\\\)|([\\w\\!\\#\\$\\%'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]+(\\.[\\w\\!\\#\\$\\%'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]+)*))@((\\[(((25[0-5])|(2[0-4]

pcre   *re = NULL;
pcre_extra *pcre_extra = NULL;
int preg_options = 0;
int ovector[150]; /* Needs to be a multiple of 3 */
int matches;

re = pcre_get_compiled_regex((char *)regexp, pcre_extra, preg_options
TSRMLS_CC);
if (!re) {
RETURN_VALIDATION_FAILED
}
matches = pcre_exec(re, NULL, Z_STRVAL_P(value), Z_STRLEN_P(value), 0,
0, ovector, 3);

/* 0 means that the vector is too small to hold all the captured
substring offsets */
if (matches  0) {
RETURN_VALIDATION_FAILED
}
}

basically all it does is call pcre_exec() on against some email regex, and
the string you want to search from userspace.  the difference between that
and a call to preg_match() using the same regex and search string is speed.
the other tradeoff, as richard mentioned is flexibility.  since you cant
possibly conjure / write all possible calls to the regex engine, it makes
sense to expose something like the preg_* functions to userspace.  that
being said, id recommend wrapping the filter_* calls in your validation code
when  where possible, which is essentially the mantra of php programming in
general anyway (stick to the native functions as much as possible).

-nathan

ps.
ill probly setup a test later to see if my half-baked theory is even
accurate :O


Re: [PHP] Using php in custom built http server

2008-12-20 Thread Nathan Nobbe
On Fri, Dec 19, 2008 at 11:47 PM, mike mike...@gmail.com wrote:

 Yep  Nginx, lighttpd, Zeus it's the only way. Apache has the option and I
 think a lot of people recommend it for various reasons.

 I'd recommend nginx over lighttpd :)


well now ill have to go scope out nginx :D

anyways, major diff between cgi  libphp should be performance, wherein cgi
should be like waaay slower.  but supposedly fastCGI is pretty solid.  peep
this thread from a little while back,

http://coding.derkeiler.com/Archive/PHP/comp.lang.php/2007-01/msg00120.html

and it looks like lighttpd supports fastCGI+php, so again, prob a good
source for free working code examples ;D

-nathan


Re: [PHP] filter function vs regular expression

2008-12-20 Thread Robert Cummings
On Sat, 2008-12-20 at 16:22 +0100, Alain Roger wrote:
 Hi,
 
 i'm reading a book about PHP and i was wondering why regular expressions are
 so often used to check format of variables or emails while the function
 filter exists since version 5.2.
 What are the plus of regular expression while checking variable format ?
 thx.

Because then your app would lose all compatibility with versions below
5.2.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] cURL: curl_exec return value

2008-12-20 Thread phphelp -- kbk

Hey - - - - - - -

I am new to using cURL, so I would appreciate your help. Fortunately,  
I have samples to follow, but the return value is not as I expect.


In short, instead of returning a Resource, it is just returning TRUE.

I have tried setting:
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TRANSFERTEXT, true);
curl_setopt($ch, CURLOPT_HTTPGET, true);

I have tried these together and separately and in all combinations.  
(IOW: flailing blindly)


Any clue what I am doing wrong? (relevant code below)

Ken


Code:
-
$url = $this-cc_submit_post_url;
$ch = curl_init();

// my lines, in any combination
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TRANSFERTEXT, true);
curl_setopt($ch, CURLOPT_HTTPGET, true);


// these lines are *supposedly* well-tested
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
	curl_setopt($ch, CURLOPT_HEADER, false);   // providing a header  
manually

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header);

// The following two options are necessary to properly set up SSL
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);

$data  = curl_exec($ch);
if (curl_errno($ch)) {
$appl['error_message']  = curl_error($ch);
$return_val = FALSE;
} else {
curl_close($ch);
}
---

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] filter function vs regular expression

2008-12-20 Thread Per Jessen
Nathan Nobbe wrote:

 to elaborate, in general, the filter extension should be faster than
 corresponding preg_* calls from user space.  why?  b/c, they
 essentially are compiled calls to pcre (in many cases) 

There is no or only the tiniest little difference - AFAICT preg_match
and the filter extension both use the same regex caching mechanism.  If
the regex has not been compiled, the first call will compile it,
subsequent calls will use the already compiled regex.


/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] filter function vs regular expression

2008-12-20 Thread Richard Heyes
/* From
 http://cvs.php.net/co.php/pear/HTML_QuickForm/QuickForm/Rule/Email.php?r=1.4
 */

Huh. I was under the impression that it did full verification, as
according to RFC (2)822. Not that that's generally necessary, in fact
it's mostly just outdated crap, (the technical term I believe).

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated December 20th)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Using php in custom built http server

2008-12-20 Thread mike
On Sat, Dec 20, 2008 at 9:37 AM, Nathan Nobbe quickshif...@gmail.com wrote:

 well now ill have to go scope out nginx :D

 anyways, major diff between cgi  libphp should be performance, wherein cgi
 should be like waaay slower.  but supposedly fastCGI is pretty solid.  peep
 this thread from a little while back,

 http://coding.derkeiler.com/Archive/PHP/comp.lang.php/2007-01/msg00120.html

 and it looks like lighttpd supports fastCGI+php, so again, prob a good
 source for free working code examples ;D

you can look at nginx or lighttpd for samples of fastcgi.

i think there are some very minor implementation details where one
might be better than another, etc.

fastcgi is good because it does not tie up the webserver itself with a
PHP engine that leaks some memory, but dispatches the request to a
separate entity and allows you to scale them separately.

a webserver like nginx can do much more work even on a single box -
wordpress.com had it pushing 8000 reqs/s of real world load balancing
traffic - and then you can focus on giving fastcgi the resources it
needs, be it more engines on the same box or splitting it apart and
creating a pool of fastcgi engines on N servers...

i'd also recommend php-fpm. it makes configuring php for fastcgi
elegant, adds in multiple options and will soon adaptively spawn the
amount of engines like apache does with webserver
threads/processes/whatever as needed...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Image Resizing

2008-12-20 Thread Stephen Alistoun

Hi all,

What is the best way in PHP to Resize an Image to a specific width.

For Example I have images in the following sizes:

(1) 200px width and 350px height
(2) 125px width and 220px height
(3) 166px width and 455px height

I want all the images to resize to 100px width but the height adjusts
automatically.

Regards,

Stephen
-- 
View this message in context: 
http://www.nabble.com/Image-Resizing-tp21108753p21108753.html
Sent from the PHP - General mailing list archive at Nabble.com.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] filter function vs regular expression

2008-12-20 Thread Stan Vassilev | FM



Huh. I was under the impression that it did full verification, as
according to RFC (2)822. Not that that's generally necessary, in fact
it's mostly just outdated crap, (the technical term I believe).

--
Richard Heyes


That's the problem with the filter extension. It's a black box and you never 
know what it checks, or how. Often it validates poor input as is the case 
with its URL validation.


Regex means you see what's happening and you have control over it.

I've been using the filter_* validators in some cases, but after inspecting 
the C source code of this extension and finding multiple side effects in the 
filters I used, I dropped it and went back to regex/strlen/ctype_*/etc.


Regards, Stan Vassilev 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Image Resizing

2008-12-20 Thread Ólafur Waage
With the built in functions (GD), you can read up on this function:
http://is.php.net/manual/en/function.imagecopyresized.php
If you have Imagick installed, you can read up on this:
http://is.php.net/manual/en/function.imagick-thumbnailimage.php

On Sat, Dec 20, 2008 at 8:38 PM, Stephen Alistoun
stephenalist...@gmail.com wrote:

 Hi all,

 What is the best way in PHP to Resize an Image to a specific width.

 For Example I have images in the following sizes:

 (1) 200px width and 350px height
 (2) 125px width and 220px height
 (3) 166px width and 455px height

 I want all the images to resize to 100px width but the height adjusts
 automatically.

 Regards,

 Stephen
 --
 View this message in context: 
 http://www.nabble.com/Image-Resizing-tp21108753p21108753.html
 Sent from the PHP - General mailing list archive at Nabble.com.


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Image Resizing

2008-12-20 Thread Ashley Sheridan
On Sat, 2008-12-20 at 20:59 +, Ólafur Waage wrote:

 With the built in functions (GD), you can read up on this function:
 http://is.php.net/manual/en/function.imagecopyresized.php
 If you have Imagick installed, you can read up on this:
 http://is.php.net/manual/en/function.imagick-thumbnailimage.php
 
 On Sat, Dec 20, 2008 at 8:38 PM, Stephen Alistoun
 stephenalist...@gmail.com wrote:
 
  Hi all,
 
  What is the best way in PHP to Resize an Image to a specific width.
 
  For Example I have images in the following sizes:
 
  (1) 200px width and 350px height
  (2) 125px width and 220px height
  (3) 166px width and 455px height
 
  I want all the images to resize to 100px width but the height adjusts
  automatically.
 
  Regards,
 
  Stephen
  --
  View this message in context: 
  http://www.nabble.com/Image-Resizing-tp21108753p21108753.html
  Sent from the PHP - General mailing list archive at Nabble.com.
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 

RTFM

http://uk.php.net/manual/en/function.imagecopyresampled.php



Ash
www.ashleysheridan.co.uk


Re: [PHP] Using php in custom built http server

2008-12-20 Thread Mr. Gecko
Thanks for the suggestions. I'll read on about it and tell you what I  
came up with, so if someone else want's to do something similar they  
can base it off of what I built.


Here are some replies to what you guys asked
I don't know if I would go open source on this.
I can use c code in Objective-C so yeah I can base it off of Lighttpd  
or Nginx

On Dec 20, 2008, at 2:33 PM, mike wrote:

On Sat, Dec 20, 2008 at 9:37 AM, Nathan Nobbe  
quickshif...@gmail.com wrote:



well now ill have to go scope out nginx :D

anyways, major diff between cgi  libphp should be performance,  
wherein cgi
should be like waaay slower.  but supposedly fastCGI is pretty  
solid.  peep

this thread from a little while back,

http://coding.derkeiler.com/Archive/PHP/comp.lang.php/2007-01/msg00120.html

and it looks like lighttpd supports fastCGI+php, so again, prob a  
good

source for free working code examples ;D


you can look at nginx or lighttpd for samples of fastcgi.

i think there are some very minor implementation details where one
might be better than another, etc.

fastcgi is good because it does not tie up the webserver itself with a
PHP engine that leaks some memory, but dispatches the request to a
separate entity and allows you to scale them separately.

a webserver like nginx can do much more work even on a single box -
wordpress.com had it pushing 8000 reqs/s of real world load balancing
traffic - and then you can focus on giving fastcgi the resources it
needs, be it more engines on the same box or splitting it apart and
creating a pool of fastcgi engines on N servers...

i'd also recommend php-fpm. it makes configuring php for fastcgi
elegant, adds in multiple options and will soon adaptively spawn the
amount of engines like apache does with webserver
threads/processes/whatever as needed...



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] imap_rfc822_parse_adrlist problem

2008-12-20 Thread Ben Stuyts

Hi,

Since upgrading to php 5.2.8 I have a problem with  
imap_rfc822_parse_adrlist. When I run the example given on the manual  
page at http://nl3.php.net/imap_rfc822_parse_adrlist:


$adds = 'ian eiloart i...@example.ac.uk,
   sh...@example.ac.uk,
   blobby,
   ian,eiloarti...@example.ac.uk,
   @example.com:f...@example.ac.uk,
   f...@#,
   i...@-example.com,
   i...@one@two';
$add_arr = imap_rfc822_parse_adrlist($adds, 'example.com');
var_export ($add_arr);

I should get:
...
 2 =
 class stdClass {
   var $mailbox = 'blobby';
   var $host = 'example.ac.uk';
 },
...

but I get:
...
 2 =
 stdClass::__set_state(array(
'mailbox' = 'blobby',
'host' = 'p?a(',
 )),
...

So the host part isn't filled in correctly. I have verified this on  
two FreeBSD 7 machines. On an older FreeBSD 5 machine with php4 this  
works fine. Before the update, I was running php 5.2.6 and there was  
no problem either. Any ideas?


Thanks,
Ben

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: imap_rfc822_parse_adrlist problem

2008-12-20 Thread Manuel Lemos
Hello,

on 12/20/2008 09:34 PM Ben Stuyts said the following:
 Hi,
 
 Since upgrading to php 5.2.8 I have a problem with
 imap_rfc822_parse_adrlist. When I run the example given on the manual
 page at http://nl3.php.net/imap_rfc822_parse_adrlist:
 
 $adds = 'ian eiloart i...@example.ac.uk,
sh...@example.ac.uk,
blobby,
ian,eiloarti...@example.ac.uk,
@example.com:f...@example.ac.uk,
f...@#,
i...@-example.com,
i...@one@two';
 $add_arr = imap_rfc822_parse_adrlist($adds, 'example.com');
 var_export ($add_arr);
 
 I should get:
 ...
  2 =
  class stdClass {
var $mailbox = 'blobby';
var $host = 'example.ac.uk';
  },
 ...
 
 but I get:
 ...
  2 =
  stdClass::__set_state(array(
 'mailbox' = 'blobby',
 'host' = 'p?a(',
  )),
 ...
 
 So the host part isn't filled in correctly. I have verified this on two
 FreeBSD 7 machines. On an older FreeBSD 5 machine with php4 this works
 fine. Before the update, I was running php 5.2.6 and there was no
 problem either. Any ideas?

Sometime ago I decided to not use IMAP library functions to parse e-mail
addresses because it was not handling all sorts of addresses as it should.

Nowadays I use an e-mail address parser class written in pure PHP that
comes with this MIME parser class:

http://www.phpclasses.org/mimeparser


-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: imap_rfc822_parse_adrlist problem

2008-12-20 Thread Manuel Lemos
Hello,

on 12/20/2008 09:34 PM Ben Stuyts said the following:
 Hi,
 
 Since upgrading to php 5.2.8 I have a problem with
 imap_rfc822_parse_adrlist. When I run the example given on the manual
 page at http://nl3.php.net/imap_rfc822_parse_adrlist:
 
 $adds = 'ian eiloart i...@example.ac.uk,
sh...@example.ac.uk,
blobby,
ian,eiloarti...@example.ac.uk,
@example.com:f...@example.ac.uk,
f...@#,
i...@-example.com,
i...@one@two';
 $add_arr = imap_rfc822_parse_adrlist($adds, 'example.com');
 var_export ($add_arr);
 
 I should get:
 ...
  2 =
  class stdClass {
var $mailbox = 'blobby';
var $host = 'example.ac.uk';
  },
 ...
 
 but I get:
 ...
  2 =
  stdClass::__set_state(array(
 'mailbox' = 'blobby',
 'host' = 'p?a(',
  )),
 ...
 
 So the host part isn't filled in correctly. I have verified this on two
 FreeBSD 7 machines. On an older FreeBSD 5 machine with php4 this works
 fine. Before the update, I was running php 5.2.6 and there was no
 problem either. Any ideas?

Sometime ago I decided to not use IMAP library functions to parse e-mail
addresses because it was not handling all sorts of addresses as it should.

Nowadays I use an e-mail address parser class written in pure PHP that
comes with this MIME parser class:

http://www.phpclasses.org/mimeparser


-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Passing var from one page to itself

2008-12-20 Thread Aslan

Hey there,

I have a problem where I have a simple -script that I am  wanting to 
pass back to itself three times

1) Symptoms -  2) Troubleshooting questions 3) Answer to problem

The page is passing the vars from the first page to the second, but the 
first pages vars are not passed to the third (but the second page is)


I am using includes for each sectional page and passing it back to itself

   if($submitted == )
   {
include 'inc/tshoot2-input.php';
   }
   if($submitted == symptoms)
   {
include 'inc/tshoot2-symptoms.php';  
   }

   if($submitted == submitted)
   {
include 'inc/answers.php';
   }


The tool will ultimately be on www.adslgeek.com/troubleshooter/

I have it currently all on one page, but it isn't quite what I was after
..
Any help would be appreciated!

Cheers
ADSL Geek

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] search for person by comparing his data with data in mysql

2008-12-20 Thread Andrew Ballard
On Sat, Dec 20, 2008 at 7:01 AM, Jochem Maas joc...@iamjochem.com wrote:
 c...@l-i-e.com schreef:
 select
   first_name like '%$first_name%'
 + 3 * last_name like '%$last_name%'
 + 7 * email = '$email'
 as score,

 that works?? I guess the expressions (e.g. email = '$email')
 evaluate to bools and are auto-cast to ints.

 Im guess there needs to be some parenthesis in there somewhere, no?

 anyway nice snippet :-)


If it works, it must be a MySQL feature.

Andrew

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php