[PHP] required return on pecl install pam

2010-08-18 Thread fakessh

hello guru off php

pecl pam seems little buggy
http://pecl.php.net/bugs/bug.php?id=16995

you are coming to run this extension
I'm listening and indication of any return

please help me


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



Re: [PHP] Can't read $_POST array

2010-08-18 Thread Andrew Mason
On Thu, Aug 19, 2010 at 7:41 AM, Daevid Vincent  wrote:
> You've got something jacked. DO NOT proceed with your coding using this
> hack.
>
> Put this in a blank file named whatever_you_want.php and hit it with your
> web browser.
>
> ---
> -
> 
>
> 
>        
>                foo
>                bar
>        
>        
> 
> ---
> -
>
>> -Original Message-
>> From: Brian Dunning [mailto:br...@briandunning.com]
>> Sent: Wednesday, August 18, 2010 2:23 PM
>> To: PHP-General
>> Subject: Re: [PHP] Can't read $_POST array
>>
>> This was the complete code of the page (this is the POST
>> version not the REQUEST version):
>>
>> > $response = print_r($_POST, true);
>> echo $response;
>> ?>
>>
>> Returns an empty array no matter what POST vars are sent. We
>> fixed it by changing it to this, which I've never even heard
>> of, but so far is working perfectly:
>>
>> > $response = file_get_contents('php://input');
>> echo $response;
>> ?>
>>
>> I have no idea what the problem was. Thanks to everyone for your help.
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

Does what your posting contain any content like '<' '>' my guess is
that you need to access the content using the filter_ functions.

Andrew

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



RE: [PHP] Can't read $_POST array

2010-08-18 Thread Daevid Vincent
You've got something jacked. DO NOT proceed with your coding using this
hack.

Put this in a blank file named whatever_you_want.php and hit it with your
web browser.

---
-




foo
bar



---
- 

> -Original Message-
> From: Brian Dunning [mailto:br...@briandunning.com] 
> Sent: Wednesday, August 18, 2010 2:23 PM
> To: PHP-General
> Subject: Re: [PHP] Can't read $_POST array
> 
> This was the complete code of the page (this is the POST 
> version not the REQUEST version):
> 
>  $response = print_r($_POST, true);
> echo $response;
> ?>
> 
> Returns an empty array no matter what POST vars are sent. We 
> fixed it by changing it to this, which I've never even heard 
> of, but so far is working perfectly:
> 
>  $response = file_get_contents('php://input');
> echo $response;
> ?>
> 
> I have no idea what the problem was. Thanks to everyone for your help.
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



foo
bar




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

Re: [PHP] Can't read $_POST array

2010-08-18 Thread Brian Dunning
This was the complete code of the page (this is the POST version not the 
REQUEST version):



Returns an empty array no matter what POST vars are sent. We fixed it by 
changing it to this, which I've never even heard of, but so far is working 
perfectly:



I have no idea what the problem was. Thanks to everyone for your help.


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



Re: [PHP] Can't read $_POST array

2010-08-18 Thread chris h
Does $_SERVER['HTTP_METHOD'] show a GET or POST?

On Wed, Aug 18, 2010 at 4:58 PM, Adam Richardson wrote:

> On Wed, Aug 18, 2010 at 4:55 PM, Adam Richardson  >wrote:
>
> > On Wed, Aug 18, 2010 at 4:49 PM, Ashley Sheridan <
> a...@ashleysheridan.co.uk
> > > wrote:
> >
> >> On Wed, 2010-08-18 at 13:45 -0700, Brian Dunning wrote:
> >>
> >> > I'm trying to write a VERY simple script that does nothing but store
> all
> >> the submitted GET and POST vars in a string and echo it out.
> >> >
> >> > $response = print_r($_REQUEST, true);
> >> > echo $response;
> >> >
> >> > The problem is it only shows GET vars. I've tried $POST instead of
> >> $_REQUEST and it always gives an empty array. I've got it on two
> different
> >> servers, and we have three guys trying various methods of submitting
> forms
> >> to it, trying to eliminate all potential problems, like the possibility
> that
> >> the request might not actually have any POST vars. I think we've safely
> >> eliminated these possibilities.
> >> >
> >> > Can anyone see a reason why the above should not see POST vars? Is
> there
> >> some security setting I don't know about?
> >>
> >>
> >> Is there any code before the print_r() call, i.e. code that might be
> >> setting it to an empty array?
> >>
> >> If not, then are you sure your form is definitely sending post
> >> variables? It sounds a stupid question, but a small typo could be
> >> sending the data as GET by accident. Firefox has a useful extension
> >> called Firebug which might be able to show you the data being sent to
> >> the browser. If you really need to bring out the big guns, then
> >> Wireshark will show all the network traffic, including that sent from
> >> your form to the server.
> >>
> >> Thanks,
> >> Ash
> >> http://www.ashleysheridan.co.uk
> >>
> >>
> >>
> > Check php.ini for this setting:
> > variables_order
> >
> >
> > --
> > Nephtali:  PHP web framework that functions beautifully
> > http://nephtaliproject.com
> >
>
> And I suppose post_max_size could cause issues, too.
>
> --
> Nephtali:  PHP web framework that functions beautifully
> http://nephtaliproject.com
>


Re: [PHP] Can't read $_POST array

2010-08-18 Thread Ashley Sheridan
On Wed, 2010-08-18 at 16:55 -0400, Adam Richardson wrote:

> On Wed, Aug 18, 2010 at 4:49 PM, Ashley Sheridan
> wrote:
> 
> > On Wed, 2010-08-18 at 13:45 -0700, Brian Dunning wrote:
> >
> > > I'm trying to write a VERY simple script that does nothing but store all
> > the submitted GET and POST vars in a string and echo it out.
> > >
> > > $response = print_r($_REQUEST, true);
> > > echo $response;
> > >
> > > The problem is it only shows GET vars. I've tried $POST instead of
> > $_REQUEST and it always gives an empty array. I've got it on two different
> > servers, and we have three guys trying various methods of submitting forms
> > to it, trying to eliminate all potential problems, like the possibility that
> > the request might not actually have any POST vars. I think we've safely
> > eliminated these possibilities.
> > >
> > > Can anyone see a reason why the above should not see POST vars? Is there
> > some security setting I don't know about?
> >
> >
> > Is there any code before the print_r() call, i.e. code that might be
> > setting it to an empty array?
> >
> > If not, then are you sure your form is definitely sending post
> > variables? It sounds a stupid question, but a small typo could be
> > sending the data as GET by accident. Firefox has a useful extension
> > called Firebug which might be able to show you the data being sent to
> > the browser. If you really need to bring out the big guns, then
> > Wireshark will show all the network traffic, including that sent from
> > your form to the server.
> >
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> >
> >
> >
> Check php.ini for this setting:
> variables_order
> 
> 


