Re: [PHP] is

2010-06-11 Thread Robert Cummings

Simon J Welsh wrote:

On 12/06/2010, at 8:43 AM, Daevid Vincent wrote:

Also, for the love of God, please don't embed a variable into a literal
string and use preprocessing.

Do it like so:




If you're doing it like that, you may as well use:






Fixed that for you :)

Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



Re: [PHP] is

2010-06-11 Thread Simon J Welsh

On 12/06/2010, at 8:43 AM, Daevid Vincent wrote:

>> -Original Message-
>> From: tedd [mailto:tedd.sperl...@gmail.com] 
>> 
>> I believe, just because it can be done doesn't mean that it 
>> should be done.
>> 
>> My practice is *never* to use > 
>> In fact, my practice is to not only use > the echo argument with a (), like:
>> 
>> 
>> 
>> I am sure there will be some that think that my practice is an 
>> overkill, or not "good practice", but it's a good thing that we all 
>> have a choice. Make your choice to best serve how you want your code 
>> to look.
> 
> As per http://us3.php.net/echo
> 
> echo() is not actually a function (it is a language construct), so you are
> not required to use parentheses with it. echo() (unlike some other language
> constructs) does not behave like a function, so it cannot always be used in
> the context of a function. Additionally, if you want to pass more than one
> parameter to echo(), the parameters must not be enclosed within
> parentheses. 
> 
> So you might want to reconsider your coding practice/style here and use the
> construct as designed or you might end up with a far worse scenario than
> short-tags could ever provide. Something more along the Python "print"
> debacle.
> 
> Also, for the love of God, please don't embed a variable into a literal
> string and use preprocessing.
> 
> Do it like so:
> 
> 

If you're doing it like that, you may as well use:



and leverage sending echo multiple parameters rather than using string 
concatenation.

---
Simon Welsh
Admin of http://simon.geek.nz/

Who said Microsoft never created a bug-free program? The blue screen never, 
ever crashes!

http://www.thinkgeek.com/brain/gimme.cgi?wid=81d520e5e





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



RE: [PHP] is

2010-06-11 Thread Daevid Vincent
 

> -Original Message-
> From: Ahmed Mohsen [mailto:mre...@gmail.com] 
> Sent: Friday, June 11, 2010 4:25 PM
> To: php-general@lists.php.net
> Subject: Re: [PHP] is  
> On 6/11/2010 11:43 PM, Daevid Vincent wrote:
> >> -Original Message-
> >> From: tedd [mailto:tedd.sperl...@gmail.com]
> >>
> >> I believe, just because it can be done doesn't mean that it
> >> should be done.
> >>
> >> My practice is *never* to use >>
> >> In fact, my practice is to not only use >> the echo argument with a (), like:
> >>
> >> 
> >>
> >> I am sure there will be some that think that my practice is an
> >> overkill, or not "good practice", but it's a good thing that we all
> >> have a choice. Make your choice to best serve how you want 
> your code
> >> to look.
> >
> > As per http://us3.php.net/echo
> >
> > echo() is not actually a function (it is a language 
> construct), so you are
> > not required to use parentheses with it. echo() (unlike 
> some other language
> > constructs) does not behave like a function, so it cannot 
> always be used in
> > the context of a function. Additionally, if you want to 
> pass more than one
> > parameter to echo(), the parameters must not be enclosed within
> > parentheses.
> >
> > So you might want to reconsider your coding practice/style 
> here and use the
> > construct as designed or you might end up with a far worse 
> scenario than
> > short-tags could ever provide. Something more along the 
> Python "print"
> > debacle.
> >
> > Also, for the love of God, please don't embed a variable 
> into a literal
> > string and use preprocessing.
> >
> > Do it like so:
> >
> > 
> >
> 
> Hey Daevid, does this form  
> improve anything in processing time or it's just for the sake of 
> readability?

Technically it does have a microscopic speed increase, but unless you're
pumping out hundreds or thousands of lines (like in a loop) you most likely
won't notice it. In my code, I always try to use the proper quote marks
because I *am* dealing with huge tables of data. I've said this a hundred
times before, if you can shave off 0.001 from each row, then after 1,000
rows, you've shaved 1 second off the page time. That seems small, but that
shit adds up. Caching will help, as the page is already parsed once, so PHP
doesn't have to do the work again in many cases. To me, it's a good habbit
and costs you nothing to do.

The difference is that with " the PHP engine has to pre-process the string
and look to see if there's anything interesting it needs to do -- such as
replace any $var with their equivalents or \n or whatever else. A ' means
to use it as is, so PHP just spits it back out.

http://php.net/manual/en/language.types.string.php

http://stackoverflow.com/questions/482202/is-there-a-performance-benefit-si
ngle-quote-vs-double-quote-in-php

http://stackoverflow.com/questions/13620/





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



Re: [PHP] is

2010-06-11 Thread Ahmed Mohsen

On 6/11/2010 11:43 PM, Daevid Vincent wrote:

-Original Message-
From: tedd [mailto:tedd.sperl...@gmail.com]

I believe, just because it can be done doesn't mean that it
should be done.

My practice is *never* to use

I am sure there will be some that think that my practice is an
overkill, or not "good practice", but it's a good thing that we all
have a choice. Make your choice to best serve how you want your code
to look.


As per http://us3.php.net/echo

