php-general Digest 22 Mar 2011 10:45:42 -0000 Issue 7237
php-general Digest 22 Mar 2011 10:45:42 - Issue 7237 Topics (messages 311980 through 311983): Re: Question about directory permissions 311980 by: Andy McKenzie 311981 by: Curtis Maurand SSL issues 311982 by: Bostjan Skufca 311983 by: Richard Quadling Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- Sure. The script runs with the permissions of whoever is running it. In general, a PHP script that's a web page in linux will run by a user called something like apache, apache2, www-user, or something similar. If you give that user permissions -- either directly or through their group, often of the same name -- to write to the directory in question, then the script will be able to write to it. For instance: on my Ubuntu 10.04 server, I want my script DW3 to be able to write to /var/www/DW3/logs. I leave ownership of everything else as it was, and do the following: $ cd /var/www/DW3 $ chgrp www-data ./logs $ chmod 770 ./logs Now members of the group www-data (at the moment only apache) can write to the directory, as can the owner, but no one else can. In reality, I could probably have set that to 660, but I don't much care about the slight added risk of using 770 in this case. (If you're confused by the numbers I used, check here: http://www.yolinux.com/TUTORIALS/LinuxTutorialManagingGroups.html) I hope that helps! -Andy On Mon, Mar 21, 2011 at 1:58 PM, Al n...@ridersite.org wrote: I understand dir perms pretty well; but, have a question I can't readily find the answer to. Under a Linux system, scripts can't write, copy, etc. to other dirs unless the perms are set for writable for the script e.g., nobody. But, is there a way a script can write or copy within its own dir? Thanks... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- ---BeginMessage--- Al wrote: I understand dir perms pretty well; but, have a question I can't readily find the answer to. Under a Linux system, scripts can't write, copy, etc. to other dirs unless the perms are set for writable for the script e.g., nobody. But, is there a way a script can write or copy within its own dir? Not unless it has permission to do so. Most likely, however, it can write to the temp space such as /tmp or /var/tmp. --Curtis ---End Message--- ---BeginMessage--- Hi all, is anyone else experiencing SSL connectivity issues with PHP 5.3(.5|6)? PHP 5.2.17 compiled identically on the same system with the same config file connects to remote SSL-enabled host just fine, whereas PHP 5.3 (only tried .5 and .6) does not. Error message: Warning: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:140773F2:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert unexpected message Warning: stream_socket_client(): Failed to enable crypto Any ideas why this is happening? Thanks, b. PS: With all the best efforts towards ditching PHP 5.2 this is a real showstopper. ---End Message--- ---BeginMessage--- On 22 March 2011 01:21, Bostjan Skufca bost...@a2o.si wrote: Hi all, is anyone else experiencing SSL connectivity issues with PHP 5.3(.5|6)? PHP 5.2.17 compiled identically on the same system with the same config file connects to remote SSL-enabled host just fine, whereas PHP 5.3 (only tried .5 and .6) does not. Error message: Warning: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:140773F2:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert unexpected message Warning: stream_socket_client(): Failed to enable crypto Any ideas why this is happening? Thanks, b. PS: With all the best efforts towards ditching PHP 5.2 this is a real showstopper. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I'm on Windows. Using 5-3-7-dev (my own build with php_openssl statically built rather than as a shared extension). php -d error_reporting=-1 -d display_errors=1 -r echo file_get_contents('https://mail.google.com/mail'); and I get the correct content and no errors. Can you try the above command? Richard. -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY ---End Message---
Re: [PHP] SSL issues
On 22 March 2011 01:21, Bostjan Skufca bost...@a2o.si wrote: Hi all, is anyone else experiencing SSL connectivity issues with PHP 5.3(.5|6)? PHP 5.2.17 compiled identically on the same system with the same config file connects to remote SSL-enabled host just fine, whereas PHP 5.3 (only tried .5 and .6) does not. Error message: Warning: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:140773F2:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert unexpected message Warning: stream_socket_client(): Failed to enable crypto Any ideas why this is happening? Thanks, b. PS: With all the best efforts towards ditching PHP 5.2 this is a real showstopper. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I'm on Windows. Using 5-3-7-dev (my own build with php_openssl statically built rather than as a shared extension). php -d error_reporting=-1 -d display_errors=1 -r echo file_get_contents('https://mail.google.com/mail'); and I get the correct content and no errors. Can you try the above command? Richard. -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SSL issues
This works, but SSL-enabled socket connection does not. Will craft a short script ASAP. b. On 22 March 2011 11:37, Richard Quadling rquadl...@gmail.com wrote: On 22 March 2011 01:21, Bostjan Skufca bost...@a2o.si wrote: Hi all, is anyone else experiencing SSL connectivity issues with PHP 5.3(.5|6)? PHP 5.2.17 compiled identically on the same system with the same config file connects to remote SSL-enabled host just fine, whereas PHP 5.3 (only tried .5 and .6) does not. Error message: Warning: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:140773F2:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert unexpected message Warning: stream_socket_client(): Failed to enable crypto Any ideas why this is happening? Thanks, b. PS: With all the best efforts towards ditching PHP 5.2 this is a real showstopper. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I'm on Windows. Using 5-3-7-dev (my own build with php_openssl statically built rather than as a shared extension). php -d error_reporting=-1 -d display_errors=1 -r echo file_get_contents('https://mail.google.com/mail'); and I get the correct content and no errors. Can you try the above command? Richard. -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SSL issues
I just remembered, I had unrelated issue yesterday with php 5.3.6. It is used as standalone socket server with SSL connections and it suddenly stopped working, server was receiving gibberish instead of XML requests. I nailed it down to stream_set_blocking() which was set to false for various daemon-related purposes. And when it was changed to true the functionality was restored. b. On 22 March 2011 13:14, Bostjan Skufca bost...@a2o.si wrote: Will be more verbose ASAP, openssl is 0.9.8r... Just checked, connection to mail.google.com works, seems this is an issue specific to one server. b. On 22 March 2011 12:53, ja...@nixsecurity.org wrote: We've been using PHP 5.3.(5|6) since their released without any SSL issues. We build PHP with OpenSSL (+FIPS), considering our product is in the real world, we've had no complaints about connectivity issues via SSL. I compile PHP with OpenSSL and the FIPS module frequently and haven't seen any of these errors. When exactly are these errors occurring? What version of OpenSSL are you compiling against? Any additional information would be helpful. Original Message From: Bostjan Skufca bost...@a2o.si To: php-general php-general@lists.php.net Sent: Mon, Mar 21, 2011, 9:22 PM Subject: [PHP] SSL issues Hi all, is anyone else experiencing SSL connectivity issues with PHP 5.3(.5|6)? PHP 5.2.17 compiled identically on the same system with the same config file connects to remote SSL-enabled host just fine, whereas PHP 5.3 (only tried .5 and .6) does not. Error message: Warning: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:140773F2:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert unexpected message Warning: stream_socket_client(): Failed to enable crypto Any ideas why this is happening? Thanks, b. PS: With all the best efforts towards ditching PHP 5.2 this is a real showstopper. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] echo?
Kinda new to this, but I've been puttering/writing for about 3 weeks now and have some good working screens up. Ran into something new while I was debuggina script today. Tried to echo the $i value within a for loop as part of the list of items I was building Something like for ($i=0;$i$rows;$i++) echo $i.' '.$row['itemname']; I expected to see : 1 item1 2 item2 ... ... but instead I got 1 item1 f item2 Yes - an 'f' and not a 2. Tried it some more with this: for ($i=1;$i10;$i++) echo $i. item.'br'; and got c item d item e item f item g item and so on. It seems that I can only output the value of $i if I output a string in front of it echo ' '.$i; works fine but echo $i; does not. Any ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] echo?
On Tue, Mar 22, 2011 at 18:22, Jim Giner jim.gi...@albanyhandball.com wrote: [snip!] for ($i=0;$i$rows;$i++) echo $i.' '.$row['itemname']; I expected to see : 1 item1 2 item2 ... ... but instead I got 1 item1 f item2 Yes - an 'f' and not a 2. Tried it some more with this: for ($i=1;$i10;$i++) echo $i. item.'br'; and got c item d item e item f item g item and so on. That sounds very odd. Can you show us the actual surrounding code, Jim? -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] echo?
On 11-03-22 06:22 PM, Jim Giner wrote: Kinda new to this, but I've been puttering/writing for about 3 weeks now and have some good working screens up. Ran into something new while I was debuggina script today. Tried to echo the $i value within a for loop as part of the list of items I was building Something like for ($i=0;$i$rows;$i++) echo $i.' '.$row['itemname']; I expected to see : 1 item1 2 item2 ... ... but instead I got 1 item1 f item2 Yes - an 'f' and not a 2. Tried it some more with this: for ($i=1;$i10;$i++) echo $i. item.'br'; and got c item d item e item f item g item and so on. It seems that I can only output the value of $i if I output a string in front of it echo ' '.$i; works fine but echo $i; does not. Any ideas? I'd like to see the actual code... since $row['itemname'] wouldn't change between iterations either. 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] echo?
Are you sure? $ php -a php for ($i = 0; $i 10; $i++) { echo $i . ' '; } 0 1 2 3 4 5 6 7 8 9 David
[PHP] Re: echo?
On 3/22/2011 6:22 PM, Jim Giner wrote: Kinda new to this, but I've been puttering/writing for about 3 weeks now and have some good working screens up. Ran into something new while I was debuggina script today. Tried to echo the $i value within a for loop as part of the list of items I was building Something like for ($i=0;$i$rows;$i++) echo $i.' '.$row['itemname']; I expected to see : 1 item1 2 item2 ... ... but instead I got 1 item1 f item2 Yes - an 'f' and not a 2. Tried it some more with this: for ($i=1;$i10;$i++) echo $i. item.'br'; and got c item d item e item f item g item and so on. It seems that I can only output the value of $i if I output a string in front of it echo ' '.$i; works fine but echo $i; does not. Any ideas? If off your subject a bit; but, I suggest using $i=0; foreach($row as $value) { echo $i $valuebr /\n; $i++; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: echo?
ok - here's the code in question. $q = 'select * from director_records '; $qrslt = mysql_query($q); $rows = mysql_num_rows($qrslt); for ($i=0; $i$rows; $i++) { $j = $i+1; $row = mysql_fetch_array($qrslt); echo $j.'-'.$row['userid']; if ($row['user_priv'] ) echo ' ('.$row['user_priv'].')#13#10'; else echo '#13#10'; } The output I get is: 1-smith5 f-ginerjm (M) g-smith8 While the alpha parts are valid, the index is only correct for the first one (0) obviously. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: echo?
On Mar 22, 2011, at 8:42 PM, Jim Giner wrote: ok - here's the code in question. $q = 'select * from director_records '; $qrslt = mysql_query($q); $rows = mysql_num_rows($qrslt); for ($i=0; $i$rows; $i++) { $j = $i+1; Am i reading this correctly: the first variable is j (jay) the second variable is i (eye) ? This alone doesn't explain anything... $row = mysql_fetch_array($qrslt); echo $j.'-'.$row['userid']; Since this is the only place $j is used, try subbing in $i+1 and see what you get. if ($row['user_priv'] ) echo ' ('.$row['user_priv'].')#13#10'; This is really rather a strange way of getting a line break. else echo '#13#10'; } The output I get is: 1-smith5 f-ginerjm (M) g-smith8 While the alpha parts are valid, the index is only correct for the first one (0) obviously. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: echo?
Yes - it is J and I. I tried using $i+1 in the echo originally but it wouldn't run. That's why I created $j. And just what is wrong with the old cr/lf sequence? How would you have done it? What do you mean 'this alone .'? Tamara Temple tamouse.li...@gmail.com wrote in message news:521bdb9d-adbf-45d7-b759-acd315b19...@gmail.com... On Mar 22, 2011, at 8:42 PM, Jim Giner wrote: ok - here's the code in question. $q = 'select * from director_records '; $qrslt = mysql_query($q); $rows = mysql_num_rows($qrslt); for ($i=0; $i$rows; $i++) { $j = $i+1; Am i reading this correctly: the first variable is j (jay) the second variable is i (eye) ? This alone doesn't explain anything... $row = mysql_fetch_array($qrslt); echo $j.'-'.$row['userid']; Since this is the only place $j is used, try subbing in $i+1 and see what you get. if ($row['user_priv'] ) echo ' ('.$row['user_priv'].')#13#10'; This is really rather a strange way of getting a line break. else echo '#13#10'; } The output I get is: 1-smith5 f-ginerjm (M) g-smith8 While the alpha parts are valid, the index is only correct for the first one (0) obviously. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: echo?
On Tue, Mar 22, 2011 at 10:50:54PM -0400, Jim Giner wrote: Yes - it is J and I. I tried using $i+1 in the echo originally but it wouldn't run. That's why I created $j. Yes, the substitution creates a syntax error unless surrounded by parentheses or the like. And just what is wrong with the old cr/lf sequence? How would you have done it? You're using HTML-encoded entities for 0x0d and 0x0a. You can simply use 0x0d and 0x0a instead. If you're running this in a web context, you should use br/ instead of CRLF. At the command line, I'm not familiar with running PHP on Windows. In *nix environments, it's enough to use \n, just as they do in C. It might even work in Windows; I don't know. If not, you should be able to use \r\n. You can also try the constant PHP_EOL, which is supposed to handle newlines in a cross-platform way. Paul -- Paul M. Foster http://noferblatz.com http://quillandmouse.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php