If the $_POST array appears empty in a print_r() statement, then the
variable order won't be the cause. It's more likely that the array is
being emptied before it gets to the print_r() or it is not being sent at
all.

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




Re: [PHP] Can't read $_POST array

2010-08-18 Thread Adam Richardson
On Wed, Aug 18, 2010 at 4:55 PM, Adam Richardson wrote:

> On Wed, Aug 18, 2010 at 4:49 PM, Ashley Sheridan  > wrote:
>
>> On Wed, 2010-08-18 at 13:45 -0700, Brian Dunning wrote:
>>
>> > I'm trying to write a VERY simple script that does nothing but store all
>> the submitted GET and POST vars in a string and echo it out.
>> >
>> > $response = print_r($_REQUEST, true);
>> > echo $response;
>> >
>> > The problem is it only shows GET vars. I've tried $POST instead of
>> $_REQUEST and it always gives an empty array. I've got it on two different
>> servers, and we have three guys trying various methods of submitting forms
>> to it, trying to eliminate all potential problems, like the possibility that
>> the request might not actually have any POST vars. I think we've safely
>> eliminated these possibilities.
>> >
>> > Can anyone see a reason why the above should not see POST vars? Is there
>> some security setting I don't know about?
>>
>>
>> Is there any code before the print_r() call, i.e. code that might be
>> setting it to an empty array?
>>
>> If not, then are you sure your form is definitely sending post
>> variables? It sounds a stupid question, but a small typo could be
>> sending the data as GET by accident. Firefox has a useful extension
>> called Firebug which might be able to show you the data being sent to
>> the browser. If you really need to bring out the big guns, then
>> Wireshark will show all the network traffic, including that sent from
>> your form to the server.
>>
>> Thanks,
>> Ash
>> http://www.ashleysheridan.co.uk
>>
>>
>>
> Check php.ini for this setting:
> variables_order
>
>
> --
> Nephtali:  PHP web framework that functions beautifully
> http://nephtaliproject.com
>

And I suppose post_max_size could cause issues, too.

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


Re: [PHP] Can't read $_POST array

2010-08-18 Thread Adam Richardson
On Wed, Aug 18, 2010 at 4:49 PM, Ashley Sheridan
wrote:

> On Wed, 2010-08-18 at 13:45 -0700, Brian Dunning wrote:
>
> > I'm trying to write a VERY simple script that does nothing but store all
> the submitted GET and POST vars in a string and echo it out.
> >
> > $response = print_r($_REQUEST, true);
> > echo $response;
> >
> > The problem is it only shows GET vars. I've tried $POST instead of
> $_REQUEST and it always gives an empty array. I've got it on two different
> servers, and we have three guys trying various methods of submitting forms
> to it, trying to eliminate all potential problems, like the possibility that
> the request might not actually have any POST vars. I think we've safely
> eliminated these possibilities.
> >
> > Can anyone see a reason why the above should not see POST vars? Is there
> some security setting I don't know about?
>
>
> Is there any code before the print_r() call, i.e. code that might be
> setting it to an empty array?
>
> If not, then are you sure your form is definitely sending post
> variables? It sounds a stupid question, but a small typo could be
> sending the data as GET by accident. Firefox has a useful extension
> called Firebug which might be able to show you the data being sent to
> the browser. If you really need to bring out the big guns, then
> Wireshark will show all the network traffic, including that sent from
> your form to the server.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
Check php.ini for this setting:
variables_order


-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


Re: [PHP] Can't read $_POST array

2010-08-18 Thread Brian Dunning
Sorry, my typo, $_POST is one of the options we tried, not $POST. It returns an 
empty array also.



On Aug 18, 2010, at 1:50 PM, Joshua Kehn wrote:

> On Aug 18, 2010, at 4:45 PM, Brian Dunning wrote:
> 
>> I'm trying to write a VERY simple script that does nothing but store all the 
>> submitted GET and POST vars in a string and echo it out.
>> 
>> $response = print_r($_REQUEST, true);
>> echo $response;
>> 
>> The problem is it only shows GET vars. I've tried $POST instead of $_REQUEST 
>> and it always gives an empty array. I've got it on two different servers, 
>> and we have three guys trying various methods of submitting forms to it, 
>> trying to eliminate all potential problems, like the possibility that the 
>> request might not actually have any POST vars. I think we've safely 
>> eliminated these possibilities.
>> 
>> Can anyone see a reason why the above should not see POST vars? Is there 
>> some security setting I don't know about?
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>> 
> 
> You have to use $_POST for the post data.
> 
> Regards,
> 
> -Josh
> 
> Joshua Kehn | josh.k...@gmail.com
> http://joshuakehn.com
> 


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



Re: [PHP] Can't read $_POST array

2010-08-18 Thread Marc Guay
> $response = print_r($_REQUEST, true);
> echo $response;

I'm sorry I don't have any input on your actual question but tohuhgt
I'd mention that this can be shortened to:

print_r($_REQUEST);

... if I'm not mistaken.

Marc

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



Re: [PHP] Can't read $_POST array

2010-08-18 Thread Ashley Sheridan
On Wed, 2010-08-18 at 13:45 -0700, Brian Dunning wrote:

> I'm trying to write a VERY simple script that does nothing but store all the 
> submitted GET and POST vars in a string and echo it out.
> 
> $response = print_r($_REQUEST, true);
> echo $response;
> 
> The problem is it only shows GET vars. I've tried $POST instead of $_REQUEST 
> and it always gives an empty array. I've got it on two different servers, and 
> we have three guys trying various methods of submitting forms to it, trying 
> to eliminate all potential problems, like the possibility that the request 
> might not actually have any POST vars. I think we've safely eliminated these 
> possibilities.
> 
> Can anyone see a reason why the above should not see POST vars? Is there some 
> security setting I don't know about?


Is there any code before the print_r() call, i.e. code that might be
setting it to an empty array?

If not, then are you sure your form is definitely sending post
variables? It sounds a stupid question, but a small typo could be
sending the data as GET by accident. Firefox has a useful extension
called Firebug which might be able to show you the data being sent to
the browser. If you really need to bring out the big guns, then
Wireshark will show all the network traffic, including that sent from
your form to the server.

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




[PHP] Can't read $_POST array

2010-08-18 Thread Brian Dunning
I'm trying to write a VERY simple script that does nothing but store all the 
submitted GET and POST vars in a string and echo it out.

$response = print_r($_REQUEST, true);
echo $response;