echo() is not actually a function (it is a language construct), so you are
not required to use parentheses with it. echo() (unlike some other language
constructs) does not behave like a function, so it cannot always be used in
the context of a function. Additionally, if you want to pass more than one
parameter to echo(), the parameters must not be enclosed within
parentheses.

So you might want to reconsider your coding practice/style here and use the
construct as designed or you might end up with a far worse scenario than
short-tags could ever provide. Something more along the Python "print"
debacle.

Also, for the love of God, please don't embed a variable into a literal
string and use preprocessing.

Do it like so:





Hey Daevid, does this form  
improve anything in processing time or it's just for the sake of 
readability?


--
Kind regards,
Ahmed Mohsen.

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



[PHP] Why is there HTML in the error_log output? Please make it stop.

2010-06-11 Thread Daevid Vincent
I'm trying to clean up some code and have been looking at error_log output
and they all look like this:

[11-Jun-2010 23:04:54] In
/var/www/my_notifications.php, line 40:  WARNING
Invalid argument supplied for foreach()


I can't figure out:

[a] why the logs are in HTML format to begin with? Seems useless.
[b] how do I turn it off and just be plain text (i.e. striptags()
)?
[c] where is this  coming from?

I've looked in /etc/php5/apache2/ and grepped through, but don't see 'red'
anywhere.

I do see this, but it has no effect, as you can see by me 'disabling' it.

 388 ; String to output before an error message.
 389 ;error_prepend_string = ""
 390 error_prepend_string = ""
 391
 392 ; String to output after an error message.
 393 ;error_append_string = ""
 394 error_append_string = ""



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



Re: [PHP] is

2010-06-11 Thread Ahmed Mohsen

On 6/12/2010 12:34 AM, tedd wrote:

At 2:19 PM -0700 6/11/10, Daevid Vincent wrote:

EVERY other tag in an XML document is just straight up "html" :


Just curious -- like html tags:




Or do you have to change them to:




How does XML handle those tags?

Cheers,

tedd



If they have no content, you should use  tags, otherwise use the 
full open and close tags around the content. CONTENT


--
Kind regards,
Ahmed Mohsen.

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



Re: [PHP] is

2010-06-11 Thread Ashley M. Kirchner

On 6/11/2010 4:07 PM, David Harkness wrote:
*PHP* files? I would have flagged that as the problem rather than 
disabling

short tags.
   


Yeah, whoever created their site originally mixed XML/HTML/PHP all 
in the same file (all the files were .html but contained xml and php 
snippets) so I had to change their specific virtual host and then each 
individual file ...



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



Re: [PHP] is

2010-06-11 Thread David Harkness
On Fri, Jun 11, 2010 at 2:51 PM, Ashley M. Kirchner wrote:

> They had every single file starting with:
>
> 
>

*PHP* files? I would have flagged that as the problem rather than disabling
short tags.

David


Re: [PHP] is

2010-06-11 Thread Ashley M. Kirchner

On 6/11/2010 11:40 AM, Daevid Vincent wrote:


I use short tags and I output XML all the time.
   


I think there's a difference to note here.  You're outputting XML 
from PHP, versus files having XML tags in the files ... I ran into a 
problem with short tags not too long ago when a client transferred their 
website to us.  They had every single file starting with:




When you have short_tags enabled, this causes problems.  And 
because we have other clients who have applications written using 
short_tags, I had to redo all of those XML tags and make them:




This is why personally I refuse to use short tags - I'd rather type 
the whole thing out  and not run into trouble later if for some reason I 
have to move hosts.  None of my new servers have short_tags turned on.  
And anyone who asks is being told the same thing: type it out.


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



RE: [PHP] is

2010-06-11 Thread tedd

At 2:19 PM -0700 6/11/10, Daevid Vincent wrote:

EVERY other tag in an XML document is just straight up "html" :


Just curious -- like html tags:




Or do you have to change them to:




How does XML handle those tags?

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



RE: [PHP] is

2010-06-11 Thread tedd

At 1:43 PM -0700 6/11/10, Daevid Vincent wrote:

 > -Original Message-
 > From: tedd [mailto:tedd.sperl...@gmail.com]
 > In fact, my practice is to not only use 
 the echo argument with a (), like:


 > 


 I am sure there will be some that think that my practice is an
 overkill, or not "good practice", but it's a good thing that we all
 have a choice. Make your choice to best serve how you want your code
 to look.


As per http://us3.php.net/echo

echo() is not actually a function (it is a language construct), so you are
not required to use parentheses with it. echo() (unlike some other language
constructs) does not behave like a function, so it cannot always be used in
the context of a function. Additionally, if you want to pass more than one
parameter to echo(), the parameters must not be enclosed within
parentheses.

So you might want to reconsider your coding practice/style here and use the
construct as designed or you might end up with a far worse scenario than
short-tags could ever provide. Something more along the Python "print"
debacle.

Also, for the love of God, please don't embed a variable into a literal
string and use preprocessing.

Do it like so:




Daevid:

I'm aware that echo is a language construct and does not require the 
(). However, please note the reference you provided, namely:


http://us3.php.net/echo

They use "echo()" to describe the construct -- so, if they can use 
it, then I figure I'm in good company.


I also practice using () because it is easier for *me* to read, 
understand, and document my work. You are free to do as you want.


As for the Python "print" problem, I don't do Python -- so, it can 
win the lottery, or die, I don't care.


As for "don't embed a variable into a literal string and use 
preprocessing", as I said above, I often do this:




and find no problems whatsoever in doing so.

However, I wouldn't do this:



OR, I would place a space before/after the . (i.e., 'The answer is ' 
. $answer). However, I don't like doing that because I also program 
in other languages, which use the dot operator differently.


My experience has shown me that most, if not all, languages are 
merging -- as such, I think the dot operator is more established as 
something other than just an operation to combine strings.


Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



RE: [PHP] is

2010-06-11 Thread Daevid Vincent
 

> -Original Message-
> From: David Harkness [mailto:davi...@highgearmedia.com] 
> Sent: Friday, June 11, 2010 1:13 PM
> To: PHP General
> Subject: Re: [PHP] is  
> On Fri, Jun 11, 2010 at 11:16 AM, Ashley Sheridan
> wrote:
> 
> > For  on I believe,
> > which can cause issues when outputting the XML declaration 
> line unless
> > it's broken into two parts, which is messier than ' >
> 
> Can you give an example of how this breaks? I don't see any 
> problems with
> 
> ' ?>
> 
> unless you are trying to validate your PHP script as XML. 
> Given that PHP is
> *not* XML I don't know why you'd want to do that. But I've seen this
> argument a few times while looking into this issue so maybe 
> I'm just not
> seeing the big picture.

...and even *IF* it did break for that ONE instance, then simply do as I do
in my xml_header.inc.php file:

header( "Content-type: text/xml" );
print "\n";

Problem solved.

EVERY other tag in an XML document is just straight up "html" like:

bar

There are no other http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] is

2010-06-11 Thread Daevid Vincent
> -Original Message-
> From: tedd [mailto:tedd.sperl...@gmail.com] 
>
> I believe, just because it can be done doesn't mean that it 
> should be done.
> 
> My practice is *never* to use  
> In fact, my practice is to not only use  the echo argument with a (), like:
> 
> 
> 
> I am sure there will be some that think that my practice is an 
> overkill, or not "good practice", but it's a good thing that we all 
> have a choice. Make your choice to best serve how you want your code 
> to look.

As per http://us3.php.net/echo

echo() is not actually a function (it is a language construct), so you are
not required to use parentheses with it. echo() (unlike some other language
constructs) does not behave like a function, so it cannot always be used in
the context of a function. Additionally, if you want to pass more than one
parameter to echo(), the parameters must not be enclosed within
parentheses. 

So you might want to reconsider your coding practice/style here and use the
construct as designed or you might end up with a far worse scenario than
short-tags could ever provide. Something more along the Python "print"
debacle.

Also, for the love of God, please don't embed a variable into a literal
string and use preprocessing.

Do it like so:




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



Re: [PHP] is

2010-06-11 Thread David Harkness
On Fri, Jun 11, 2010 at 11:16 AM, Ashley Sheridan
wrote:

> For  which can cause issues when outputting the XML declaration line unless
> it's broken into two parts, which is messier than '

Can you give an example of how this breaks? I don't see any problems with

' ?>

unless you are trying to validate your PHP script as XML. Given that PHP is
*not* XML I don't know why you'd want to do that. But I've seen this
argument a few times while looking into this issue so maybe I'm just not
seeing the big picture.

David


RE: [PHP] is

2010-06-11 Thread tedd

At 5:53 PM -0700 6/10/10, Daevid Vincent wrote:

I use them ALL the time. MUCH cleaner IMHO than the alternatives.

And *IF* someday it is ever depricated, it's trival to:

 s/


 s/http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] is

2010-06-11 Thread tedd

At 1:34 AM +0300 6/11/10, Ahmed Mohsen wrote:
I know that i should use the full open tag in php  but i 
want to know if its good to use this tag  instead of echo $name ?>


Ahmed:

In many cases it boils down to an individual preference. I am sure 
you will find programmers on both sides and in the middle of this 
argument. Some saying they never use it, others saying that they 
always use it, and still others saying "It depends" -- meaning they 
use it in certain cases.


I believe, just because it can be done doesn't mean that it should be done.

My practice is *never* to use In fact, my practice is to not only use the echo argument with a (), like:




I am sure there will be some that think that my practice is an 
overkill, or not "good practice", but it's a good thing that we all 
have a choice. Make your choice to best serve how you want your code 
to look.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Question - foreach.

2010-06-11 Thread tedd

At 3:46 PM -0400 6/10/10, Paul M Foster wrote:

On Thu, Jun 10, 2010 at 11:16:08AM -0400, tedd wrote:

 > I spend much of my time thinking "Did I do that before?"

 I know the feeling. I will say this, though. I have yet to figure
out, from your URLs, how your site(s) is/are organized. Maybe a reorg
would help?

Paul


Paul:

Unfortunately, I really don't follow an organization plan for my 
demos on any of my sites (well over a dozen now).


Please understand that when I started creating demos, I only wanted 
to see how a specific thing worked. I had no idea that this 
investigation would become a giant listing of stuff.


I could explain how I can easily create demos if you want, but it's 
pretty basic stuff using includes for a common header/footer files 
leaving only the specific of the topic to be added. The hard part is 
just finding a layout that you like -- after that it's pretty easy to 
duplicate it each time you want to demo something.


I will be updating my sperling.com soon to add in language specific 
code (php/css/js) -- and that *will* be organized into categories. 
However, that may be down the road because I have a few other 
pressing matters that are pulling me in several different directions.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