The problem is it only shows GET vars. I've tried $POST instead of $_REQUEST 
and it always gives an empty array. I've got it on two different servers, and 
we have three guys trying various methods of submitting forms to it, trying to 
eliminate all potential problems, like the possibility that the request might 
not actually have any POST vars. I think we've safely eliminated these 
possibilities.

Can anyone see a reason why the above should not see POST vars? Is there some 
security setting I don't know about?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Regular expressions, filter option1 OR option2

2010-08-18 Thread Camilo Sperberg
On Wed, Aug 18, 2010 at 15:01, Ashley Sheridan wrote:

>  On Wed, 2010-08-18 at 23:36 +0530, Shreyas Agasthya wrote:
>
> Camilo,
>
> What exactly are you trying to achieve? Meaning:
>
> if (true)
>do this;
> if (false)
>do that;
>
> However, here's a link that I used long back to help me with some RegEx 
> :http://www.gskinner.com/RegExr/
>
> Regards,
> Shreyas
>
> On Wed, Aug 18, 2010 at 11:31 PM, Camilo Sperberg 
> wrote:
>
> > Hello list :)
> >
> > Just a short question which I know it should be easy, but I'm no expert yet
> > in regular expressions.
> > I've got a nice little XML string, which is something like this but can be
> > changed:
> >
> > 
> > http://tempuri.org/";>false
> >
> > The boolean value can be true or false, so what I want to do, is filter it.
> > I've done it this way, but I know it can be improved (just because I love
> > clean coding and also because I want to master regular expressions xD):
> >
> >  $result = preg_match('/true/',$curl_response);
> >  if ($result == 0) $result = preg_match('/false/',$curl_response);
> >
> > I've also tried something like:
> > $result = preg_replace('/^(true)|^(false)/','',$curl_response); // if not
> > true OR not false => replace with empty
> >
> > and also '/^true|^false/' which doesn't seem to work.
> >
> > Any ideas to filter this kind of string in just one expression?
> >
> > Thanks in advance :)
> >
> > --
> > Mailed by:
> > UnReAl4U - unreal4u
> > ICQ #: 54472056
> > www1: http://www.chw.net/
> > www2: http://unreal4u.com/
> >
>
>
>
>
>
> As far as I can tell, are you just trying to grab the content from the
>  tag text node? If it's limited to this basic example, there's
> likely not much of a need to use dedicated DOM functions, but consider using
> them if you need to work on more complex documents.
>
> If you are just trying to determine if the value is indeed true or false
> and nothing else, then a regex could be overkill here. As you only need to
> check two values, consider:
>
> if(strpos($xml, 'true') || strpos($xml, 'false'))
> {
> // text node content is OK
> }
> else
> {
> // bad, bad input, go sit in the corner
> }
>
>
Indeed Ashley, I'm trying to get the TRUE / FALSE value from the boolean
tag.

After reading again, you're absolutely right: strpos does just what I need
it to do: a simple search for a true or false. (Or null, in which case
strpos will be FALSE anyway).

Thanks for your suggestion, I was doing an overkill here.

@Shreyas: thanks for the link! It is very helpful to speed up the testing a
bit!

Greetings!


-- 
Mailed by:
UnReAl4U - unreal4u
ICQ #: 54472056
www1: http://www.chw.net/
www2: http://unreal4u.com/


Re: [PHP] method overloading in a class

2010-08-18 Thread Adam Richardson
On Wed, Aug 18, 2010 at 12:23 PM, Ashley Sheridan
wrote:

> Hi list,
>
> I know that some languages such as C++ can overload functions and
> methods by declaring the method again with a different number of
> arguments, and the compiler internally sorts things out, but I can't
> seem to find a similar way to do this with PHP.
>
> Basically, what I've got at the moment is a class method with 2
> arguments, and I need to be able to overload the method with 3
> arguments. The following which would work in other languages doesn't
> seem to bring any joy in PHP:
>
> class foo
> {
>public function bar($arg1, $arg2)
>   {
>// do something with $arg1 & $arg2
>}
>
>public function bar($arg1, $arg2, $arg3)
>{
>// do something different with all 3 args
>}
> }
>
> Is there any feasible way of doing this? The method names really need to
> remain the same as they exist as part of a framework, but the arguments
> really server quite different purposes between the two methods, so
> there's no nice way of just merging the two functions without breaking
> the naming conventions, etc used.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
Hi Ashley,

Sorry for a slow reply, but I've found a free second and I'd like to toss
out the scheme I've used most often.

If args 1 and 2 are consistent in terms of type and usage across the two
methods, I simply add arg3 with a default to null and conditionally call a
private method that performs the special operation (documentation and
primary entry point remain in one place.  Essentially, I just add a guard
clause to the original function.  The

class foo
{
   public function bar($arg1, $arg2, $arg3 = null)
  {
   if (!is_null($arg3)) return _specialbar($arg1, $arg2, $arg3);

   // do something with $arg1 & $arg2
   }

   public function _specialbar($arg1, $arg2, $arg3)
   {
   // do something different with all 3 args
   }
}

If, however, the functions differ significantly in terms of signature, I
tend to write a wrapper function that chooses the appropriate internal call
(e.g., newbar()), but this doesn't play too nicely with documentation within
the PHP ecosystem (although within other language systems such as Java, C#,
and Erlang, it's really quite nice and elegant), so I tend to structure my
code to make use of option one when possible.

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


Re: [PHP] method overloading in a class

2010-08-18 Thread Ashley Sheridan
On Wed, 2010-08-18 at 12:35 -0400, chris h wrote:
> 
> 
> Would something like this work for you?
> 
> 
> class foo
> {
> 
> 
>public function bar($arg1, $arg2, $arg3=null)
>   {
> 
> 
>  if (isset($arg3)){
>  {
> return $this->_bar3($arg1, $arg2, $arg3);
> 
> 
>  } else {
> return $this->_bar2($arg1, $arg2);
> 
> 
>  }
> 
> 
> 
>   }
> 
> 
> 
> 
> also you may want to look into the func_get_args function.
> 
> 
> 
> 
> 
> 
> 
> Chris.
> 
> 
> 
> 
> 
> 
> On Wed, Aug 18, 2010 at 12:23 PM, Ashley Sheridan
>  wrote:
> 
> Hi list,
> 
> I know that some languages such as C++ can overload functions
> and
> methods by declaring the method again with a different number
> of
> arguments, and the compiler internally sorts things out, but I
> can't
> seem to find a similar way to do this with PHP.
> 
> Basically, what I've got at the moment is a class method with
> 2
> arguments, and I need to be able to overload the method with 3
> arguments. The following which would work in other languages
> doesn't
> seem to bring any joy in PHP:
> 
> class foo
> {
>public function bar($arg1, $arg2)
>   {
>// do something with $arg1 & $arg2
>}
> 
>public function bar($arg1, $arg2, $arg3)
>{
>// do something different with all 3 args
>}
> }
> 
> Is there any feasible way of doing this? The method names
> really need to
> remain the same as they exist as part of a framework, but the
> arguments
> really server quite different purposes between the two
> methods, so
> there's no nice way of just merging the two functions without
> breaking
> the naming conventions, etc used.
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 
> 
> 

Thanks to everyone, I decided to modify the existing original method and
use func_get_args() to grab the arguments passed to it. It's not
perfect, because I lose out on the automatic value assignment that I
would have with a regular method (i.e. function foo($bar, $fubar=0) etc)
but it will do at a pinch.

It's a shame this sort of overloading isn't supported, as it could be
quite a useful feature, but it's not a complete show-stopper.

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




Re: [PHP] Regular expressions, filter option1 OR option2

2010-08-18 Thread Ashley Sheridan
On Wed, 2010-08-18 at 23:36 +0530, Shreyas Agasthya wrote:

> Camilo,
> 
> What exactly are you trying to achieve? Meaning:
> 
> if (true)
>do this;
> if (false)
>do that;
> 
> However, here's a link that I used long back to help me with some RegEx :
> http://www.gskinner.com/RegExr/
> 
> Regards,
> Shreyas
> 
> On Wed, Aug 18, 2010 at 11:31 PM, Camilo Sperberg 
> wrote:
> 
> > Hello list :)
> >
> > Just a short question which I know it should be easy, but I'm no expert yet
> > in regular expressions.
> > I've got a nice little XML string, which is something like this but can be
> > changed:
> >
> > 
> > http://tempuri.org/";>false
> >
> > The boolean value can be true or false, so what I want to do, is filter it.
> > I've done it this way, but I know it can be improved (just because I love
> > clean coding and also because I want to master regular expressions xD):
> >
> >  $result = preg_match('/true/',$curl_response);
> >  if ($result == 0) $result = preg_match('/false/',$curl_response);
> >
> > I've also tried something like:
> > $result = preg_replace('/^(true)|^(false)/','',$curl_response); // if not
> > true OR not false => replace with empty
> >
> > and also '/^true|^false/' which doesn't seem to work.
> >
> > Any ideas to filter this kind of string in just one expression?
> >
> > Thanks in advance :)
> >
> > --
> > Mailed by:
> > UnReAl4U - unreal4u
> > ICQ #: 54472056
> > www1: http://www.chw.net/
> > www2: http://unreal4u.com/
> >
> 
> 
> 


As far as I can tell, are you just trying to grab the content from the
 tag text node? If it's limited to this basic example, there's
likely not much of a need to use dedicated DOM functions, but consider
using them if you need to work on more complex documents.

If you are just trying to determine if the value is indeed true or false
and nothing else, then a regex could be overkill here. As you only need
to check two values, consider:

if(strpos($xml, 'true') || strpos($xml, 'false'))
{
// text node content is OK
}
else
{
// bad, bad input, go sit in the corner
}

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




[PHP] SSL Timeout Issue with fopen, fsockopen, file_get_contents, etc

2010-08-18 Thread Brent Macnaughton
I am really in need of some help here! Whenever I try to use fopen,
fsockopen, file_get_contents, etc in php to open an https/ssl; resource, i
get the following errors:

Warning: file_get_contents(): SSL: connection timeout
Warning: file_get_contents(): Failed to enable crypto

Here is some relevant information from phpinfo():

OpenSSL support enabled
OpenSSL Version OpenSSL 0.9.8n 24 Mar 2010
Registered Stream Socket Transports tcp, udp, unix, udg, ssl, sslv3,
sslv2, tls
Registered PHP Streams https, ftps, compress.zlib, compress.bzip2, php,
file, data, http, ftp
allow_url_fopenOn
default_socket_timeout60

The SSL connection timeout message occurs immediately. The server is not
blocking outbound communications as a tcpdump on the server that php is
trying to connect to shows connection activity, however, the apache and php
logs on this server do not show any entries at all when php tries to connect
to it.

On the server with php installed on it, openssl appears to be installed
correctly.

--
[r...@rdcsol-10-01]# /opt/csw/bin/openssl version
OpenSSL 0.9.8n 24 Mar 2010
[r...@rdcsol-10-01]# /opt/csw/bin/openssl s_client -connect
wwwgooglecom:443
CONNECTED(0004)
depth=1 /C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
 0 s:/C=US/ST=California/L=Mountain View/O=Google
Inc/CN=wwwgooglecom
   i:/C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA
 1 s:/C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA
   i:/C=US/O=VeriSign, Inc./OU=Class 3 Public Primary Certification
Authority
---
Server certificate
-BEGIN CERTIFICATE-
MIIDITCCAoqgAwIBAgIQL9+89q6RUm0PmqPfQDQ+mjANBgkqhkiG9w0BAQUFADBM
MQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkg
THRkLjEWMBQGA1UEAxMNVGhhd3RlIFNHQyBDQTAeFw0wOTEyMTgwMDAwMDBaFw0x
MTEyMTgyMzU5NTlaMGgxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlh
MRYwFAYDVQQHFA1Nb3VudGFpbiBWaWV3MRMwEQYDVQQKFApHb29nbGUgSW5jMRcw
FQYDVQQDFA53d3cuZ29vZ2xlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC
gYEA6PmGD5D6htffvXImttdEAoN4c9kCKO+IRTn7EOh8rqk41XXGOOsKFQebg+jN
gtXj9xVoRaELGYW84u+E593y17iYwqG7tcFR39SDAqc9BkJb4SLD3muFXxzW2k6L
05vuuWciKh0R73mkszeK9P4Y/bz5RiNQl/Os/CRGK1w7t0UCAwEAAaOB5zCB5DAM
BgNVHRMBAf8EAjAAMDYGA1UdHwQvMC0wK6ApoCeGJWh0dHA6Ly9jcmwudGhhd3Rl
LmNvbS9UaGF3dGVTR0NDQS5jcmwwKAYDVR0lBCEwHwYIKwYBBQUHAwEGCCsGAQUF
BwMCBglghkgBhvhCBAEwcgYIKwYBBQUHAQEEZjBkMCIGCCsGAQUFBzABhhZodHRw
Oi8vb2NzcC50aGF3dGUuY29tMD4GCCsGAQUFBzAChjJodHRwOi8vd3d3LnRoYXd0
ZS5jb20vcmVwb3NpdG9yeS9UaGF3dGVfU0dDX0NBLmNydDANBgkqhkiG9w0BAQUF
AAOBgQCfQ89bxFApsb/isJr/aiEdLRLDLE5a+RLizrmCUi3nHX4adpaQedEkUjh5
u2ONgJd8IyAPkU0Wueru9G2Jysa9zCRo1kNbzipYvzwY4OA8Ys+WAi0oR1A04Se6
z5nRUP8pJcA2NhUzUnC+MY+f6H/nEQyNv4SgQhqAibAxWEEHXw==
-END CERTIFICATE-
subject=/C=US/ST=California/L=Mountain View/O=Google
Inc/CN=wwwgooglecom
issuer=/C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA
---
No client certificate CA names sent
---
SSL handshake has read 1772 bytes and written 313 bytes
---
New, TLSv1/SSLv3, Cipher is RC4-SHA
Server public key is 1024 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
SSL-Session:
Protocol  : TLSv1
Cipher: RC4-SHA
Session-ID:
E2CEF3FD72185DD712E49E49F7794445AA9B034B8E6D26023A02D41D1B3E6FD8
Session-ID-ctx:
Master-Key:
E35A311ADFB1BA4C53A84D836368316D2057ED794071E16602A6D5CE59E288C99437114AE4E809966D6082B2A826B9F6
Key-Arg   : None
Start Time: 1282152269
Timeout   : 300 (sec)
Verify return code: 20 (unable to get local issuer certificate)

--

Server: SunOS rdcsol-10-01 5.10 Generic_142901-05 i86pc i386 i86pc
COmpiler used to compile php: cc: Sun C 5.10 SunOS_i386 2009/06/03

OpenSSL:
[r...@rdcsol-10-01]# /opt/csw/bin/openssl version -a
OpenSSL 0.9.8n 24 Mar 2010
built on: Thu Mar 25 21:12:32 CET 2010
platform: solaris-pentium_pro-cc
options:  bn(64,32) md2(int) rc4(ptr,char) des(ptr,cisc,16,long) idea(int)
blowfish(ptr)
compiler: cc -KPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN
-DHAVE_DLFCN_H -fast -xarch=pentium_pro -O -Xa
OPENSSLDIR: "/opt/csw/ssl"

--

Right now, I have compiled php against the OpenSSL packages from OpenCSW. I
have also tried compiling php against openssl-1.0.0 which I compiled myself
from source. This did not help anything as php was still having the exact
same ssl timeout errors.

I am really stumped here. Any help would be greatly appreciated.

Brent.


Re: [PHP] Regular expressions, filter option1 OR option2

2010-08-18 Thread Shreyas Agasthya
Camilo,

What exactly are you trying to achieve? Meaning:

if (true)
   do this;
if (false)
   do that;

However, here's a link that I used long back to help me with some RegEx :
http://www.gskinner.com/RegExr/

Regards,
Shreyas

On Wed, Aug 18, 2010 at 11:31 PM, Camilo Sperberg wrote:

> Hello list :)
>
> Just a short question which I know it should be easy, but I'm no expert yet
> in regular expressions.
> I've got a nice little XML string, which is something like this but can be
> changed:
>
> 
> http://tempuri.org/";>false
>
> The boolean value can be true or false, so what I want to do, is filter it.
> I've done it this way, but I know it can be improved (just because I love
> clean coding and also because I want to master regular expressions xD):
>
>  $result = preg_match('/true/',$curl_response);
>  if ($result == 0) $result = preg_match('/false/',$curl_response);
>
> I've also tried something like:
> $result = preg_replace('/^(true)|^(false)/','',$curl_response); // if not
> true OR not false => replace with empty
>
> and also '/^true|^false/' which doesn't seem to work.
>
> Any ideas to filter this kind of string in just one expression?
>
> Thanks in advance :)
>
> --
> Mailed by:
> UnReAl4U - unreal4u
> ICQ #: 54472056
> www1: http://www.chw.net/
> www2: http://unreal4u.com/
>