RE: [PHP] is

2010-06-11 Thread Ashley Sheridan
On Fri, 2010-06-11 at 10:40 -0700, Daevid Vincent wrote:

> > -Original Message-
> > From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
> > 
> > ...as those tags only work when short_tags are turned on, which
> > itself causes problems with outputting XML from PHP. 
> 
> Can you elaborate on this Ashley?
> 
> I use short tags and I output XML all the time. In fact I'm knee deep in
> building an API right now for Panasonic Avionics that is all XML based. We
> have hundreds of airplanes hitting the API, sending XML and getting XML
> back -- all via LAMP. I'm also simultaneously doing some cURL JSON-RPC
> bi-directional communication.
> 
> This is the second XML API I've written for enterprise level service. I
> have no problems at all.
> 
> I call poppycock. This sounds like FUD to me. ;-)
> 
> D.
> 
> 


For http://www.ashleysheridan.co.uk




Re: [PHP] How does php server identify that the particular session belongs to particular user

2010-06-11 Thread Shreyas
Agreed. I was just speculating; may be I over -speculated it ;)

Regards,
Shreyas


On Fri, Jun 11, 2010 at 8:18 PM, Ashley Sheridan
wrote:

>  On Fri, 2010-06-11 at 19:56 +0530, Shreyas wrote:
>
> I agree with Ash's comment.
>
> You should probably dig in deeper and see if those IPs are indeed valid.
> Given the way the sites are being attacked (DDoS, SQL Injection et al), you
> could be seeing one. If you see a high load and your website is accessed by
> users spread globally, you should try out a Content Delivery Network like
> Akamai to meet the scale and improve the performance of your web-site
> without compromising on the end-user's site navigation experience.
>
> Regards,
> Shreyas
>
> On Fri, Jun 11, 2010 at 3:06 PM, Ashley Sheridan
> wrote:
>
> > On Fri, 2010-06-11 at 15:13 +0530, Peter wrote:
> >
> > > Hi Ashley,
> > >
> > > Thanks for your answer.
> > >
> > > When too many users log in at the same time, the server gets loaded
> > > with multiple sessions  files that leads to complexity and crashes the
> > > server. In such cases how do we handle this ?
> > >
> > > Thanks in advance
> > >
> > > Peter
> > >
> > >
> > > Ashley Sheridan wrote:
> > >
> > > > On Fri, 2010-06-11 at 13:01 +0530, Peter wrote:
> > > >
> > > >
> > > >
> > > > > Hi All,
> > > > >
> > > > > My Question is "How does php server identify that the particular
> > session
> > > > > belongs to particular user?"
> > > > >
> > > > > Please help me out
> > > > >
> > > > > Regards
> > > > > Peter.m
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > All the session data is stored on the server either in a database, file
> > > > or memory against a unique ID value. The server handles how this is
> > > > done, and it's likely you won't ever need to get involved with changing
> > > > how it does things.
> > > >
> > > > >From the client-side of things; the user agent (browser) sends this
> > > > unique ID either as part of the URL or with the headers as a post
> > > > variable, which is why you may see a PHP_SESSION_ID (or something
> > > > similar) index in the $_REQUEST array when you use session_start() in
> > > > your scripts.
> > > >
> > > > Has this helped?
> > > >
> > > > Thanks,
> > > > Ash
> > > > http://www.ashleysheridan.co.uk
> > > >
> > > >
> > > >
> > > >
> >
> >
> > I don't think it's the sessions that are crashing your server, it's more
> > than likely something else. What is the server load when you notice the
> > crashes? How many people are visiting your site simultaneously at that
> > point?
> >
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> >
> >
> >
>
>
>
>
> It might not even be as bad as that. It could be that you're just hitting
> the max number of connections that the server is configured to handle, or
> that the current number of connections is reaching the memory limit.
>
> Maybe the sessions are set up to be stored in files on the server on a
> separate partition, and that has reached capacity?
>
> There are a number of reasons which could cause the server to appear that
> the sessions are causing a problem that is not a DDoS attack ;)
>
>
>   Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>


-- 
Regards,
Shreyas


Re: [PHP] is

2010-06-11 Thread Robert Cummings

Robert Cummings wrote:

Robert Cummings wrote:

Daevid Vincent wrote:

-Original Message-
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 


...as those tags only work when short_tags are turned on, which
itself causes problems with outputting XML from PHP. 

Can you elaborate on this Ashley?

I use short tags and I output XML all the time. In fact I'm knee deep in
building an API right now for Panasonic Avionics that is all XML based. We
have hundreds of airplanes hitting the API, sending XML and getting XML
back -- all via LAMP. I'm also simultaneously doing some cURL JSON-RPC
bi-directional communication.

This is the second XML API I've written for enterprise level service. I
have no problems at all.

I call poppycock. This sounds like FUD to me. ;-)

It's called a standard:

 http://www.w3.org/TR/REC-xml/#sec-pi

A processing instruction without a target is incorrect. What should 
process the data if there is no target? The assumption of PHP when no 
target is declared is not part of the standard. Just because you've done 
two anecdotal enterprise projects and haven't had a problem, doesn't 
make it right.


I spoke too fast, I thought we were talking about The latter is questionable since technically the = could be considered a 
processing character (at least from what I read in the spec. Perhaps it 
is ambiguous though with other languages.


And on further reading I'm pretty sure the = character does not fall 
into the allowed caracters for a PITarget:


http://www.w3.org/TR/REC-xml/#NT-PITarget

Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



Re: [PHP] is

2010-06-11 Thread Robert Cummings

Robert Cummings wrote:


Daevid Vincent wrote:

-Original Message-
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 


...as those tags only work when short_tags are turned on, which
itself causes problems with outputting XML from PHP. 

Can you elaborate on this Ashley?

I use short tags and I output XML all the time. In fact I'm knee deep in
building an API right now for Panasonic Avionics that is all XML based. We
have hundreds of airplanes hitting the API, sending XML and getting XML
back -- all via LAMP. I'm also simultaneously doing some cURL JSON-RPC
bi-directional communication.

This is the second XML API I've written for enterprise level service. I
have no problems at all.

I call poppycock. This sounds like FUD to me. ;-)


It's called a standard:

 http://www.w3.org/TR/REC-xml/#sec-pi

A processing instruction without a target is incorrect. What should 
process the data if there is no target? The assumption of PHP when no 
target is declared is not part of the standard. Just because you've done 
two anecdotal enterprise projects and haven't had a problem, doesn't 
make it right.


I spoke too fast, I thought we were talking about The latter is questionable since technically the = could be considered a 
processing character (at least from what I read in the spec. Perhaps it 
is ambiguous though with other languages.


Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



Re: [PHP] is

2010-06-11 Thread Robert Cummings



Daevid Vincent wrote:

-Original Message-
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 


...as those tags only work when short_tags are turned on, which
itself causes problems with outputting XML from PHP. 


Can you elaborate on this Ashley?

I use short tags and I output XML all the time. In fact I'm knee deep in
building an API right now for Panasonic Avionics that is all XML based. We
have hundreds of airplanes hitting the API, sending XML and getting XML
back -- all via LAMP. I'm also simultaneously doing some cURL JSON-RPC
bi-directional communication.

This is the second XML API I've written for enterprise level service. I
have no problems at all.

I call poppycock. This sounds like FUD to me. ;-)


It's called a standard:

http://www.w3.org/TR/REC-xml/#sec-pi

A processing instruction without a target is incorrect. What should 
process the data if there is no target? The assumption of PHP when no 
target is declared is not part of the standard. Just because you've done 
two anecdotal enterprise projects and haven't had a problem, doesn't 
make it right.


Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



RE: [PHP] is

2010-06-11 Thread Daevid Vincent
> -Original Message-
> From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
> 
> ...as those tags only work when short_tags are turned on, which
> itself causes problems with outputting XML from PHP. 

Can you elaborate on this Ashley?

I use short tags and I output XML all the time. In fact I'm knee deep in
building an API right now for Panasonic Avionics that is all XML based. We
have hundreds of airplanes hitting the API, sending XML and getting XML
back -- all via LAMP. I'm also simultaneously doing some cURL JSON-RPC
bi-directional communication.

This is the second XML API I've written for enterprise level service. I
have no problems at all.

I call poppycock. This sounds like FUD to me. ;-)

D.


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



Re: [PHP] How does php server identify that the particular session belongs to particular user

2010-06-11 Thread Ashley Sheridan
On Fri, 2010-06-11 at 19:56 +0530, Shreyas wrote:

> I agree with Ash's comment.
> 
> You should probably dig in deeper and see if those IPs are indeed valid.
> Given the way the sites are being attacked (DDoS, SQL Injection et al), you
> could be seeing one. If you see a high load and your website is accessed by
> users spread globally, you should try out a Content Delivery Network like
> Akamai to meet the scale and improve the performance of your web-site
> without compromising on the end-user's site navigation experience.
> 
> Regards,
> Shreyas
> 
> On Fri, Jun 11, 2010 at 3:06 PM, Ashley Sheridan
> wrote:
> 
> > On Fri, 2010-06-11 at 15:13 +0530, Peter wrote:
> >
> > > Hi Ashley,
> > >
> > > Thanks for your answer.
> > >
> > > When too many users log in at the same time, the server gets loaded
> > > with multiple sessions  files that leads to complexity and crashes the
> > > server. In such cases how do we handle this ?
> > >
> > > Thanks in advance
> > >
> > > Peter
> > >
> > >
> > > Ashley Sheridan wrote:
> > >
> > > > On Fri, 2010-06-11 at 13:01 +0530, Peter wrote:
> > > >
> > > >
> > > >
> > > > > Hi All,
> > > > >
> > > > > My Question is "How does php server identify that the particular
> > session
> > > > > belongs to particular user?"
> > > > >
> > > > > Please help me out
> > > > >
> > > > > Regards
> > > > > Peter.m
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > All the session data is stored on the server either in a database, file
> > > > or memory against a unique ID value. The server handles how this is
> > > > done, and it's likely you won't ever need to get involved with changing
> > > > how it does things.
> > > >
> > > > >From the client-side of things; the user agent (browser) sends this
> > > > unique ID either as part of the URL or with the headers as a post
> > > > variable, which is why you may see a PHP_SESSION_ID (or something
> > > > similar) index in the $_REQUEST array when you use session_start() in
> > > > your scripts.
> > > >
> > > > Has this helped?
> > > >
> > > > Thanks,
> > > > Ash
> > > > http://www.ashleysheridan.co.uk
> > > >
> > > >
> > > >
> > > >
> >
> >
> > I don't think it's the sessions that are crashing your server, it's more
> > than likely something else. What is the server load when you notice the
> > crashes? How many people are visiting your site simultaneously at that
> > point?
> >
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> >
> >
> >
> 
> 