-- 
Regards,
Shreyas Agasthya


[PHP] Regular expressions, filter option1 OR option2

2010-08-18 Thread Camilo Sperberg
Hello list :)

Just a short question which I know it should be easy, but I'm no expert yet
in regular expressions.
I've got a nice little XML string, which is something like this but can be
changed:


http://tempuri.org/";>false

The boolean value can be true or false, so what I want to do, is filter it.
I've done it this way, but I know it can be improved (just because I love
clean coding and also because I want to master regular expressions xD):

  $result = preg_match('/true/',$curl_response);
  if ($result == 0) $result = preg_match('/false/',$curl_response);

I've also tried something like:
$result = preg_replace('/^(true)|^(false)/','',$curl_response); // if not
true OR not false => replace with empty

and also '/^true|^false/' which doesn't seem to work.

Any ideas to filter this kind of string in just one expression?

Thanks in advance :)

-- 
Mailed by:
UnReAl4U - unreal4u
ICQ #: 54472056
www1: http://www.chw.net/
www2: http://unreal4u.com/


Re: [PHP] method overloading in a class

2010-08-18 Thread chris h
Would something like this work for you?

class foo
{

   public function bar($arg1, $arg2, $arg3=null)
  {

 if (isset($arg3)){
 {
return $this->_bar3($arg1, $arg2, $arg3);

 } else {
return $this->_bar2($arg1, $arg2);

 }

  }


also you may want to look into the func_get_args function.



Chris.


On Wed, Aug 18, 2010 at 12:23 PM, Ashley Sheridan
wrote:

> Hi list,
>
> I know that some languages such as C++ can overload functions and
> methods by declaring the method again with a different number of
> arguments, and the compiler internally sorts things out, but I can't
> seem to find a similar way to do this with PHP.
>
> Basically, what I've got at the moment is a class method with 2
> arguments, and I need to be able to overload the method with 3
> arguments. The following which would work in other languages doesn't
> seem to bring any joy in PHP:
>
> class foo
> {
>public function bar($arg1, $arg2)
>   {
>// do something with $arg1 & $arg2
>}
>
>public function bar($arg1, $arg2, $arg3)
>{
>// do something different with all 3 args
>}
> }
>
> Is there any feasible way of doing this? The method names really need to
> remain the same as they exist as part of a framework, but the arguments
> really server quite different purposes between the two methods, so
> there's no nice way of just merging the two functions without breaking
> the naming conventions, etc used.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>


[PHP] method overloading in a class

2010-08-18 Thread Ashley Sheridan
Hi list,

I know that some languages such as C++ can overload functions and
methods by declaring the method again with a different number of
arguments, and the compiler internally sorts things out, but I can't
seem to find a similar way to do this with PHP.

Basically, what I've got at the moment is a class method with 2
arguments, and I need to be able to overload the method with 3
arguments. The following which would work in other languages doesn't
seem to bring any joy in PHP:

class foo
{
public function bar($arg1, $arg2)
   {
// do something with $arg1 & $arg2
}

public function bar($arg1, $arg2, $arg3)
{
// do something different with all 3 args
}
}

Is there any feasible way of doing this? The method names really need to
remain the same as they exist as part of a framework, but the arguments
really server quite different purposes between the two methods, so
there's no nice way of just merging the two functions without breaking
the naming conventions, etc used.

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




Re: [PHP] tutorial failure

2010-08-18 Thread e-letter
On 18/08/2010, Bob McConnell  wrote:
> From: e-letter
>
>> On 18/08/2010, chris h  wrote:
>>> On Wed, Aug 18, 2010 at 7:10 AM, e-letter  wrote:
>>>
 On 18/08/2010, chris h  wrote:
 > What are the actual file permissions when you run ls -o?
 >
 root

>>>
>>> What's the entire output of ls -o?
>>>
>> [r...@localhost html]# ls -o *
>> -rwxr-xr-x 1 root  182 2010-08-18 11:33 test.php*
>>
>> addon-modules:
>> total 4
>> lrwxrwxrwx 1 root  51 2010-01-11 22:03 apache-mod_svn_view-0.1.0 ->
>> ../../../../usr/share/doc/apache-mod_svn_view-0.1.0
>> lrwxrwxrwx 1 root  52 2010-01-11 22:03 apache-mod_transform-0.6.0 ->
>> ../../../../usr/share/doc/apache-mod_transform-0.6.0
>> -rw-r--r-- 1 root 115 2007-09-07 21:47 HOWTO_get_modules.html
>>
>>>
 >
 > Do you know if PHP is installed as an apache mod or cgi? Also you
> might
 > check what user apache is running as.
 >
 No. How to verify?

 > possibly...
 > $ vi /etc/apache2/envvars
 >
 No apache2 on my computer, only '/usr/lib/apache' which contains
> only .so
 files.

>>>
>>> there's no /etc/apache either?
>>>
>> No
>
> Some distributions have really screwed up the locations of various
> applications. This is compounded by the decision to rename the Apache 2
> directories to httpd. Look for /etc/httpd, /home/httpd or
> /usr/lib/httpd. If worse comes to worst, try
>
In '/etc/httpd/conf' there is an empty directory 'addon-modules'. In
/usr/lib/apache-extramodules there is 'mod_php5.so'.

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



Re: [PHP] mysqldump

2010-08-18 Thread Daniel P. Brown
On Tue, Aug 17, 2010 at 15:19, tedd  wrote:
>
> Bingo -- that worked.
>
> It's interesting that a space is optional between -u and user, but required
> to be absent between -p and password. Seems not symmetrical to me.

The command I sent was because - as I said in the original thread
- passing any password directly to the command line is Very Bad[tm].
If you're passing it via exec(), though, and don't want to use an
'expect' shell, passing it directly to -p is at least a bit less
dangerous.  Plus, doing so will not leave anything in your
~/.bash_history on the server.

That said, sorry for appearing inattentive, despite this being
directed right at me.  I have been out of the office more than in for
the last couple of weeks, while working on a ton of new stuff.
Eventually it will go back to "normal."

-- 

UNADVERTISED DEDICATED SERVER SPECIALS
SAME-DAY SETUP
Just ask me what we're offering today!
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/

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



RE: [PHP] tutorial failure

2010-08-18 Thread Bob McConnell
From: e-letter

> On 18/08/2010, chris h  wrote:
>> On Wed, Aug 18, 2010 at 7:10 AM, e-letter  wrote:
>>
>>> On 18/08/2010, chris h  wrote:
>>> > What are the actual file permissions when you run ls -o?
>>> >
>>> root
>>>
>>
>> What's the entire output of ls -o?
>>
> [r...@localhost html]# ls -o *
> -rwxr-xr-x 1 root  182 2010-08-18 11:33 test.php*
> 
> addon-modules:
> total 4
> lrwxrwxrwx 1 root  51 2010-01-11 22:03 apache-mod_svn_view-0.1.0 ->
> ../../../../usr/share/doc/apache-mod_svn_view-0.1.0
> lrwxrwxrwx 1 root  52 2010-01-11 22:03 apache-mod_transform-0.6.0 ->
> ../../../../usr/share/doc/apache-mod_transform-0.6.0
> -rw-r--r-- 1 root 115 2007-09-07 21:47 HOWTO_get_modules.html
> 
>>
>>> >
>>> > Do you know if PHP is installed as an apache mod or cgi? Also you
might
>>> > check what user apache is running as.
>>> >
>>> No. How to verify?
>>>
>>> > possibly...
>>> > $ vi /etc/apache2/envvars
>>> >
>>> No apache2 on my computer, only '/usr/lib/apache' which contains
only .so
>>> files.
>>>
>>
>> there's no /etc/apache either?
>>
> No

Some distributions have really screwed up the locations of various
applications. This is compounded by the decision to rename the Apache 2
directories to httpd. Look for /etc/httpd, /home/httpd or
/usr/lib/httpd. If worse comes to worst, try

ps ax | grep httpd

 to see if you can find the path from the original start up in the init
process.

Bob McConnell

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



Re: [PHP] tutorial failure

2010-08-18 Thread e-letter
On 18/08/2010, Ashley Sheridan  wrote:
> On Wed, 2010-08-18 at 12:10 +0100, e-letter wrote:
>
>> On 18/08/2010, chris h  wrote:
>> > What are the actual file permissions when you run ls -o?
>> >
>> root
>> >
>> > Do you know if PHP is installed as an apache mod or cgi? Also you might
>> > check what user apache is running as.
>> >
>> No. How to verify?
>>
>> > possibly...
>> > $ vi /etc/apache2/envvars
>> >
>> No apache2 on my computer, only '/usr/lib/apache' which contains only .so
>> files.
>>
>
>
> ls -o doesn't give one word answers, so again, what is the output of an
> ls -o call in your shell?
>
> I assume that root is the owner of the file here, and the fact that
> you're getting some output from it seems to suggest that at least read
> permissions are available for group and other, but you should check to
> see if the permissions are indeed something like 664 (-rw-rw-r--)
>
> What OS are you using? I'm assuming a Linux distro of some kind here,
> but it could also be another Unix variant. Have you tried using the
> package manager within the distro (if it is Linux) to install PHP and
> Apache together? That makes it a lot easier to get up and running with a
> decent configuration, especially if you're unfamiliar with the more
> complicated details.
>
I used urpmi with mandriva

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



Re: [PHP] tutorial failure

2010-08-18 Thread Ashley Sheridan
On Wed, 2010-08-18 at 12:10 +0100, e-letter wrote:

> On 18/08/2010, chris h  wrote:
> > What are the actual file permissions when you run ls -o?
> >
> root
> >
> > Do you know if PHP is installed as an apache mod or cgi? Also you might
> > check what user apache is running as.
> >
> No. How to verify?
> 
> > possibly...
> > $ vi /etc/apache2/envvars
> >
> No apache2 on my computer, only '/usr/lib/apache' which contains only .so 
> files.
> 


ls -o doesn't give one word answers, so again, what is the output of an
ls -o call in your shell?

I assume that root is the owner of the file here, and the fact that
you're getting some output from it seems to suggest that at least read
permissions are available for group and other, but you should check to
see if the permissions are indeed something like 664 (-rw-rw-r--)

What OS are you using? I'm assuming a Linux distro of some kind here,
but it could also be another Unix variant. Have you tried using the
package manager within the distro (if it is Linux) to install PHP and
Apache together? That makes it a lot easier to get up and running with a
decent configuration, especially if you're unfamiliar with the more
complicated details.

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




Re: [PHP] tutorial failure

2010-08-18 Thread e-letter
On 18/08/2010, chris h  wrote:
> On Wed, Aug 18, 2010 at 7:10 AM, e-letter  wrote:
>
>> On 18/08/2010, chris h  wrote:
>> > What are the actual file permissions when you run ls -o?
>> >
>> root
>>
>
> What's the entire output of ls -o?
>
[r...@localhost html]# ls -o *
-rwxr-xr-x 1 root  182 2010-08-18 11:33 test.php*

addon-modules:
total 4
lrwxrwxrwx 1 root  51 2010-01-11 22:03 apache-mod_svn_view-0.1.0 ->
../../../../usr/share/doc/apache-mod_svn_view-0.1.0
lrwxrwxrwx 1 root  52 2010-01-11 22:03 apache-mod_transform-0.6.0 ->
../../../../usr/share/doc/apache-mod_transform-0.6.0
-rw-r--r-- 1 root 115 2007-09-07 21:47 HOWTO_get_modules.html

>
>> >
>> > Do you know if PHP is installed as an apache mod or cgi? Also you might
>> > check what user apache is running as.
>> >
>> No. How to verify?
>>
>> > possibly...
>> > $ vi /etc/apache2/envvars
>> >
>> No apache2 on my computer, only '/usr/lib/apache' which contains only .so
>> files.
>>
>
> there's no /etc/apache either?
>
No

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



Re: [PHP] tutorial failure

2010-08-18 Thread chris h
On Wed, Aug 18, 2010 at 7:10 AM, e-letter  wrote:

> On 18/08/2010, chris h  wrote:
> > What are the actual file permissions when you run ls -o?
> >
> root
>

What's the entire output of ls -o?


> >
> > Do you know if PHP is installed as an apache mod or cgi? Also you might
> > check what user apache is running as.
> >
> No. How to verify?
>
> > possibly...
> > $ vi /etc/apache2/envvars
> >
> No apache2 on my computer, only '/usr/lib/apache' which contains only .so
> files.
>

there's no /etc/apache either?


Re: [PHP] tutorial failure

2010-08-18 Thread e-letter
On 18/08/2010, chris h  wrote:
> What are the actual file permissions when you run ls -o?
>
root
>
> Do you know if PHP is installed as an apache mod or cgi? Also you might
> check what user apache is running as.
>
No. How to verify?

> possibly...
> $ vi /etc/apache2/envvars
>
No apache2 on my computer, only '/usr/lib/apache' which contains only .so files.

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



Re: [PHP] tutorial failure

2010-08-18 Thread chris h
What are the actual file permissions when you run ls -o?


Do you know if PHP is installed as an apache mod or cgi? Also you might
check what user apache is running as.

possibly...
$ vi /etc/apache2/envvars

and look for something like...
export APACHE_RUN_USER=www-data




On Wed, Aug 18, 2010 at 6:47 AM, e-letter  wrote:

> On 18/08/2010, chris h  wrote:
> > php is not processing the file.  There's a few reasons for this, but the
> > first thing I would check is the permissions of the file.  From the
> > directory try
> >
> > $ ls -oa
> >
> The file permission was confirmed as root, since it was copied (as
> root) from a normal user account directorp 'temporary' to the
> directory '/var/www/html'
>
> > This should tell you who owns the file and what it's permissions are.
>  You
> > mentioned that you copied it as root, you could change it's ownership to
> > www-data.
> >
> This fails:
>
> [r...@localhost html]# chown www-data test.php
> chown: `www-data': invalid user
>
> So I repeated this with a normal user account and the change in
> permission occurs. However, the html file containing the php script
> remains unchanged.
>
> The instruction:
>
> ...
> 
> ...
>
> Does not show the version of php.
>


Re: [PHP] tutorial failure

2010-08-18 Thread e-letter
On 18/08/2010, Peter Lind  wrote:
> On 18 August 2010 12:47, e-letter  wrote:
>> On 18/08/2010, chris h  wrote:
>>> php is not processing the file.  There's a few reasons for this, but the
>>> first thing I would check is the permissions of the file.  From the
>>> directory try
>>>
>>> $ ls -oa
>>>
>> The file permission was confirmed as root, since it was copied (as
>> root) from a normal user account directorp 'temporary' to the
>> directory '/var/www/html'
>>
>>> This should tell you who owns the file and what it's permissions are.
>>>  You
>>> mentioned that you copied it as root, you could change it's ownership to
>>> www-data.
>>>
>> This fails:
>>
>> [r...@localhost html]# chown www-data test.php
>> chown: `www-data': invalid user
>>
>> So I repeated this with a normal user account and the change in
>> permission occurs. However, the html file containing the php script
>> remains unchanged.
>>
>> The instruction:
>>
>> ...
>> 
>> ...
>>
>> Does not show the version of php.
>>
>
> Your webserver might not be configured to process php files - which
> server are you using?
>
Apache. Below is an extract of an (to now) unanswered question:

...

   SetHandler application/x-httpd-php
http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] tutorial failure

2010-08-18 Thread Peter Lind
On 18 August 2010 12:47, e-letter  wrote:
> On 18/08/2010, chris h  wrote:
>> php is not processing the file.  There's a few reasons for this, but the
>> first thing I would check is the permissions of the file.  From the
>> directory try
>>
>> $ ls -oa
>>
> The file permission was confirmed as root, since it was copied (as
> root) from a normal user account directorp 'temporary' to the
> directory '/var/www/html'
>
>> This should tell you who owns the file and what it's permissions are.  You
>> mentioned that you copied it as root, you could change it's ownership to
>> www-data.
>>
> This fails:
>
> [r...@localhost html]# chown www-data test.php
> chown: `www-data': invalid user
>
> So I repeated this with a normal user account and the change in
> permission occurs. However, the html file containing the php script
> remains unchanged.
>
> The instruction:
>
> ...
> 
> ...
>
> Does not show the version of php.
>

Your webserver might not be configured to process php files - which
server are you using?

Regards
Peter

-- 

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15


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



Re: [PHP] tutorial failure

2010-08-18 Thread e-letter
On 18/08/2010, chris h  wrote:
> php is not processing the file.  There's a few reasons for this, but the
> first thing I would check is the permissions of the file.  From the
> directory try
>
> $ ls -oa
>
The file permission was confirmed as root, since it was copied (as
root) from a normal user account directorp 'temporary' to the
directory '/var/www/html'

> This should tell you who owns the file and what it's permissions are.  You
> mentioned that you copied it as root, you could change it's ownership to
> www-data.
>
This fails:

[r...@localhost html]# chown www-data test.php
chown: `www-data': invalid user

So I repeated this with a normal user account and the change in
permission occurs. However, the html file containing the php script
remains unchanged.

The instruction:

...

...

Does not show the version of php.

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



Re: [PHP] tutorial failure

2010-08-18 Thread chris h
php is not processing the file.  There's a few reasons for this, but the
first thing I would check is the permissions of the file.  From the
directory try

$ ls -oa

This should tell you who owns the file and what it's permissions are.  You
mentioned that you copied it as root, you could change it's ownership to
www-data.

again from the directory try.

$ chown www-data test.php

then run ls -oa to ensure the change took place.


Chris.

On Wed, Aug 18, 2010 at 6:03 AM, e-letter  wrote:

> I changed the code as follows:
>
> 
>
>php test
>
>
>
> 
> echo "Hi, I am a PHP script";
>?>
>
>this is a test
>
>
> 
>
> The result (http://localhost/test.php):
>
> Hi, I am a PHP script
>
> "; ?>
>
> this is a test
>
> If I use single quotes characters:
>
> Hi, I am a PHP script
>
> '; ?>
>
> this is a test
>
> The phpinfo instruction does not seem to be recognised. What else
> should I check?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] tutorial failure

2010-08-18 Thread e-letter
I changed the code as follows:



php test




Hi, I am a PHP script";
?>

this is a test




The result (http://localhost/test.php):

Hi, I am a PHP script

"; ?>

this is a test

If I use single quotes characters:

Hi, I am a PHP script

'; ?>

this is a test

The phpinfo instruction does not seem to be recognised. What else
should I check?

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



Re: [PHP] tutorial failure

2010-08-18 Thread Peter Lind
On 18 August 2010 10:44, e-letter  wrote:
> Readers,
>
> Copy below of message sent 15 August to php install digest list, but
> to date not including in mail archive?
>
> The tutorial example:
>
> 
>      
>              php test
>                    
>      
>                                    echo 'Hi, I am a PHP script';
>              ?>
>              
>              this is a test
>              
>      
> 
>
> is saved to the normal user temporary folder as 'test.php' and then
> copied to the folder '/var/www/html/' using the root user account. The
> web browser is directed to url 'http://localhost.test.php, to show:
>
> Hi, I am a PHP script
>
> '; ?>
>
> this is a test
>
> What is the error please?

Looks like a problem with quotes, I'd say.

> Urpmi was used to install so the php version installed is not known.
> How to obtain this please

Check with php -i from the command line or a script containing
phpinfo(); requested through the browser.

Regards
Peter

-- 

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15


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



RE: [PHP] tutorial failure

2010-08-18 Thread Arno Kuhl
-Original Message-
From: e-letter [mailto:inp...@gmail.com] 
Sent: 18 August 2010 10:44 AM
To: php-general@lists.php.net
Subject: [PHP] tutorial failure

Readers,

Copy below of message sent 15 August to php install digest list, but to date
not including in mail archive?

The tutorial example:


  
  php test
  
  
  Hi, I am a PHP script';
  ?>
  
  this is a test
  
  


is saved to the normal user temporary folder as 'test.php' and then copied
to the folder '/var/www/html/' using the root user account. The web browser
is directed to url 'http://localhost.test.php, to show:

Hi, I am a PHP script

'; ?>

this is a test

What is the error please?

Urpmi was used to install so the php version installed is not known.
How to obtain this please

--

Shouldn't that be http://localhost/test.php

Cheers
Arno



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



[PHP] tutorial failure

2010-08-18 Thread e-letter
Readers,

Copy below of message sent 15 August to php install digest list, but
to date not including in mail archive?

The tutorial example:


  
  php test
  
  
  Hi, I am a PHP script';
  ?>
  
  this is a test
  
  


is saved to the normal user temporary folder as 'test.php' and then
copied to the folder '/var/www/html/' using the root user account. The
web browser is directed to url 'http://localhost.test.php, to show:

Hi, I am a PHP script

'; ?>

this is a test

What is the error please?

Urpmi was used to install so the php version installed is not known.
How to obtain this please

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



[PHP] Re: Including files on NFS mount slow with APC enabled

2010-08-18 Thread Mark Hunting
Bug reported, see http://pecl.php.net/bugs/bug.php?id=18154

On 08/17/2010 01:13 PM, Colin Guthrie wrote:
> I don't know the internals of APC but that smells like a bug to me.
>
> Can you post the bug number here if you report one?
>
> Cheers
>
> Col
>
>   

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



Re: [PHP] How verify whether browser arrived via IPv6, IPv4, domain or number

2010-08-18 Thread Per Jessen
Leith Bade wrote:

> I want to take $_SERVER['SERVER_NAME'] and figure out whether the user
> arrived by typing an IPv6-only, IPv4-only or dual IPv4/IPv6 DNS
> address.
> 
> It should also handle the case where the user enters a numeric address
> in one of the formats the sockets inet_addr() function can handle.
> Such as IPv4/IPv6 dotted decimal, octal, hex, DWORD, etc.
> 
> So far I have thought up this:
> 
>1. Use gethostbyname($_SERVER['SERVER_NAME']) to get an address
>2. Check this address to see if it is IPv4/IPv6
> 
> Will this always work?

gethostbyname() does not return any IPv6 addresses.  You need
getaddrinfo(), but that is AFAIK not yet implemented for php.

> Also what is the best way in php to check if an address is IPv4 or
> IPv6?

preg_match() ?



-- 
Per Jessen, Zürich (16.2°C)


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