It might not even be as bad as that. It could be that you're just
hitting the max number of connections that the server is configured to
handle, or that the current number of connections is reaching the memory
limit.

Maybe the sessions are set up to be stored in files on the server on a
separate partition, and that has reached capacity?

There are a number of reasons which could cause the server to appear
that the sessions are causing a problem that is not a DDoS attack ;)

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] How does php server identify that the particular session belongs to particular user

2010-06-11 Thread Shreyas
I agree with Ash's comment.

You should probably dig in deeper and see if those IPs are indeed valid.
Given the way the sites are being attacked (DDoS, SQL Injection et al), you
could be seeing one. If you see a high load and your website is accessed by
users spread globally, you should try out a Content Delivery Network like
Akamai to meet the scale and improve the performance of your web-site
without compromising on the end-user's site navigation experience.

Regards,
Shreyas

On Fri, Jun 11, 2010 at 3:06 PM, Ashley Sheridan
wrote:

> On Fri, 2010-06-11 at 15:13 +0530, Peter wrote:
>
> > Hi Ashley,
> >
> > Thanks for your answer.
> >
> > When too many users log in at the same time, the server gets loaded
> > with multiple sessions  files that leads to complexity and crashes the
> > server. In such cases how do we handle this ?
> >
> > Thanks in advance
> >
> > Peter
> >
> >
> > Ashley Sheridan wrote:
> >
> > > On Fri, 2010-06-11 at 13:01 +0530, Peter wrote:
> > >
> > >
> > >
> > > > Hi All,
> > > >
> > > > My Question is "How does php server identify that the particular
> session
> > > > belongs to particular user?"
> > > >
> > > > Please help me out
> > > >
> > > > Regards
> > > > Peter.m
> > > >
> > > >
> > >
> > >
> > >
> > > All the session data is stored on the server either in a database, file
> > > or memory against a unique ID value. The server handles how this is
> > > done, and it's likely you won't ever need to get involved with changing
> > > how it does things.
> > >
> > > >From the client-side of things; the user agent (browser) sends this
> > > unique ID either as part of the URL or with the headers as a post
> > > variable, which is why you may see a PHP_SESSION_ID (or something
> > > similar) index in the $_REQUEST array when you use session_start() in
> > > your scripts.
> > >
> > > Has this helped?
> > >
> > > Thanks,
> > > Ash
> > > http://www.ashleysheridan.co.uk
> > >
> > >
> > >
> > >
>
>
> I don't think it's the sessions that are crashing your server, it's more
> than likely something else. What is the server load when you notice the
> crashes? How many people are visiting your site simultaneously at that
> point?
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>


-- 
Regards,
Shreyas


Re: [PHP] configure php 5.2.12 with-pdflib failes after upgrade from php 5.2.9

2010-06-11 Thread Thijs Lensselink
On Fri, 11 Jun 2010 09:24:09 +0200, Merlin Morgenstern
 wrote:
> Hi there,
> 
> I had a working version 5.2.9 running on my suse system. Then I upgraded

> to 5.2.12 with the same configure command. Unfortunatelly I lost pdf 
> creation now.
> 
> Here is what the configure output says:
> 
> 
> Notice: Following unknown configure options were used:
> --with-pdflib=/usr/local/lib
> Check './configure --help' for available options

pdflib has been removed from the core and is now available on pecl.php.net

> 
> The command seems correct and used to work on .9
> 
> Does somebody know how I could fix that?
> 
> Thank you for any help!
> 
> Merlin

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



Re: [PHP] include and include_once inheritance

2010-06-11 Thread Richard Quadling
On 11 June 2010 12:45, Richard Quadling  wrote:
> On 11 June 2010 11:41, Ashley Sheridan  wrote:
>> On Fri, 2010-06-11 at 06:34 -0400, David Mehler wrote:
>>
>>> Hello,
>>> I've got a page that uses include_once to include a set of functions
>>> for use in that page. I later have another include_once pulling in
>>> another page, which generates a table. It relies on a function from
>>> the first file, yet an error is being generated undefined function, I
>>> thought that since the function was included in the main page, and
>>> that since the table file was also being included in the main page
>>> that the functions would also be available to the table file. Is this
>>> not so?
>>> Thanks.
>>> Dave.
>>>
>>
>>
>> It should be available. Can you show the code you're using? Is the first
>> include being called within some form of if statement? That might
>> explain why it's not available when you expect it.
>>
>> Thanks,
>> Ash
>> http://www.ashleysheridan.co.uk
>>
>>
>>
>
> You would probably be better served with changing the include_once to
> require_once.
>
> If there is a dependency, then using require will enforce it. E_FATAL
> is produced if a required file is not available.
>
>
>
> --
> -
> Richard Quadling
> "Standing on the shoulders of some very clever giants!"
> EE : http://www.experts-exchange.com/M_248814.html
> EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> ZOPA : http://uk.zopa.com/member/RQuadling
>

And that is, of course, a fatal E_ERROR, not an E_FATAL error.

-- 
-
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [PHP] include and include_once inheritance

2010-06-11 Thread Richard Quadling
On 11 June 2010 11:41, Ashley Sheridan  wrote:
> On Fri, 2010-06-11 at 06:34 -0400, David Mehler wrote:
>
>> Hello,
>> I've got a page that uses include_once to include a set of functions
>> for use in that page. I later have another include_once pulling in
>> another page, which generates a table. It relies on a function from
>> the first file, yet an error is being generated undefined function, I
>> thought that since the function was included in the main page, and
>> that since the table file was also being included in the main page
>> that the functions would also be available to the table file. Is this
>> not so?
>> Thanks.
>> Dave.
>>
>
>
> It should be available. Can you show the code you're using? Is the first
> include being called within some form of if statement? That might
> explain why it's not available when you expect it.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>

You would probably be better served with changing the include_once to
require_once.

If there is a dependency, then using require will enforce it. E_FATAL
is produced if a required file is not available.



-- 
-
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



[PHP] Using LDAPS with PHP / certificates

2010-06-11 Thread Jérémy ESCOLANO
Hi,

I'm trying to contact an openLDAP from Apache server (on windows) using PHP
using LDAPS

Here is my sample code :

$host="ldaps://srvLDAP";
$port="636";
$ds=ldap_connect($host,$port);
ldap_set_option($ds,LDAP_OPT_PROTOCOL_VERSION,3);
$r=ldap_bind($ds,"cn=admin,o=exemple,dc=fr","exemple" );
$sr=ldap_search($ds,"o=exemple,dc=fr",("objectClass=exemple" ));
$info=ldap_get_entries($ds,$sr);
print $info["count"]." enregistrements trouvés.";


I passed lot of time trying configuring my servers and here is what i have
done :

First i configured my openLDAP server :

slapd.conf:
#cert requested for the ldapserver
TLSCertificateFile  ./ssl2/srvLDAP.cer
TLSCertificateKeyFile   ./ssl2/srvLDAP.key
#CA cert
TLSCACertificateFile./ssl2/cacert.cer
TLSVerifyClient never

ldap.conf:
TLS_CACERT  ./ssl2/cacert.cer
TLS_REQCERT never

On my apache server i created a folder C:\openldap\sysconf
and created a file ldap.conf :

TLS_CACERT  ./ssl/cacert.cer
TLS_REQCERT never

(I also created a folder c:\openldap\sysconf\ssl and put my CA certificate
inside it)
(of course I activated ldap and ssl in my php.ini)

>From now it DOES work BUT it doesn't verify any certificate.

I want now to make it verifying the certificate. I know i have to
change TLS_REQCERT never to TLS_REQCERT demand on openldap server
and apache server. I tryed but it doesn't work. I can't contact ldap server..

On the openLDAP I have this following error:

connection_read(1176): checking for input on id=0
TLS trace: SSL_accept:before/accept initialization
TLS trace: SSL_accept:SSLv3 read client hello A
TLS trace: SSL_accept:SSLv3 write server hello A
TLS trace: SSL_accept:SSLv3 write certificate A
TLS trace: SSL_accept:SSLv3 write certificate request A
TLS trace: SSL_accept:SSLv3 flush data
TLS trace: SSL_accept:error in SSLv3 read client certificate A
TLS trace: SSL_accept:error in SSLv3 read client certificate A
connection_get(1176): got connid=0
connection_read(1176): checking for input on id=0
TLS trace: SSL3 alert write:fatal:handshake failure
TLS trace: SSL_accept:error in SSLv3 read client certificate B
TLS: can't accept.
TLS: error:140890C7:SSL routines:SSL3_GET_CLIENT_CERTIFICATE:peer did not
return
 a certificate s3_srvr.c:2471
connection_read(1176): TLS accept error error=-1 id=0, closing
connection_closing: readying conn=0 sd=1176 for close
connection_close: conn=0 sd=1176


That means that the openLDAP can't check the client certificate cuz PHP and
Apache don't send any to it.

I heard about a ldaprc file but I can't find any information about it...

Is there somebody who can help me with this ?

Thank you very much in advance.


[PHP] connect openLDAP server using LDAP (apache + windows)

2010-06-11 Thread Jérémy ESCOLANO
Hi

I'm writing from france cuz i'm having a big problem with apache and ldap.
let me explain :

I would like to make an Apache server communicate in php with en openLDAP
server (both servers are under win srv 2003), using LDAPS protocol.

In order to activate LDAPS on my openLDAP srv (srvLDAP), I created self
signed certificates with openSSL. I got 3 files:


cacert.pem
srvLDAP.pem
srvLDAP.key


I configured my slapd.con file and ldap.conf fil (openLDAP side) like this:

slapd.conf

TLSCertificateFile  ./ssl/srvLDAP.pem
TLSCertificateKeyFile   ./ssl/srvLDAP.key
TLSCACertificateFile./ssl/cacert.pem


ldap.conf
BASE
URI ldaps://srvLDAP/
TLS_CACERT  ./ssl/cacert.pem
TLS_REQCERT demand



I launched my openLDAP service, and checked ldaps protocol was okay, using
this command :



C:\Program Files\OpenLDAP>ldapsearch -b o=exemple,dc=fr -s sub -x -w pass-D
cn=admin,o=exemple,dc=fr -H ldaps://srvLDAP/


Now I would like, from the remote apache server, communicate with the
openLDAP server using [b]LDAPS[/b] Protocol.

Here is my simplified PHP code

LDAP OPENLDAP LDAPS


I get this errror:


Unable to bind to server: Can't contact LDAP server


I know i have to configure certificates in the Apache server configuration,
I tried to to this according several internet ressources but didn't succeed..
I also read this link [URL="
http://forum.hardware.fr/hfr/OSAlternatifs/Logiciels-2/certificats-securisee-connexion-sujet_65365_1.htm"]Here[/URL]
which is a french link which speak about an ldap.con and ldaprc files to put
in the apache server. I did it but nothing happened.

Well, i'm lost in all this stuff, that is why i'm asking for help to
configure my servers to use ldaps with php.

Do you have information that could help me ?

I thank you in advance


Re: [PHP] include and include_once inheritance

2010-06-11 Thread Ashley Sheridan
On Fri, 2010-06-11 at 06:34 -0400, David Mehler wrote:

> Hello,
> I've got a page that uses include_once to include a set of functions
> for use in that page. I later have another include_once pulling in
> another page, which generates a table. It relies on a function from
> the first file, yet an error is being generated undefined function, I
> thought that since the function was included in the main page, and
> that since the table file was also being included in the main page
> that the functions would also be available to the table file. Is this
> not so?
> Thanks.
> Dave.
> 


It should be available. Can you show the code you're using? Is the first
include being called within some form of if statement? That might
explain why it's not available when you expect it.

Thanks,
Ash
http://www.ashleysheridan.co.uk




[PHP] include and include_once inheritance

2010-06-11 Thread David Mehler
Hello,
I've got a page that uses include_once to include a set of functions
for use in that page. I later have another include_once pulling in
another page, which generates a table. It relies on a function from
the first file, yet an error is being generated undefined function, I
thought that since the function was included in the main page, and
that since the table file was also being included in the main page
that the functions would also be available to the table file. Is this
not so?
Thanks.
Dave.

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



Re: [PHP] How does php server identify that the particular session belongs to particular user

2010-06-11 Thread Ashley Sheridan
On Fri, 2010-06-11 at 15:13 +0530, Peter wrote:

> Hi Ashley,
> 
> Thanks for your answer.
> 
> When too many users log in at the same time, the server gets loaded
> with multiple sessions  files that leads to complexity and crashes the
> server. In such cases how do we handle this ?
> 
> Thanks in advance
> 
> Peter
> 
> 
> Ashley Sheridan wrote: 
> 
> > On Fri, 2010-06-11 at 13:01 +0530, Peter wrote:
> > 
> >   
> > 
> > > Hi All,
> > > 
> > > My Question is "How does php server identify that the particular session 
> > > belongs to particular user?"
> > > 
> > > Please help me out
> > > 
> > > Regards
> > > Peter.m
> > > 
> > > 
> > 
> > 
> > 
> > All the session data is stored on the server either in a database, file
> > or memory against a unique ID value. The server handles how this is
> > done, and it's likely you won't ever need to get involved with changing
> > how it does things.
> > 
> > >From the client-side of things; the user agent (browser) sends this
> > unique ID either as part of the URL or with the headers as a post
> > variable, which is why you may see a PHP_SESSION_ID (or something
> > similar) index in the $_REQUEST array when you use session_start() in
> > your scripts.
> > 
> > Has this helped?
> > 
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> > 
> > 
> > 
> >   


I don't think it's the sessions that are crashing your server, it's more
than likely something else. What is the server load when you notice the
crashes? How many people are visiting your site simultaneously at that
point?

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] How does php server identify that the particular session belongs to particular user

2010-06-11 Thread Ashley Sheridan
On Fri, 2010-06-11 at 13:01 +0530, Peter wrote:

> Hi All,
> 
> My Question is "How does php server identify that the particular session 
> belongs to particular user?"
> 
> Please help me out
> 
> Regards
> Peter.m
> 


All the session data is stored on the server either in a database, file
or memory against a unique ID value. The server handles how this is
done, and it's likely you won't ever need to get involved with changing
how it does things.

>From the client-side of things; the user agent (browser) sends this
unique ID either as part of the URL or with the headers as a post
variable, which is why you may see a PHP_SESSION_ID (or something
similar) index in the $_REQUEST array when you use session_start() in
your scripts.

Has this helped?

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] How does php server identify that the particular session belongs to particular user

2010-06-11 Thread Boris SABATIER
Hi

A cookie with the session_id are send to the client.

Bo.


2010/6/11 Peter 

> Hi All,
>
> My Question is "How does php server identify that the particular session
> belongs to particular user?"
>
> Please help me out
>
> Regards
> Peter.m
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


[PHP] configure php 5.2.12 with-pdflib failes after upgrade from php 5.2.9

2010-06-11 Thread Merlin Morgenstern

Hi there,

I had a working version 5.2.9 running on my suse system. Then I upgraded 
to 5.2.12 with the same configure command. Unfortunatelly I lost pdf 
creation now.


Here is what the configure output says:


Notice: Following unknown configure options were used:
--with-pdflib=/usr/local/lib
Check './configure --help' for available options

The command seems correct and used to work on .9

Does somebody know how I could fix that?

Thank you for any help!

Merlin

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



[PHP] How does php server identify that the particular session belongs to particular user

2010-06-11 Thread Peter

Hi All,

My Question is "How does php server identify that the particular session 
belongs to particular user?"


Please help me out

Regards
Peter.m

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