Re: [PHP] refernces, arrays, and why does it take up so much memory?

2013-09-03 Thread Stuart Dallas
On 3 Sep 2013, at 02:30, Daevid Vincent dae...@daevid.com wrote:

 I'm confused on how a reference works I think.
 
 I have a DB result set in an array I'm looping over. All I simply want to do
 is make the array key the id of the result set row.
 
 This is the basic gist of it:
 
   private function _normalize_result_set()
   {
  foreach($this-tmp_results as $k = $v)
  {
 $id = $v['id'];
 $new_tmp_results[$id] = $v; //2013-08-29 [dv] using a
 reference here cuts the memory usage in half!

You are assigning a reference to $v. In the next iteration of the loop, $v will 
be pointing at the next item in the array, as will the reference you're storing 
here. With this code I'd expect $new_tmp_results to be an array where the keys 
(i.e. the IDs) are correct, but the data in each item matches the data in the 
last item from the original array, which appears to be what you describe.

 unset($this-tmp_results[$k]);

Doing this for every loop is likely very inefficient. I don't know how the 
inner workings of PHP process something like this, but I wouldn't be surprised 
if it's allocating a new chunk of memory for a version of the array without 
this element. You may find it better to not unset anything until the loop has 
finished, at which point you can just unset($this-tmp_results).

 
 /*
 if ($i++ % 1000 == 0)
 {
   gc_enable(); // Enable Garbage Collector
   var_dump(gc_enabled()); // true
   var_dump(gc_collect_cycles()); // # of elements
 cleaned up
   gc_disable(); // Disable Garbage Collector
 }
 */
  }
  $this-tmp_results = $new_tmp_results;
  //var_dump($this-tmp_results); exit;
  unset($new_tmp_results);
   }


Try this:

private function _normalize_result_set()
{
  // Initialise the temporary variable.
  $new_tmp_results = array();

  // Loop around just the keys in the array.
  foreach (array_keys($this-tmp_results) as $k)
  {
// Store the item in the temporary array with the ID as the key.
// Note no pointless variable for the ID, and no use of !
$new_tmp_results[$this-tmp_results[$k]['id']] = $this-tmp_results[$k];
  }

  // Assign the temporary variable to the original variable.
  $this-tmp_results = $new_tmp_results;
}

I'd appreciate it if you could plug this in and see what your memory usage 
reports say. In most cases, trying to control the garbage collection through 
the use of references is the worst way to go about optimising your code. In my 
code above I'm relying on PHPs copy-on-write feature where data is only 
duplicated when assigned if it changes. No unsets, just using scope to mark a 
variable as able to be cleaned up.

Where is this result set coming from? You'd save yourself a lot of memory/time 
by putting the data in to this format when you read it from the source. For 
example, if reading it from MySQL, $this-tmp_results[$row['id']] = $row when 
looping around the result set.

Also, is there any reason why you need to process this full set of data in one 
go? Can you not break it up in to smaller pieces that won't put as much strain 
on resources?

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

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



RE: [PHP] refernces, arrays, and why does it take up so much memory? [SOLVED]

2013-09-03 Thread Daevid Vincent
EUREKA!

 -Original Message-
 From: Stuart Dallas [mailto:stu...@3ft9.com]
 Sent: Tuesday, September 03, 2013 6:31 AM
 To: Daevid Vincent
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] refernces, arrays, and why does it take up so much
 memory?
 
 On 3 Sep 2013, at 02:30, Daevid Vincent dae...@daevid.com wrote:
 
  I'm confused on how a reference works I think.
 
  I have a DB result set in an array I'm looping over. All I simply want
to
 do
  is make the array key the id of the result set row.
 
  This is the basic gist of it:
 
private function _normalize_result_set()
{
   foreach($this-tmp_results as $k = $v)
   {
  $id = $v['id'];
  $new_tmp_results[$id] = $v; //2013-08-29 [dv] using
a
  reference here cuts the memory usage in half!
 
 You are assigning a reference to $v. In the next iteration of the loop, $v
 will be pointing at the next item in the array, as will the reference
you're
 storing here. With this code I'd expect $new_tmp_results to be an array
 where the keys (i.e. the IDs) are correct, but the data in each item
matches
 the data in the last item from the original array, which appears to be
what
 you describe.
 
  unset($this-tmp_results[$k]);
 
 Doing this for every loop is likely very inefficient. I don't know how the
 inner workings of PHP process something like this, but I wouldn't be
 surprised if it's allocating a new chunk of memory for a version of the
 array without this element. You may find it better to not unset anything
 until the loop has finished, at which point you can just unset($this-
 tmp_results).
 
 
  /*
  if ($i++ % 1000 == 0)
  {
gc_enable(); // Enable Garbage Collector
var_dump(gc_enabled()); // true
var_dump(gc_collect_cycles()); // # of
elements
  cleaned up
gc_disable(); // Disable Garbage Collector
  }
  */
   }
   $this-tmp_results = $new_tmp_results;
   //var_dump($this-tmp_results); exit;
   unset($new_tmp_results);
}
 
 
 Try this:
 
 private function _normalize_result_set()
 {
   // Initialise the temporary variable.
   $new_tmp_results = array();
 
   // Loop around just the keys in the array.
   foreach (array_keys($this-tmp_results) as $k)
   {
 // Store the item in the temporary array with the ID as the key.
 // Note no pointless variable for the ID, and no use of !
 $new_tmp_results[$this-tmp_results[$k]['id']] =
$this-tmp_results[$k];
   }
 
   // Assign the temporary variable to the original variable.
   $this-tmp_results = $new_tmp_results;
 }
 
 I'd appreciate it if you could plug this in and see what your memory usage
 reports say. In most cases, trying to control the garbage collection
through
 the use of references is the worst way to go about optimising your code.
In
 my code above I'm relying on PHPs copy-on-write feature where data is only
 duplicated when assigned if it changes. No unsets, just using scope to
mark
 a variable as able to be cleaned up.
 
 Where is this result set coming from? You'd save yourself a lot of
 memory/time by putting the data in to this format when you read it from
the
 source. For example, if reading it from MySQL, $this-
 tmp_results[$row['id']] = $row when looping around the result set.
 
 Also, is there any reason why you need to process this full set of data in
 one go? Can you not break it up in to smaller pieces that won't put as
much
 strain on resources?
 
 -Stuart

There were reasons I had the $id -- I only showed the relevant parts of the
code for sake of not overly complicating what I was trying to illustrate.
There is other processing that had to be done too in the loop and that is
also what I illustrated.

Here is your version effectively:

private function _normalize_result_set() //Stuart
{
  if (!$this-tmp_results || count($this-tmp_results)  1)
return;

  $new_tmp_results = array();

  // Loop around just the keys in the array.
  $D_start_mem_usage = memory_get_usage();
  foreach (array_keys($this-tmp_results) as $k)
  {
/*
if ($this-tmp_results[$k]['genres'])
{
// rip through each scene's `genres` and
store them as an array since we'll need'em later too
$g = explode('|',
$this-tmp_results[$k]['genres']);
array_pop($g); // there is an extra ''
element due to the final | character. :-\
$this-tmp_results[$k]['g'] = $g;
}
*/

// Store

Re: [PHP] refernces, arrays, and why does it take up so much memory? [SOLVED]

2013-09-03 Thread Stuart Dallas
On 3 Sep 2013, at 21:47, Daevid Vincent dae...@daevid.com wrote:

 There were reasons I had the $id -- I only showed the relevant parts of the
 code for sake of not overly complicating what I was trying to illustrate.
 There is other processing that had to be done too in the loop and that is
 also what I illustrated.
 
 Here is your version effectively:
 
   private function _normalize_result_set() //Stuart
   {
 if (!$this-tmp_results || count($this-tmp_results)  1)
 return;
 
 $new_tmp_results = array();
 
 // Loop around just the keys in the array.
 $D_start_mem_usage = memory_get_usage();
 foreach (array_keys($this-tmp_results) as $k)
 {

You could save another, relatively small, chunk of memory by crafting your loop 
with the rewind, key, current and next methods (look them up to see what they 
do). Using those you won't need to make a copy of the array keys as done in the 
above line. When you've got the amount of data you're dealing with it may be 
worth investing that time.

   /*
   if ($this-tmp_results[$k]['genres'])
   {
   // rip through each scene's `genres` and
 store them as an array since we'll need'em later too
   $g = explode('|',
 $this-tmp_results[$k]['genres']);
   array_pop($g); // there is an extra ''
 element due to the final | character. :-\

Then remove that from the string before you explode. Munging arrays is 
expensive, both computationally and in terms of memory usage.

   $this-tmp_results[$k]['g'] = $g;

Get rid of the temporary variable again - there's no need for it.

$this-tmp_results[$k]['g'] = explode('|', 
trim($this-tmp_results[$k]['genres'], '|'));

If this is going in to a class, and you have control over how it's accessed, 
you have the ability to do this when the value is accessed. This means you 
won't need to 

   }
   */
 
   // Store the item in the temporary array with the ID
 as the key.
   // Note no pointless variable for the ID, and no use of
 !
   $new_tmp_results[$this-tmp_results[$k]['id']] =
 $this-tmp_results[$k];
 }
 
 // Assign the temporary variable to the original variable.
 $this-tmp_results = $new_tmp_results;
 echo \nMEMORY USED FOR STUART's version:
 .number_format(memory_get_usage() - $D_start_mem_usage). PEAK:
 (.number_format(memory_get_peak_usage(true)).)br\n;
 var_dump($this-tmp_results);
 exit();
   }
 
 MEMORY USED FOR STUART's version: -128 PEAK: (90,439,680)
 
 With the processing in the genres block
 MEMORY USED FOR STUART's version: 97,264,368 PEAK: (187,695,104)
 
 So a slight improvement from the original of -28,573,696
 MEMORY USED FOR _normalize_result_set(): 97,264,912 PEAK: (216,268,800)

Awesome.

 No matter what I tried however it seems that frustratingly just the simple
 act of adding a new hash to the array is causing a significant memory jump.
 That really blows! Therefore my solution was to not store the $g as ['g'] --
 which would seem to be the more efficient way of doing this once and re-use
 the array over and over, but instead I am forced to inline rip through and
 explode() in three different places of my code. 

Consider what you're asking PHP to do. You're taking an element in the middle 
of an array structure in memory and asking PHP to make it bigger. What's PHP 
going to do? It's going to copy the entire array to a new location in memory 
with an additional amount reserved for what you're adding. Note that this is 
just a guess - it's entirely possible that PHP manages it's memory better than 
that, but I wouldn't count on it.

 We get over 30,000 hits per second, and even with lots of caching, 216MB vs
 70-96MB is significant and the speed hit is only about 1.5 seconds more per
 page.
 
 Here are three distinctly different example pages that exercise different
 parts of the code path:
 
 PAGE RENDERED IN 7.0466279983521 SECONDS
 MEMORY USED @START: 262,144 - @END: 26,738,688 = 26,476,544 BYTES
 MEMORY PEAK USAGE: 69,730,304 BYTES
 
 PAGE RENDERED IN 6.9327299594879 SECONDS
 MEMORY USED @START: 262,144 - @END: 53,739,520 = 53,477,376 BYTES
 MEMORY PEAK USAGE: 79,167,488 BYTES
 
 PAGE RENDERED IN 7.55816092 SECONDS
 MEMORY USED @START: 262,144 - @END: 50,855,936 = 50,593,792 BYTES
 MEMORY PEAK USAGE: 96,206,848 BYTES

Knowing nothing about your application I'm obviously not in a strong position 
to comment, but seven seconds to generate a page would be unacceptable to me 
and any of my clients. I'll put money on it being possible to cut that time by 
changing your caching strategy. The memory usage is also ridiculous - does a 
single page really

RE: [PHP] refernces, arrays, and why does it take up so much memory? [SOLVED]

2013-09-03 Thread Daevid Vincent


 -Original Message-
 From: Stuart Dallas [mailto:stu...@3ft9.com]
 Sent: Tuesday, September 03, 2013 2:37 PM
 To: Daevid Vincent
 Cc: php-general@lists.php.net; 'Jim Giner'
 Subject: Re: [PHP] refernces, arrays, and why does it take up so much
 memory? [SOLVED]
 
 On 3 Sep 2013, at 21:47, Daevid Vincent dae...@daevid.com wrote:
 
  There were reasons I had the $id -- I only showed the relevant parts of
 the
  code for sake of not overly complicating what I was trying to
illustrate.
  There is other processing that had to be done too in the loop and that
is
  also what I illustrated.
 
  Here is your version effectively:
 
  private function _normalize_result_set() //Stuart
  {
if (!$this-tmp_results || count($this-tmp_results)  1)
  return;
 
$new_tmp_results = array();
 
// Loop around just the keys in the array.
$D_start_mem_usage = memory_get_usage();
foreach (array_keys($this-tmp_results) as $k)
{
 
 You could save another, relatively small, chunk of memory by crafting your
 loop with the rewind, key, current and next methods (look them up to see
 what they do). Using those you won't need to make a copy of the array keys
 as done in the above line. When you've got the amount of data you're
dealing
 with it may be worth investing that time.
 
  /*
  if ($this-tmp_results[$k]['genres'])
  {
  // rip through each scene's `genres` and
  store them as an array since we'll need'em later too
  $g = explode('|',
  $this-tmp_results[$k]['genres']);
  array_pop($g); // there is an extra ''
  element due to the final | character. :-\
 
 Then remove that from the string before you explode.

 Munging arrays is
 expensive, both computationally and in terms of memory usage.
 
  $this-tmp_results[$k]['g'] = $g;
 
 Get rid of the temporary variable again - there's no need for it.

 $this-tmp_results[$k]['g'] = explode('|', trim($this-
 tmp_results[$k]['genres'], '|'));

Maybe an option. I'll look into trim() the last | off the tmp_results in a
loop at the top. Not sure if changing the variable will have the same effect
as adding one does. Interesting to see...

 If this is going in to a class, and you have control over how it's
accessed,
 you have the ability to do this when the value is accessed. This means you
 won't need to
 
  }
  */
 
  // Store the item in the temporary array with the ID
  as the key.
  // Note no pointless variable for the ID, and no use of
  !
  $new_tmp_results[$this-tmp_results[$k]['id']] =
  $this-tmp_results[$k];
}
 
// Assign the temporary variable to the original variable.
$this-tmp_results = $new_tmp_results;
echo \nMEMORY USED FOR STUART's version:
  .number_format(memory_get_usage() - $D_start_mem_usage). PEAK:
  (.number_format(memory_get_peak_usage(true)).)br\n;
var_dump($this-tmp_results);
exit();
  }
 
  MEMORY USED FOR STUART's version: -128 PEAK: (90,439,680)
 
  With the processing in the genres block
  MEMORY USED FOR STUART's version: 97,264,368 PEAK: (187,695,104)
 
  So a slight improvement from the original of -28,573,696
  MEMORY USED FOR _normalize_result_set(): 97,264,912 PEAK: (216,268,800)
 
 Awesome.
 
  No matter what I tried however it seems that frustratingly just the
simple
  act of adding a new hash to the array is causing a significant memory
 jump.
  That really blows! Therefore my solution was to not store the $g as
['g']
 --
  which would seem to be the more efficient way of doing this once and re-
 use
  the array over and over, but instead I am forced to inline rip through
and
  explode() in three different places of my code.
 
 Consider what you're asking PHP to do. You're taking an element in the
 middle of an array structure in memory and asking PHP to make it bigger.
 What's PHP going to do? It's going to copy the entire array to a new
 location in memory with an additional amount reserved for what you're
 adding. Note that this is just a guess - it's entirely possible that PHP
 manages it's memory better than that, but I wouldn't count on it.
 
  We get over 30,000 hits per second, and even with lots of caching, 216MB
 vs
  70-96MB is significant and the speed hit is only about 1.5 seconds more
 per
  page.
 
  Here are three distinctly different example pages that exercise
different
  parts of the code path:
 
  PAGE RENDERED IN 7.0466279983521 SECONDS
  MEMORY USED @START: 262,144 - @END: 26,738,688 = 26,476,544 BYTES
  MEMORY PEAK USAGE: 69,730,304 BYTES
 
  PAGE RENDERED IN 6.9327299594879 SECONDS
  MEMORY USED @START: 262,144 - @END: 53,739,520 = 53,477,376 BYTES
  MEMORY PEAK

RE: [PHP] refernces, arrays, and why does it take up so much memory? [SOLVED]

2013-09-03 Thread Daevid Vincent
 
 
 -Original Message-
 From: Daevid Vincent [mailto:dae...@daevid.com]
 Sent: Tuesday, September 03, 2013 4:03 PM
 To: php-general@lists.php.net
 Cc: 'Stuart Dallas'
 Subject: RE: [PHP] refernces, arrays, and why does it take up so much
 memory? [SOLVED]
 
  $this-tmp_results[$k]['g'] = explode('|', trim($this-
  tmp_results[$k]['genres'], '|'));
 
 Maybe an option. I'll look into trim() the last | off the tmp_results in
a
 loop at the top. Not sure if changing the variable will have the same
effect
 as adding one does. Interesting to see...
 
Here are the results of that. Interesting changes. Overall it's a slight
improvement, but most significant on the middle one, so still a worthy
keeper. Odd that it wouldn't be improvement across the board though. PHP is
kookie.
 
PAGE RENDERED IN 7.1903319358826 SECONDS
MEMORY USED @START: 262,144 - @END: 27,000,832 = 26,738,688 BYTES
MEMORY PEAK USAGE: 69,992,448 BYTES
 
PAGE RENDERED IN 6.5189208984375 SECONDS
MEMORY USED @START: 262,144 - @END: 42,729,472 = 42,467,328 BYTES
MEMORY PEAK USAGE: 78,905,344 BYTES
 
PAGE RENDERED IN 7.5954079627991 SECONDS
MEMORY USED @START: 262,144 - @END: 50,331,648 = 50,069,504 BYTES
MEMORY PEAK USAGE: 96,206,848 BYTES
 
Old.
 
PAGE RENDERED IN 7.0466279983521 SECONDS
MEMORY USED @START: 262,144 - @END: 26,738,688 = 26,476,544 BYTES
MEMORY PEAK USAGE: 69,730,304 BYTES
 
PAGE RENDERED IN 6.9327299594879 SECONDS
MEMORY USED @START: 262,144 - @END: 53,739,520 = 53,477,376 BYTES
MEMORY PEAK USAGE: 79,167,488 BYTES
 
PAGE RENDERED IN 7.55816092 SECONDS
MEMORY USED @START: 262,144 - @END: 50,855,936 = 50,593,792 BYTES
MEMORY PEAK USAGE: 96,206,848 BYTES
 


Re: [PHP] Re: PHP-5.5.2 +opcache segfaults with Piwik

2013-09-03 Thread Daniel
Just so that you know, I've posted in the forum topic as well:
http://forum.piwik.org/read.php?2,105879
Regards,
Daniel Fenn






On Tue, Sep 3, 2013 at 12:42 AM, Lester Caine les...@lsces.co.uk wrote:
 Jan Ehrhardt wrote:

 Could you try to add a function_exists check to
 libs/upgradephp/upgrade.php?
 
 This at the function declaration of _json_encode:
 if (!function_exists('_json_encode')) { function _json_encode($var, ...
 
 And a extra } at the end.

 This patch, together with upgrading to the latest OPcache from github
 solved my segfaults and fatal errors.


 Jan  - could you post the solution on http://dev.piwik.org/trac/ticket/4093
 - better that you get the credit than one of us pinch it ;)


 --
 Lester Caine - G8HFL
 -
 Contact - http://lsces.co.uk/wiki/?page=contact
 L.S.Caine Electronic Services - http://lsces.co.uk
 EnquirySolve - http://enquirysolve.com/
 Model Engineers Digital Workshop - http://medw.co.uk
 Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

 --
 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-general Digest 2 Sep 2013 08:57:25 -0000 Issue 8352

2013-09-02 Thread php-general-digest-help

php-general Digest 2 Sep 2013 08:57:25 - Issue 8352

Topics (messages 322017 through 322020):

Re: PHP-5.5.2 +opcache segfaults with Piwik
322017 by: Lester Caine
322018 by: Jan Ehrhardt
322019 by: Jan Ehrhardt
322020 by: Jan Ehrhardt

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---

Grant wrote:

I've tried php-5.5.2 and 5.5.3 but both segfault with piwik unless the
opcache is disabled.  Someone filed a piwik bug but was told it's a
php bug:

http://dev.piwik.org/trac/ticket/4093



Is this a known issue?


I'm running my own port of piwik in production with eaccelerator on 5.4 but I've 
made the decision not to move any of the machines to 5.5 until all of the legacy 
5.2 machines have been brought up to 5.4. Not an answer, but explains perhaps 
why the problem is not being seen by others.


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
---End Message---
---BeginMessage---
Lester Caine in php.general (Sun, 01 Sep 2013 12:59:18 +0100):
Grant wrote:
 I've tried php-5.5.2 and 5.5.3 but both segfault with piwik unless the
 opcache is disabled.  Someone filed a piwik bug but was told it's a
 php bug:
 
 http://dev.piwik.org/trac/ticket/4093

 Is this a known issue?

 (...) Not an answer, but explains perhaps  why the problem is not being
seen by others.

It is more likely that users do not notice it. I have Piwik running with
PHP 5.3 and php_opcache.dll (Centos 5) and it segfaults:

[Sun Sep 01 17:06:53.131410 2013] [core:notice] [pid 25411] AH00052:
child pid 25451 exit signal Segmentation fault (11)
[Sun Sep 01 17:08:18.561917 2013] [core:notice] [pid 25411] AH00052:
child pid 25453 exit signal Segmentation fault (11)
[Sun Sep 01 17:08:19.569714 2013] [core:notice] [pid 25411] AH00052:
child pid 25450 exit signal Segmentation fault (11)

However, nothing special is displaying on the page. You have to grep
your Apache error_log to know that it happens. How did you notice?

Jan
---End Message---
---BeginMessage---
Grant in php.general (Sun, 1 Sep 2013 02:13:54 -0700):
 I've tried php-5.5.2 and 5.5.3 but both segfault with piwik unless the
 opcache is disabled.  Someone filed a piwik bug but was told it's a
 php bug:

 http://dev.piwik.org/trac/ticket/4093

Is this a known issue?

I changed the PHP on my (dev) Centos5 server to PHP 5.5.3, pulled the
latest OPcache from Github and tried to get a segfault. That was clearly
visible when I tried to access the Goals tab in the dashboard of one of
my websites. The page never got further than 'Loading data...' and my
Apache log showed a segfault.

So, if it was no known issue it is confirmed now.

Jan
---End Message---
---BeginMessage---
Grant in php.general (Sun, 25 Aug 2013 02:31:29 -0700):
I've tried php-5.5.2 and 5.5.3 but both segfault with piwik unless the
opcache is disabled.  Someone filed a piwik bug but was told it's a
php bug:

http://dev.piwik.org/trac/ticket/4093

Could you try to add a function_exists check to
libs/upgradephp/upgrade.php?

This at the function declaration of _json_encode:
if (!function_exists('_json_encode')) { function _json_encode($var, ...

And a extra } at the end.

This seemed to correct this fatal error on my side:

[02-Sep-2013 10:35:40 Europe/Paris] PHP Fatal error:  Cannot redeclare
_json_encode() (previously declared in
/usr/local/lib/php/share/piwik/libs/upgradephp/upgrade.php:109) in
/usr/local/lib/php/share/piwik/libs/upgradephp/upgrade.php on line 109

I do not know what opcache has to do with it, although I suspect that
Piwik is calling itself a lot of times and that opcache is trailing
behind (or something like that).

Jan
---End Message---


php-general Digest 3 Sep 2013 01:31:03 -0000 Issue 8353

2013-09-02 Thread php-general-digest-help

php-general Digest 3 Sep 2013 01:31:03 - Issue 8353

Topics (messages 322021 through 322023):

Re: PHP-5.5.2 +opcache segfaults with Piwik
322021 by: Jan Ehrhardt
322022 by: Lester Caine

refernces, arrays, and why does it take up so much memory?
322023 by: Daevid Vincent

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---
Jan Ehrhardt in php.general (Mon, 02 Sep 2013 10:57:14 +0200):
Could you try to add a function_exists check to
libs/upgradephp/upgrade.php?

This at the function declaration of _json_encode:
if (!function_exists('_json_encode')) { function _json_encode($var, ...

And a extra } at the end.

This patch, together with upgrading to the latest OPcache from github
solved my segfaults and fatal errors.

Jan
---End Message---
---BeginMessage---

Jan Ehrhardt wrote:

Could you try to add a function_exists check to
libs/upgradephp/upgrade.php?

This at the function declaration of _json_encode:
if (!function_exists('_json_encode')) { function _json_encode($var, ...

And a extra } at the end.

This patch, together with upgrading to the latest OPcache from github
solved my segfaults and fatal errors.


Jan  - could you post the solution on http://dev.piwik.org/trac/ticket/4093 - 
better that you get the credit than one of us pinch it ;)


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
---End Message---
---BeginMessage---
I'm confused on how a reference works I think.
 
I have a DB result set in an array I'm looping over. All I simply want to do
is make the array key the id of the result set row.
 
This is the basic gist of it:
 
   private function _normalize_result_set()
   {
  foreach($this-tmp_results as $k = $v)
  {
 $id = $v['id'];
 $new_tmp_results[$id] = $v; //2013-08-29 [dv] using a
reference here cuts the memory usage in half!
 unset($this-tmp_results[$k]);
 
 /*
 if ($i++ % 1000 == 0)
 {
   gc_enable(); // Enable Garbage Collector
   var_dump(gc_enabled()); // true
   var_dump(gc_collect_cycles()); // # of elements
cleaned up
   gc_disable(); // Disable Garbage Collector
 }
 */
  }
  $this-tmp_results = $new_tmp_results;
  //var_dump($this-tmp_results); exit;
  unset($new_tmp_results);
   }
 
Without using the = reference, my data works great:
$new_tmp_results[$id] = $v;
 
array (size=79552)
  6904 = 
array (size=4)
  'id' = string '6904' (length=4)
  'studio_id' = string '5' (length=1)
  'genres' = string '34|' (length=3)
  6905 = 
array (size=4)
  'id' = string '6905' (length=4)
  'studio_id' = string '5' (length=1)
  'genres' = string '6|37|' (length=5)
 
However it takes a stupid amount of memory for some unknown reason.
MEMORY USED @START: 262,144 - @END: 42,729,472 = 42,467,328 BYTES
MEMORY PEAK USAGE: 216,530,944 BYTES
 
When using the reference the memory drastically goes down to what I'd EXPECT
it to be (and actually the problem I'm trying to solve).
MEMORY USED @START: 262,144 - @END: 6,029,312 = 5,767,168 BYTES
MEMORY PEAK USAGE: 82,051,072 BYTES
 
However my array is all kinds of wrong:
 
array (size=79552)
  6904 = 
array (size=4)
  'id' = string '86260' (length=5)
  'studio_id' = string '210' (length=3)
  'genres' = string '8|9|10|29|58|' (length=13)
  6905 = 
array (size=4)
  'id' = string '86260' (length=5)
  'studio_id' = string '210' (length=3)
  'genres' = string '8|9|10|29|58|' (length=13)
 
Notice that they're all the same values, although the keys seem right. I
don't understand why that happens because 
foreach($this-tmp_results as $k = $v)
Should be changing $v each iteration I'd think.
 
Honestly, I am baffled as to why those unsets() make no difference. All I
can think is that the garbage collector doesn't run. But then I had also
tried to force gc() and that still made no difference. *sigh*
 
I had some other cockamamie idea where I'd use the same tmp_results array in
a tricky way to avoid a  second array. The concept being I'd add 1 million
to the ['id'] (which we want as the new array key), then unset the existing
sequential key, then when all done, loop through and shift all the keys by 1

[PHP] Re: PHP-5.5.2 +opcache segfaults with Piwik

2013-09-02 Thread Jan Ehrhardt
Grant in php.general (Sun, 25 Aug 2013 02:31:29 -0700):
I've tried php-5.5.2 and 5.5.3 but both segfault with piwik unless the
opcache is disabled.  Someone filed a piwik bug but was told it's a
php bug:

http://dev.piwik.org/trac/ticket/4093

Could you try to add a function_exists check to
libs/upgradephp/upgrade.php?

This at the function declaration of _json_encode:
if (!function_exists('_json_encode')) { function _json_encode($var, ...

And a extra } at the end.

This seemed to correct this fatal error on my side:

[02-Sep-2013 10:35:40 Europe/Paris] PHP Fatal error:  Cannot redeclare
_json_encode() (previously declared in
/usr/local/lib/php/share/piwik/libs/upgradephp/upgrade.php:109) in
/usr/local/lib/php/share/piwik/libs/upgradephp/upgrade.php on line 109

I do not know what opcache has to do with it, although I suspect that
Piwik is calling itself a lot of times and that opcache is trailing
behind (or something like that).

Jan

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



[PHP] Re: PHP-5.5.2 +opcache segfaults with Piwik

2013-09-02 Thread Jan Ehrhardt
Jan Ehrhardt in php.general (Mon, 02 Sep 2013 10:57:14 +0200):
Could you try to add a function_exists check to
libs/upgradephp/upgrade.php?

This at the function declaration of _json_encode:
if (!function_exists('_json_encode')) { function _json_encode($var, ...

And a extra } at the end.

This patch, together with upgrading to the latest OPcache from github
solved my segfaults and fatal errors.

Jan

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



Re: [PHP] Re: PHP-5.5.2 +opcache segfaults with Piwik

2013-09-02 Thread Lester Caine

Jan Ehrhardt wrote:

Could you try to add a function_exists check to
libs/upgradephp/upgrade.php?

This at the function declaration of _json_encode:
if (!function_exists('_json_encode')) { function _json_encode($var, ...

And a extra } at the end.

This patch, together with upgrading to the latest OPcache from github
solved my segfaults and fatal errors.


Jan  - could you post the solution on http://dev.piwik.org/trac/ticket/4093 - 
better that you get the credit than one of us pinch it ;)


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

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



[PHP] refernces, arrays, and why does it take up so much memory?

2013-09-02 Thread Daevid Vincent
: 8,050,456 PEAK: (78,118,912)
MEMORY USED FOR array_combine: 8,050,376 PEAK: (86,507,520)
 
Just as a wild guess, I also added 'g' to my SQL so that PHP would already
have a placeholder variable there in tmp_results, but that made no
difference. And still used up nearly double the memory as above.
SELECT DISTINCT `id`, sag.`genres`, 'g' FROM.
 


[PHP] Re: refernces, arrays, and why does it take up so much memory?

2013-09-02 Thread Jim Giner
 the
$this-tmp_results[$k]['g'] = $g;

Results in
MEMORY USED BEFORE array_combine: 8,050,456 PEAK: (78,118,912)
MEMORY USED FOR array_combine: 8,050,376 PEAK: (86,507,520)

Just as a wild guess, I also added 'g' to my SQL so that PHP would already
have a placeholder variable there in tmp_results, but that made no
difference. And still used up nearly double the memory as above.
SELECT DISTINCT `id`, sag.`genres`, 'g' FROM.


Are you sure that the data is what you expect?  I've never used an 
object to hold the results of a query, but I'm picturing that your 
foreach may not be working at all unless an object as a result is 
totally different than the type of query results I always process.


You're taking each object of the query results and assigning the key and 
value to vars.  But aren't query results 'keyless'?  So what are you 
actually assigning to $k and $v?


If I'm wrong and using an object is quite different, forget I said 
anything.  :)


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



RE: [PHP] Re: refernces, arrays, and why does it take up so much memory?

2013-09-02 Thread Daevid Vincent


 -Original Message-
 From: Jim Giner [mailto:jim.gi...@albanyhandball.com]
 Sent: Monday, September 02, 2013 8:14 PM
 To: php-general@lists.php.net
 Subject: [PHP] Re: refernces, arrays, and why does it take up so much
 memory?
 
 On 9/2/2013 9:30 PM, Daevid Vincent wrote:
  I'm confused on how a reference works I think.
 
  I have a DB result set in an array I'm looping over. All I simply want
to
 do
  is make the array key the id of the result set row.
 
  This is the basic gist of it:
 
  private function _normalize_result_set()
  {
 foreach($this-tmp_results as $k = $v)
 {
$id = $v['id'];
$new_tmp_results[$id] = $v; //2013-08-29 [dv]
using
 a
  reference here cuts the memory usage in half!
unset($this-tmp_results[$k]);
 
/*
if ($i++ % 1000 == 0)
{
  gc_enable(); // Enable Garbage Collector
  var_dump(gc_enabled()); // true
  var_dump(gc_collect_cycles()); // # of
 elements
  cleaned up
  gc_disable(); // Disable Garbage Collector
}
*/
 }
 $this-tmp_results = $new_tmp_results;
 //var_dump($this-tmp_results); exit;
 unset($new_tmp_results);
  }
 
  Without using the = reference, my data works great:
  $new_tmp_results[$id] = $v;
 
  array (size=79552)
 6904 =
   array (size=4)
 'id' = string '6904' (length=4)
 'studio_id' = string '5' (length=1)
 'genres' = string '34|' (length=3)
 6905 =
   array (size=4)
 'id' = string '6905' (length=4)
 'studio_id' = string '5' (length=1)
 'genres' = string '6|37|' (length=5)
 
  However it takes a stupid amount of memory for some unknown reason.
  MEMORY USED @START: 262,144 - @END: 42,729,472 = 42,467,328 BYTES
  MEMORY PEAK USAGE: 216,530,944 BYTES
 
  When using the reference the memory drastically goes down to what I'd
 EXPECT
  it to be (and actually the problem I'm trying to solve).
  MEMORY USED @START: 262,144 - @END: 6,029,312 = 5,767,168 BYTES
  MEMORY PEAK USAGE: 82,051,072 BYTES
 
  However my array is all kinds of wrong:
 
  array (size=79552)
 6904 = 
   array (size=4)
 'id' = string '86260' (length=5)
 'studio_id' = string '210' (length=3)
 'genres' = string '8|9|10|29|58|' (length=13)
 6905 = 
   array (size=4)
 'id' = string '86260' (length=5)
 'studio_id' = string '210' (length=3)
 'genres' = string '8|9|10|29|58|' (length=13)
 
  Notice that they're all the same values, although the keys seem right. I
  don't understand why that happens because
  foreach($this-tmp_results as $k = $v)
  Should be changing $v each iteration I'd think.
 
  Honestly, I am baffled as to why those unsets() make no difference. All
I
  can think is that the garbage collector doesn't run. But then I had also
  tried to force gc() and that still made no difference. *sigh*
 
  I had some other cockamamie idea where I'd use the same tmp_results
array
 in
  a tricky way to avoid a  second array. The concept being I'd add 1
million
  to the ['id'] (which we want as the new array key), then unset the
 existing
  sequential key, then when all done, loop through and shift all the keys
by
 1
  million thereby they'd be the right index ID. So add one and unset one
  immediately after. Clever right? 'cept it too made no difference on
 memory.
  Same thing is happening as above where the gc() isn't running or
something
  is holding all that memory until the end. *sigh*
 
  Then I tried a different way using array_combine() and noticed something
  very disturbing.
  http://www.php.net/manual/en/function.array-combine.php
 
 
  private function _normalize_result_set()
  {
 if (!$this-tmp_results || count($this-tmp_results)  1)
  return;
 
 $D_start_mem_usage = memory_get_usage();
 foreach($this-tmp_results as $k = $v)
 {
$id = $v['id'];
$tmp_keys[] = $id;
 
if ($v['genres'])
{
   $g = explode('|', $v['genres']);
  $this-tmp_results[$k]['g'] = $g; //this
 causes a
  massive spike in memory usage
}
 }
 //var_dump($tmp_keys, $this-tmp_results); exit;
 echo \nMEMORY USED BEFORE array_combine:
  .number_format(memory_get_usage() - $D_start_mem_usage). PEAK:
  (.number_format(memory_get_peak_usage(true)).)br\n;
 $this-tmp_results = array_combine($tmp_keys,
  $this-tmp_results);
 echo \nMEMORY USED

php-general Digest 1 Sep 2013 09:14:01 -0000 Issue 8351

2013-09-01 Thread php-general-digest-help

php-general Digest 1 Sep 2013 09:14:01 - Issue 8351

Topics (messages 322016 through 322016):

Re: PHP-5.5.2 +opcache segfaults with Piwik
322016 by: Grant

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---
 I've tried php-5.5.2 and 5.5.3 but both segfault with piwik unless the
 opcache is disabled.  Someone filed a piwik bug but was told it's a
 php bug:

 http://dev.piwik.org/trac/ticket/4093

 - Grant

Is this a known issue?

- Grant
---End Message---


[PHP] Re: PHP-5.5.2 +opcache segfaults with Piwik

2013-09-01 Thread Grant
 I've tried php-5.5.2 and 5.5.3 but both segfault with piwik unless the
 opcache is disabled.  Someone filed a piwik bug but was told it's a
 php bug:

 http://dev.piwik.org/trac/ticket/4093

 - Grant

Is this a known issue?

- Grant

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



Re: [PHP] Re: PHP-5.5.2 +opcache segfaults with Piwik

2013-09-01 Thread Lester Caine

Grant wrote:

I've tried php-5.5.2 and 5.5.3 but both segfault with piwik unless the
opcache is disabled.  Someone filed a piwik bug but was told it's a
php bug:

http://dev.piwik.org/trac/ticket/4093



Is this a known issue?


I'm running my own port of piwik in production with eaccelerator on 5.4 but I've 
made the decision not to move any of the machines to 5.5 until all of the legacy 
5.2 machines have been brought up to 5.4. Not an answer, but explains perhaps 
why the problem is not being seen by others.


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

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



Re: [PHP] Re: PHP-5.5.2 +opcache segfaults with Piwik

2013-09-01 Thread Jan Ehrhardt
Lester Caine in php.general (Sun, 01 Sep 2013 12:59:18 +0100):
Grant wrote:
 I've tried php-5.5.2 and 5.5.3 but both segfault with piwik unless the
 opcache is disabled.  Someone filed a piwik bug but was told it's a
 php bug:
 
 http://dev.piwik.org/trac/ticket/4093

 Is this a known issue?

 (...) Not an answer, but explains perhaps  why the problem is not being
seen by others.

It is more likely that users do not notice it. I have Piwik running with
PHP 5.3 and php_opcache.dll (Centos 5) and it segfaults:

[Sun Sep 01 17:06:53.131410 2013] [core:notice] [pid 25411] AH00052:
child pid 25451 exit signal Segmentation fault (11)
[Sun Sep 01 17:08:18.561917 2013] [core:notice] [pid 25411] AH00052:
child pid 25453 exit signal Segmentation fault (11)
[Sun Sep 01 17:08:19.569714 2013] [core:notice] [pid 25411] AH00052:
child pid 25450 exit signal Segmentation fault (11)

However, nothing special is displaying on the page. You have to grep
your Apache error_log to know that it happens. How did you notice?

Jan

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



[PHP] Re: PHP-5.5.2 +opcache segfaults with Piwik

2013-09-01 Thread Jan Ehrhardt
Grant in php.general (Sun, 1 Sep 2013 02:13:54 -0700):
 I've tried php-5.5.2 and 5.5.3 but both segfault with piwik unless the
 opcache is disabled.  Someone filed a piwik bug but was told it's a
 php bug:

 http://dev.piwik.org/trac/ticket/4093

Is this a known issue?

I changed the PHP on my (dev) Centos5 server to PHP 5.5.3, pulled the
latest OPcache from Github and tried to get a segfault. That was clearly
visible when I tried to access the Goals tab in the dashboard of one of
my websites. The page never got further than 'Loading data...' and my
Apache log showed a segfault.

So, if it was no known issue it is confirmed now.

Jan

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



php-general Digest 30 Aug 2013 21:00:13 -0000 Issue 8350

2013-08-30 Thread php-general-digest-help

php-general Digest 30 Aug 2013 21:00:13 - Issue 8350

Topics (messages 322015 through 322015):

Strange url session behavior after upgrade to 4.3
322015 by: Tobiah

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---

I have a page that needs to get another page on the fly, using
the same session.  I figured out how to stop my session and set
the cookie on the CURL handler, and everything was cool.  The
curled page had my same session available as the calling page.
Life was good.

Now something has changed after upgrading from 5.2.4 to 5.3.10.
My session was no longer available on the curled page.  What's
strange is that the PHPSESSID cookie was still being set, and
hit had the correct value.

Here is the weirdest part.  If I do this:

session_id($_COOKIE['PHPSESSID']);
session_start();

The session is there!  But why isn't php taking
the cookie as the id all by itself?  Regular
pages (not curled) all work as before.  All of
our websites work fine on the new version, except
for this one curl call.  I could update 100's of
websites to fix them with the added lines, but
I'd really rather find out why the curled page
is not taking the session_id from the PHPSESSID
cookie.

Thanks!

Toby
---End Message---


[PHP] Strange url session behavior after upgrade to 4.3

2013-08-30 Thread Tobiah

I have a page that needs to get another page on the fly, using
the same session.  I figured out how to stop my session and set
the cookie on the CURL handler, and everything was cool.  The
curled page had my same session available as the calling page.
Life was good.

Now something has changed after upgrading from 5.2.4 to 5.3.10.
My session was no longer available on the curled page.  What's
strange is that the PHPSESSID cookie was still being set, and
hit had the correct value.

Here is the weirdest part.  If I do this:

session_id($_COOKIE['PHPSESSID']);
session_start();

The session is there!  But why isn't php taking
the cookie as the id all by itself?  Regular
pages (not curled) all work as before.  All of
our websites work fine on the new version, except
for this one curl call.  I could update 100's of
websites to fix them with the added lines, but
I'd really rather find out why the curled page
is not taking the session_id from the PHPSESSID
cookie.

Thanks!

Toby

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



php-general Digest 29 Aug 2013 23:30:10 -0000 Issue 8349

2013-08-29 Thread php-general-digest-help

php-general Digest 29 Aug 2013 23:30:10 - Issue 8349

Topics (messages 322012 through 322014):

Re: Basic Auth
322012 by: Jim Giner
322013 by: Stuart Dallas

IMAP Metadata support
322014 by: list.airstreamcomm.net

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---

Stuart,

Just wanted to follow up with my thanks for your excellent help in 
providing understanding of how to generate the 401 error page and 
getting me thru the process of performing a sign-out from basic auth. 
Without your patience it never would have happened.


Also wanted to tell you that I've scrapped it all.  Keeping the code for 
a rainy day of course, but giving up on using it (as well as the basic 
auth signon process) to use my own 'roll-your-own' code.  Since IE 
insisted on presenting multiple credentials during the signon process it 
was a futile effort to be doing a signoff.  And yes - I've taken the 
proper precautions to hash the incoming password value before submission 
and storing in my db that way.


Thanks again.  It's help like this that makes this group such a great 
resource.
---End Message---
---BeginMessage---
On 27 Aug 2013, at 18:45, Jim Giner jim.gi...@albanyhandball.com wrote:

 From your latest missive I gleaned that I needed to have a script on my server

One last time: YOU DON'T NEED TO CHANGE ANYTHING ON THE SERVER-SIDE!

Ok, I see that you've decided to use another method, which is great; HTTP auth 
is a pretty antiquated way to handle authentication these days. Whatever you're 
using, I wish you all the best with it.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/---End Message---
---BeginMessage---

Does PHP IMAP have any support for Metadata?

Thanks.

---End Message---


[PHP] IMAP Metadata support

2013-08-29 Thread list

Does PHP IMAP have any support for Metadata?

Thanks.


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



php-general Digest 28 Aug 2013 10:15:58 -0000 Issue 8348

2013-08-28 Thread php-general-digest-help

php-general Digest 28 Aug 2013 10:15:58 - Issue 8348

Topics (messages 322011 through 322011):

Re: php seg faults on creation pdf
322011 by: KAs Coenen

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---
Hi, 

Some more info. I ran gdb on the core file (after reinstalling with debug mode):

# /usr/local/gdb/bin/gdb /usr/local/php5/bin/php-cgi 
/opt/apache/htdocs/wachtlijst/core
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type show copying
and show warranty for details.
This GDB was configured as i386-pc-solaris2.10.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/...
Reading symbols from /usr/local/php5/bin/php-cgi...done.
[New LWP 1]
[Thread debugging using libthread_db enabled]
[New Thread 1 (LWP 1)]
Core was generated by `/usr/local/php5/bin/php-cgi 
/opt/apache/htdocs/wachtlijst/test.php'.
Program terminated with signal 11, Segmentation fault.
#0  0x0093baa4 in _object_and_properties_init (arg=error reading 
variable: Cannot access memory at address 0xffd8,
    arg@entry=error reading variable: Cannot access memory at address 0x8, 
class_type=error reading variable: Cannot access memory at address 
0xffd0,
    class_type@entry=error reading variable: Cannot access memory at address 
0x8, properties=error reading variable: Cannot access memory at address 
0xffc8,
    properties@entry=error reading variable: Cannot access memory at address 
0x8) at /export/home/coenenka/php-5.5.1/Zend/zend_API.c:1200
1200    Z_OBJVAL_P(arg) = class_type-create_object(class_type 
TSRMLS_CC);

Does anyone see anything in this? The dir /export/home/coenenka is not the 
install dir (but my home drive) and I have no clue why it is referencing to 
that dir (it is the location of the source). 

Greetings,

Kas



 From: kascoe...@hotmail.com
 To: php-gene...@lists.php.net
 Subject: php seg faults on creation pdf
 Date: Wed, 28 Aug 2013 10:00:29 +0200

 Hi,

 When surfing to a website that generates a pdf the apache server segfaults. 
 This made me run the script (that generates the pdf) with the php cli 
 command. The php also segfaults with the same error:

 # /usr/local/php5/bin/php-cgi test.php
 Segmentation Fault (core dumped)

 Pstack output:

 # pstack core
 core 'core' of 726: /usr/local/php5/bin/php-cgi test.php
  00960af5 _object_and_properties_init () + 111

 I attached the truss output to the mail. I am running this on a solaris 
 server:

 # uname -a
 SunOS zone-eu4 5.10 Generic_142910-17 i86pc i386 i86pc
 # cat /etc/release
 Oracle Solaris 10 9/10 s10x_u9wos_14a X86
  Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
 Assembled 11 August 2010

 pdflib module is 2.1.10. PDFlib lite is version 7.0.5. I tried to compile 
 everything in 64 bit. I suspect the problem is that somewhere a 32bit lib or 
 executable is being used instead of a 64bit.


 Can anyone help me out on this?

 Kind regards,

 Kas ---End Message---


[PHP] RE: php seg faults on creation pdf

2013-08-28 Thread KAs Coenen
Hi, 

Some more info. I ran gdb on the core file (after reinstalling with debug mode):

# /usr/local/gdb/bin/gdb /usr/local/php5/bin/php-cgi 
/opt/apache/htdocs/wachtlijst/core
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type show copying
and show warranty for details.
This GDB was configured as i386-pc-solaris2.10.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/...
Reading symbols from /usr/local/php5/bin/php-cgi...done.
[New LWP 1]
[Thread debugging using libthread_db enabled]
[New Thread 1 (LWP 1)]
Core was generated by `/usr/local/php5/bin/php-cgi 
/opt/apache/htdocs/wachtlijst/test.php'.
Program terminated with signal 11, Segmentation fault.
#0  0x0093baa4 in _object_and_properties_init (arg=error reading 
variable: Cannot access memory at address 0xffd8,
    arg@entry=error reading variable: Cannot access memory at address 0x8, 
class_type=error reading variable: Cannot access memory at address 
0xffd0,
    class_type@entry=error reading variable: Cannot access memory at address 
0x8, properties=error reading variable: Cannot access memory at address 
0xffc8,
    properties@entry=error reading variable: Cannot access memory at address 
0x8) at /export/home/coenenka/php-5.5.1/Zend/zend_API.c:1200
1200    Z_OBJVAL_P(arg) = class_type-create_object(class_type 
TSRMLS_CC);

Does anyone see anything in this? The dir /export/home/coenenka is not the 
install dir (but my home drive) and I have no clue why it is referencing to 
that dir (it is the location of the source). 

Greetings,

Kas



 From: kascoe...@hotmail.com
 To: php-general@lists.php.net
 Subject: php seg faults on creation pdf
 Date: Wed, 28 Aug 2013 10:00:29 +0200

 Hi,

 When surfing to a website that generates a pdf the apache server segfaults. 
 This made me run the script (that generates the pdf) with the php cli 
 command. The php also segfaults with the same error:

 # /usr/local/php5/bin/php-cgi test.php
 Segmentation Fault (core dumped)

 Pstack output:

 # pstack core
 core 'core' of 726: /usr/local/php5/bin/php-cgi test.php
  00960af5 _object_and_properties_init () + 111

 I attached the truss output to the mail. I am running this on a solaris 
 server:

 # uname -a
 SunOS zone-eu4 5.10 Generic_142910-17 i86pc i386 i86pc
 # cat /etc/release
 Oracle Solaris 10 9/10 s10x_u9wos_14a X86
  Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
 Assembled 11 August 2010

 pdflib module is 2.1.10. PDFlib lite is version 7.0.5. I tried to compile 
 everything in 64 bit. I suspect the problem is that somewhere a 32bit lib or 
 executable is being used instead of a 64bit.


 Can anyone help me out on this?

 Kind regards,

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



Re: [PHP] Basic Auth

2013-08-28 Thread Jim Giner

Stuart,

Just wanted to follow up with my thanks for your excellent help in 
providing understanding of how to generate the 401 error page and 
getting me thru the process of performing a sign-out from basic auth. 
Without your patience it never would have happened.


Also wanted to tell you that I've scrapped it all.  Keeping the code for 
a rainy day of course, but giving up on using it (as well as the basic 
auth signon process) to use my own 'roll-your-own' code.  Since IE 
insisted on presenting multiple credentials during the signon process it 
was a futile effort to be doing a signoff.  And yes - I've taken the 
proper precautions to hash the incoming password value before submission 
and storing in my db that way.


Thanks again.  It's help like this that makes this group such a great 
resource.


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



Re: [PHP] Basic Auth

2013-08-28 Thread Stuart Dallas
On 27 Aug 2013, at 18:45, Jim Giner jim.gi...@albanyhandball.com wrote:

 From your latest missive I gleaned that I needed to have a script on my server

One last time: YOU DON'T NEED TO CHANGE ANYTHING ON THE SERVER-SIDE!

Ok, I see that you've decided to use another method, which is great; HTTP auth 
is a pretty antiquated way to handle authentication these days. Whatever you're 
using, I wish you all the best with it.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

php-general Digest 27 Aug 2013 06:45:12 -0000 Issue 8346

2013-08-27 Thread php-general-digest-help

php-general Digest 27 Aug 2013 06:45:12 - Issue 8346

Topics (messages 321971 through 321985):

Re: exec and system do not work
321971 by: Jim Giner
321973 by: marco.behnke.biz
321976 by: Tamara Temple
321978 by: Ethan Rosenberg, PhD
321979 by: Tim Streater
321980 by: David Robley
321981 by: Ethan Rosenberg, PhD
321982 by: Jasper Kips
321983 by: David Robley

How to send post-variables in a Location header
321972 by: Ajay Garg
321974 by: marco.behnke.biz
321975 by: Matijn Woudt
321977 by: Tamara Temple

Permissions
321984 by: Ethan Rosenberg, PhD
321985 by: David Robley

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---

On 8/26/2013 2:41 PM, Ethan Rosenberg wrote:


On 08/26/2013 11:36 AM, ma...@behnke.biz wrote:




Tamara Temple tamouse.li...@gmail.com hat am 26. August 2013 um 08:33
geschrieben:



On Aug 25, 2013, at 10:41 PM, Ethan Rosenberg
erosenb...@hygeiabiomedical.com wrote:


Dear List -

I'm lost on this one -

This works -

$out = system(ls -l ,$retvals);
printf(%s, $out);

This does -

echo exec(ls -l);


Please show the output of the directory listing.
Please us ls -la



This does not -

if( !file_exists(/var/www/orders.txt));
{
$out = system(touch /var/www/orders.txt, $ret);


Maybe you don't have write permissions on the folder?


$out2 = system(chmod 766 /var/www/orders.txt, $ret);
echo 'file2br /';
echo file_exists(/var/www/orders.txt);
}

and this does not -

if( !file_exists(/var/www/orders.txt));
{
exec(touch /var/www/orders.txt);
exec(chmod 766 /var/www/orders.txt);
echo 'file2br /';
echo file_exists(/var/www/orders.txt);
}

Ethan




When you say does not work, can you show what is actually not
working? I
believe the exec and system functions are likely working just fine,
but that
the commands you've passed to them may not be.




--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz



Tamara -

  Please show the output of the directory listing.
  Please us ls -la

echo exec('ls -la orders.txt');

-rw-rw-rw- 1 ethan ethan 43 Aug 25 23:50 orders.txt


Maybe you don't have write permissions on the folder?

If I perform the touch and chmod from the command line, everything works.


  When you say does not work, can you show what is actually not
working? I
  believe the exec and system functions are likely working just fine,
but that
  the commands you've passed to them may not be.

Here are my commands.

if( !file_exists(/var/www/orders.txt));
{
echo system(touch /var/www/orders.txt, $ret);
echo system(chmod 766 /var/www/orders.txt, $ret);
echo 'file2br /';
echo file_exists(/var/www/orders.txt);
}

If I now try a ls from the command line, the return is
  cannot access /var/www/orders.txt: No such file or directory

The ls -la  works because the file was created from the command line.

TIA

Ethan






Ethan - YOU'RE DOING IT AGAIN!!!

Either you are not using error checking AGAIN!!
OR
You are showing us re-typed in code that YOU DIDNT ACTUALLY RUN.

I've told you multiple times that you need to do these two things and 
you are back at it again.


The sample php above has plain simple syntax errors that would keep it 
from running, which error checking would tell you IF YOU RAN IT.
---End Message---
---BeginMessage---


 Ethan Rosenberg erosenb...@hygeiabiomedical.com hat am 26. August 2013 um
 20:41 geschrieben:


   Please show the output of the directory listing.
   Please us ls -la

 echo exec('ls -la orders.txt');

 -rw-rw-rw- 1 ethan ethan 43 Aug 25 23:50 orders.txt

Please supply the complete output. Especially the rights for . and ..

 Maybe you don't have write permissions on the folder?

 If I perform the touch and chmod from the command line, everything works.

cli and ww are different users.
---End Message---
---BeginMessage---

On Aug 26, 2013, at 1:41 PM, Ethan Rosenberg erosenb...@hygeiabiomedical.com 
wrote:
 On 08/26/2013 11:36 AM, ma...@behnke.biz wrote:
 Tamara Temple tamouse.li...@gmail.com hat am 26. August 2013 um 08:33
 geschrieben:
 
 
 
 On Aug 25, 2013, at 10:41 PM, Ethan Rosenberg
 erosenb...@hygeiabiomedical.com wrote:
 
 Dear List -
 
 I'm lost on this one -
 
 This works -
 
 $out = system(ls -l ,$retvals);
 printf(%s, $out);
 
 This does -
 
 echo exec(ls -l);
 
 Please show the output of the directory listing.
 Please us ls -la
 
 
 This does not -
 
 if( !file_exists(/var/www/orders.txt));
 {
$out = system(touch /var/www

[PHP] Re: Permissions

2013-08-27 Thread David Robley
Ethan Rosenberg wrote:

 Dear List -
 
 Tried to run the program, that we have been discussing, and received a
 403 error.
 
 rosenberg:/var/www# ls -la StoreInventory.php
 -rwxrwxrw- 1 ethan ethan 4188 Aug 26 20:26 StoreInventory.php
 
 rosenberg:/var# ls -ld www
 drwxrwxrw- 37 ethan ethan 20480 Aug 26 20:26 www
 
 I had set the S bit [probably a nasty mistake] and I thought I was able
 to remove the bit. [it doesn't show above]
 
 How do I extricate myself from the hole into which I have planted myself?
 
 TIA
 
 Ethan

This is in no way a php question, as the same result will happen no matter 
what you ask apache to serve from that directory.

You have the directory permissions set to 776 not 777.
-- 
Cheers
David Robley

Steal this tagline and I'll tie-dye your cat!


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



Re: [PHP] Re: Permissions

2013-08-27 Thread Ashley Sheridan
On Tue, 2013-08-27 at 16:16 +0930, David Robley wrote:

 Ethan Rosenberg wrote:
 
  Dear List -
  
  Tried to run the program, that we have been discussing, and received a
  403 error.
  
  rosenberg:/var/www# ls -la StoreInventory.php
  -rwxrwxrw- 1 ethan ethan 4188 Aug 26 20:26 StoreInventory.php
  
  rosenberg:/var# ls -ld www
  drwxrwxrw- 37 ethan ethan 20480 Aug 26 20:26 www
  
  I had set the S bit [probably a nasty mistake] and I thought I was able
  to remove the bit. [it doesn't show above]
  
  How do I extricate myself from the hole into which I have planted myself?
  
  TIA
  
  Ethan
 
 This is in no way a php question, as the same result will happen no matter 
 what you ask apache to serve from that directory.
 
 You have the directory permissions set to 776 not 777.
 -- 
 Cheers
 David Robley
 
 Steal this tagline and I'll tie-dye your cat!
 
 


776 won't matter in the case of a directory, as the last bit is for the
eXecute permissions, which aren't applicable to a directory. What 

It's possible that this is an SELinux issue, which adds an extra layer
of permissions over files. To see what those permissions are, use the -Z
flag for ls. Also, check the SELinux logs (assuming that it's running
and it is causing a problem) to see if it brings up anything. It's
typically found on RedHat-based distros.

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




Re: [PHP] Re: Permissions

2013-08-27 Thread David Robley
Ashley Sheridan wrote:

 On Tue, 2013-08-27 at 16:16 +0930, David Robley wrote:
 
 Ethan Rosenberg wrote:
 
  Dear List -
  
  Tried to run the program, that we have been discussing, and received a
  403 error.
  
  rosenberg:/var/www# ls -la StoreInventory.php
  -rwxrwxrw- 1 ethan ethan 4188 Aug 26 20:26 StoreInventory.php
  
  rosenberg:/var# ls -ld www
  drwxrwxrw- 37 ethan ethan 20480 Aug 26 20:26 www
  
  I had set the S bit [probably a nasty mistake] and I thought I was able
  to remove the bit. [it doesn't show above]
  
  How do I extricate myself from the hole into which I have planted
  myself?
  
  TIA
  
  Ethan
 
 This is in no way a php question, as the same result will happen no
 matter what you ask apache to serve from that directory.
 
 You have the directory permissions set to 776 not 777.
 --
 Cheers
 David Robley
 
 Steal this tagline and I'll tie-dye your cat!
 
 
 
 
 776 won't matter in the case of a directory, as the last bit is for the
 eXecute permissions, which aren't applicable to a directory. What

I beg to differ here. If the x bit isn't set on a directory, that will 
prevent scanning of the directory; in this case apache will be prevented 
from scanning the directory and will return a 403.

 It's possible that this is an SELinux issue, which adds an extra layer
 of permissions over files. To see what those permissions are, use the -Z
 flag for ls. Also, check the SELinux logs (assuming that it's running
 and it is causing a problem) to see if it brings up anything. It's
 typically found on RedHat-based distros.
 
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk

-- 
Cheers
David Robley

Artificial Intelligence is no match for natural stupidity.


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



[PHP] How to do PHP build test

2013-08-27 Thread Shahina Rabbani
Hi,


Can anybody help me answering my doubt.

I wanted to check if there are any errors with the php compilation and
build.
I have ran make, make test. make test didnt give any errors to me.
Is there any other method or command to run through which we can see if
there are any errors in building the php source code.


Thanks,
Shahina Rabbani


Re: [PHP] exec and system do not work

2013-08-27 Thread Jim Giner

On 8/26/2013 5:01 PM, Ethan Rosenberg, PhD wrote:


On 08/26/2013 03:28 PM, Jim Giner wrote:

On 8/26/2013 2:41 PM, Ethan Rosenberg wrote:


On 08/26/2013 11:36 AM, ma...@behnke.biz wrote:




Tamara Temple tamouse.li...@gmail.com hat am 26. August 2013 um
08:33
geschrieben:



On Aug 25, 2013, at 10:41 PM, Ethan Rosenberg
erosenb...@hygeiabiomedical.com wrote:


Dear List -

I'm lost on this one -

This works -

$out = system(ls -l ,$retvals);
printf(%s, $out);

This does -

echo exec(ls -l);


Please show the output of the directory listing.
Please us ls -la



This does not -

if( !file_exists(/var/www/orders.txt));
{
$out = system(touch /var/www/orders.txt, $ret);


Maybe you don't have write permissions on the folder?


$out2 = system(chmod 766 /var/www/orders.txt, $ret);
echo 'file2br /';
echo file_exists(/var/www/orders.txt);
}

and this does not -

if( !file_exists(/var/www/orders.txt));
{
exec(touch /var/www/orders.txt);
exec(chmod 766 /var/www/orders.txt);
echo 'file2br /';
echo file_exists(/var/www/orders.txt);
}

Ethan




When you say does not work, can you show what is actually not
working? I
believe the exec and system functions are likely working just fine,
but that
the commands you've passed to them may not be.




--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz



Tamara -

  Please show the output of the directory listing.
  Please us ls -la

echo exec('ls -la orders.txt');

-rw-rw-rw- 1 ethan ethan 43 Aug 25 23:50 orders.txt


Maybe you don't have write permissions on the folder?

If I perform the touch and chmod from the command line, everything
works.


  When you say does not work, can you show what is actually not
working? I
  believe the exec and system functions are likely working just fine,
but that
  the commands you've passed to them may not be.

Here are my commands.

if( !file_exists(/var/www/orders.txt));
{
echo system(touch /var/www/orders.txt, $ret);
echo system(chmod 766 /var/www/orders.txt, $ret);
echo 'file2br /';
echo file_exists(/var/www/orders.txt);
}

If I now try a ls from the command line, the return is
  cannot access /var/www/orders.txt: No such file or directory

The ls -la  works because the file was created from the command line.

TIA

Ethan






Ethan - YOU'RE DOING IT AGAIN!!!

Either you are not using error checking AGAIN!!
OR
You are showing us re-typed in code that YOU DIDNT ACTUALLY RUN.

I've told you multiple times that you need to do these two things and
you are back at it again.

The sample php above has plain simple syntax errors that would keep it
from running, which error checking would tell you IF YOU RAN IT.



Jim -

Thank you.

I don't totally understand your reply ...

but I will try to answer

The code is taken from an operating program.  My error checking is set
to maximum sensitivity.

If you would point out my syntax errors, I will fix them.

TIA

Ethan


you have semis after your if lines - therefore no logic gets executed.

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



[PHP] Basic Auth

2013-08-27 Thread Jim Giner
Im using basic auth for a few of my pages that I want to limit access 
to - nothing of a sensitive nature, but simply want to limit access to. 
 Want to implement a signoff process, but can't figure it out.


From the comments in the manual I take it one can't do this by simply 
unsetting the PHP_AUTH_USER and _PW vars.  Can someone explain to me why 
this doesn't suffice?  The signon process expects them to be there, so 
when they are not (after the 'unset'), how come my signon process still 
detects them and their values?


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



Re: [PHP] Basic Auth

2013-08-27 Thread Stuart Dallas
On 27 Aug 2013, at 14:37, Jim Giner jim.gi...@albanyhandball.com wrote:

 Im using basic auth for a few of my pages that I want to limit access to - 
 nothing of a sensitive nature, but simply want to limit access to.  Want to 
 implement a signoff process, but can't figure it out.
 
 From the comments in the manual I take it one can't do this by simply 
 unsetting the PHP_AUTH_USER and _PW vars.  Can someone explain to me why this 
 doesn't suffice?  The signon process expects them to be there, so when they 
 are not (after the 'unset'), how come my signon process still detects them 
 and their values?


The global variables you're referring to are just that, global variables; 
changing them will have no effect on the browser. Basic Auth was not designed 
to allow users to log out, but you can make it happen with some Javascript.

Have your log out link call a Javascript function which sends an XMLHttpRequest 
with an invalid username and password. The server will return a 401 which you 
ignore and then take the user to whatever URL you want them to see after they 
log off. Not pretty, but it works.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

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



Re: [PHP] Basic Auth

2013-08-27 Thread Jim Giner


On 8/27/2013 9:46 AM, Stuart Dallas wrote:

On 27 Aug 2013, at 14:37, Jim Giner jim.gi...@albanyhandball.com wrote:


Im using basic auth for a few of my pages that I want to limit access to - 
nothing of a sensitive nature, but simply want to limit access to.  Want to 
implement a signoff process, but can't figure it out.

 From the comments in the manual I take it one can't do this by simply 
unsetting the PHP_AUTH_USER and _PW vars.  Can someone explain to me why this 
doesn't suffice?  The signon process expects them to be there, so when they are 
not (after the 'unset'), how come my signon process still detects them and 
their values?


The global variables you're referring to are just that, global variables; 
changing them will have no effect on the browser. Basic Auth was not designed 
to allow users to log out, but you can make it happen with some Javascript.

Have your log out link call a Javascript function which sends an XMLHttpRequest 
with an invalid username and password. The server will return a 401 which you 
ignore and then take the user to whatever URL you want them to see after they 
log off. Not pretty, but it works.

-Stuart


Thanks for the timely response!

Before I try your suggestion - one question.  Since when is a global 
variable not changeable?  Doesn't the fact that it reflects a modified 
value when I do change it tell me it worked?  I change the value to 
'xxx' and show it having that value, but when the script is called again 
the old value appears.  Very confusing!



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



Re: [PHP] Basic Auth

2013-08-27 Thread Stuart Dallas
On 27 Aug 2013, at 15:06, Jim Giner jim.gi...@albanyhandball.com wrote:

 
 On 8/27/2013 9:46 AM, Stuart Dallas wrote:
 On 27 Aug 2013, at 14:37, Jim Giner jim.gi...@albanyhandball.com wrote:
 
 Im using basic auth for a few of my pages that I want to limit access to - 
 nothing of a sensitive nature, but simply want to limit access to.  Want to 
 implement a signoff process, but can't figure it out.
 
 From the comments in the manual I take it one can't do this by simply 
 unsetting the PHP_AUTH_USER and _PW vars.  Can someone explain to me why 
 this doesn't suffice?  The signon process expects them to be there, so when 
 they are not (after the 'unset'), how come my signon process still detects 
 them and their values?
 
 The global variables you're referring to are just that, global variables; 
 changing them will have no effect on the browser. Basic Auth was not 
 designed to allow users to log out, but you can make it happen with some 
 Javascript.
 
 Have your log out link call a Javascript function which sends an 
 XMLHttpRequest with an invalid username and password. The server will return 
 a 401 which you ignore and then take the user to whatever URL you want them 
 to see after they log off. Not pretty, but it works.
 
 -Stuart
 
 Thanks for the timely response!
 
 Before I try your suggestion - one question.  Since when is a global variable 
 not changeable?  Doesn't the fact that it reflects a modified value when I do 
 change it tell me it worked?  I change the value to 'xxx' and show it having 
 that value, but when the script is called again the old value appears.  Very 
 confusing!

I didn't say you couldn't change it, I said doing so will have no effect on the 
browser.

It's not really confusing so long as you understand how PHP works. Each request 
is brand new - nothing is retained from previous requests. The two variable 
you're changing are set by PHP when the request comes in from the browser. The 
fact you changed them in a previous request is irrelevant because 1) that 
change was not communicated to the browser in any way, and 2) PHP doesn't 
retain any data between requests [1].

If you've been coding assuming that changes you make to global variables are 
retained between requests you must have been having some pretty frustrating 
times!

-Stuart

[1] The one exception to this is $_SESSION, but it's important to know how that 
works. The $_SESSION array is populated when you call session_start(). It's 
loaded from some form of storage (files by default) and unserialised in to 
$_SESSION. When the session is closed, either implicitly by the request ending 
or by a call to one of the methods that explicitly do it, the contents are 
serialised to the storage system. Once closed, any changes to $_SESSION will 
not be stored; it becomes just another superglobal (not that it was ever 
anything else).

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

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



Re: [PHP] Basic Auth

2013-08-27 Thread Jim Giner


On 8/27/2013 10:14 AM, Stuart Dallas wrote:

It's not really confusing so long as you understand how PHP works. Each request 
is brand new - nothing is retained from previous requests. The two variable 
you're changing are set by PHP when the request comes in from the browser. The 
fact you changed them in a previous request is irrelevant because 1) that 
change was not communicated to the browser in any way, and 2) PHP doesn't 
retain any data between requests [1].

If you've been coding assuming that changes you make to global variables are 
retained between requests you must have been having some pretty frustrating 
times!

-Stuart



Not really - this is the first time I've had something not work as expected.


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



Re: [PHP] Basic Auth

2013-08-27 Thread Stuart Dallas
On 27 Aug 2013, at 15:18, Jim Giner jim.gi...@albanyhandball.com wrote:

 On 8/27/2013 10:14 AM, Stuart Dallas wrote:
 It's not really confusing so long as you understand how PHP works. Each 
 request is brand new - nothing is retained from previous requests. The two 
 variable you're changing are set by PHP when the request comes in from the 
 browser. The fact you changed them in a previous request is irrelevant 
 because 1) that change was not communicated to the browser in any way, and 
 2) PHP doesn't retain any data between requests [1].
 
 If you've been coding assuming that changes you make to global variables are 
 retained between requests you must have been having some pretty frustrating 
 times!
 
 -Stuart
 
 
 Not really - this is the first time I've had something not work as expected.

That was said with my tongue very much firmly in my cheek, and so is this:

  I've been playing with dynamite since I was 4 - hey, it must be a safe, 
proper thing to do!

Just because nothing has blown up in your face yet doesn't mean it won't, and 
I'm concerned that you might not actually see how important it is to make sure 
you're using the tool correctly.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

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



Re: [PHP] Basic Auth

2013-08-27 Thread Jim Giner


On 8/27/2013 10:39 AM, Stuart Dallas wrote:

On 27 Aug 2013, at 15:18, Jim Giner jim.gi...@albanyhandball.com wrote:


On 8/27/2013 10:14 AM, Stuart Dallas wrote:

It's not really confusing so long as you understand how PHP works. Each request 
is brand new - nothing is retained from previous requests. The two variable 
you're changing are set by PHP when the request comes in from the browser. The 
fact you changed them in a previous request is irrelevant because 1) that 
change was not communicated to the browser in any way, and 2) PHP doesn't 
retain any data between requests [1].

If you've been coding assuming that changes you make to global variables are 
retained between requests you must have been having some pretty frustrating 
times!

-Stuart


Not really - this is the first time I've had something not work as expected.

That was said with my tongue very much firmly in my cheek, and so is this:

   I've been playing with dynamite since I was 4 - hey, it must be a safe, 
proper thing to do!

Just because nothing has blown up in your face yet doesn't mean it won't, and 
I'm concerned that you might not actually see how important it is to make sure 
you're using the tool correctly.

-Stuart

This may very well be the first time with this problem because I haven't 
tried anything like this before.


That said - can you give me some pointers on how to do the JS solution?  
I'm calling a script that is similar to the one I used to signon.  It 
sends out something like:


header(WWW-Authenticate: Basic realm=$realm);
header('HTTP/1.0 401 Unauthorized');
echo h3You have entered invalid credentialsbr;
echo Click a href='$return_url' here /a to return to the 
menu.;

exit();

when it doesn't detect the PHP_AUTH_USER or it is an invalid value.

So - to effect a signoff, what does one do?   You said to use an invalid 
value, but what do I do with that?  How do I ignore the 401?   Now I'm 
getting the signin dialog and I'm stuck.



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



Re: [PHP] Basic Auth

2013-08-27 Thread Stuart Dallas
On 27 Aug 2013, at 15:51, Jim Giner jim.gi...@albanyhandball.com wrote:

 On 8/27/2013 10:39 AM, Stuart Dallas wrote:
 On 27 Aug 2013, at 15:18, Jim Giner jim.gi...@albanyhandball.com wrote:
 
 On 8/27/2013 10:14 AM, Stuart Dallas wrote:
 It's not really confusing so long as you understand how PHP works. Each 
 request is brand new - nothing is retained from previous requests. The two 
 variable you're changing are set by PHP when the request comes in from the 
 browser. The fact you changed them in a previous request is irrelevant 
 because 1) that change was not communicated to the browser in any way, and 
 2) PHP doesn't retain any data between requests [1].
 
 If you've been coding assuming that changes you make to global variables 
 are retained between requests you must have been having some pretty 
 frustrating times!
 
 -Stuart
 
 Not really - this is the first time I've had something not work as expected.
 That was said with my tongue very much firmly in my cheek, and so is this:
 
   I've been playing with dynamite since I was 4 - hey, it must be a safe, 
 proper thing to do!
 
 Just because nothing has blown up in your face yet doesn't mean it won't, 
 and I'm concerned that you might not actually see how important it is to 
 make sure you're using the tool correctly.
 
 -Stuart
 
 This may very well be the first time with this problem because I haven't 
 tried anything like this before.
 
 That said - can you give me some pointers on how to do the JS solution?  I'm 
 calling a script that is similar to the one I used to signon.  It sends out 
 something like:
 
header(WWW-Authenticate: Basic realm=$realm);
header('HTTP/1.0 401 Unauthorized');
echo h3You have entered invalid credentialsbr;
echo Click a href='$return_url' here /a to return to the menu.;
exit();
 
 when it doesn't detect the PHP_AUTH_USER or it is an invalid value.
 
 So - to effect a signoff, what does one do?   You said to use an invalid 
 value, but what do I do with that?  How do I ignore the 401?   Now I'm 
 getting the signin dialog and I'm stuck.

You don't need to do anything on the server-side. You simply need a JS function 
that sends a request to a URL that requires basic auth, with an Authenticate 
header that contains an invalid username and password. Then, when your server 
responds with a 401 Authentication required (which it should already do for an 
invalid request) you can set location.href to whatever URL you want the logged 
out user to see.

If you don't know how to make a request from Javascript -- commonly known as an 
AJAX request -- then google for it. I'd recommend the jquery library if you 
want a very easy way to do it.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

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



Re: [PHP] Basic Auth

2013-08-27 Thread Jim Giner


On 8/27/2013 10:55 AM, Stuart Dallas wrote:

On 27 Aug 2013, at 15:51, Jim Giner jim.gi...@albanyhandball.com wrote:


On 8/27/2013 10:39 AM, Stuart Dallas wrote:

On 27 Aug 2013, at 15:18, Jim Giner jim.gi...@albanyhandball.com wrote:


On 8/27/2013 10:14 AM, Stuart Dallas wrote:

It's not really confusing so long as you understand how PHP works. Each request 
is brand new - nothing is retained from previous requests. The two variable 
you're changing are set by PHP when the request comes in from the browser. The 
fact you changed them in a previous request is irrelevant because 1) that 
change was not communicated to the browser in any way, and 2) PHP doesn't 
retain any data between requests [1].

If you've been coding assuming that changes you make to global variables are 
retained between requests you must have been having some pretty frustrating 
times!

-Stuart


Not really - this is the first time I've had something not work as expected.

That was said with my tongue very much firmly in my cheek, and so is this:

   I've been playing with dynamite since I was 4 - hey, it must be a safe, 
proper thing to do!

Just because nothing has blown up in your face yet doesn't mean it won't, and 
I'm concerned that you might not actually see how important it is to make sure 
you're using the tool correctly.

-Stuart


This may very well be the first time with this problem because I haven't tried 
anything like this before.

That said - can you give me some pointers on how to do the JS solution?  I'm 
calling a script that is similar to the one I used to signon.  It sends out 
something like:

header(WWW-Authenticate: Basic realm=$realm);
header('HTTP/1.0 401 Unauthorized');
echo h3You have entered invalid credentialsbr;
echo Click a href='$return_url' here /a to return to the menu.;
exit();

when it doesn't detect the PHP_AUTH_USER or it is an invalid value.

So - to effect a signoff, what does one do?   You said to use an invalid value, 
but what do I do with that?  How do I ignore the 401?   Now I'm getting the 
signin dialog and I'm stuck.

You don't need to do anything on the server-side. You simply need a JS function 
that sends a request to a URL that requires basic auth, with an Authenticate 
header that contains an invalid username and password. Then, when your server 
responds with a 401 Authentication required (which it should already do for an 
invalid request) you can set location.href to whatever URL you want the logged 
out user to see.

If you don't know how to make a request from Javascript -- commonly known as an 
AJAX request -- then google for it. I'd recommend the jquery library if you 
want a very easy way to do it.

-Stuart

I am familiar with an ajax request (xmlhttprequest) and I have a 
function ready to call a script to effect this signoff.  I just don't 
know what to put in that php script I'm calling.  From what you just 
wrote I'm guessing that my headers as shown previously  may be close - 
Im confused about your mention of contains an invalid username  
As you can see from my sample I don't include such a thing.



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



Re: [PHP] Off the wall - sub-domain question

2013-08-27 Thread Daniel Brown
On Wed, Aug 21, 2013 at 5:16 PM, Jim Giner jim.gi...@albanyhandball.com wrote:
 I have a main domain (of course) and a sub domain.  I'm really trying to
 steer my personal stuff away from the main one and have focused all of my
 php development to the sub-domain.

 Lately I noticed that google catalogs my sub-domain site stuff under the
 main domain name and the links that come up lead to that domain name with
 the path that takes the user to the sub-domain's home folder and beyond.

 Is there something that php (apache??) can do to control either google's
 robots or the user's view (url) so that it appears as a page of my
 sub-domain?  I'm really new at this stuff and know nothing.  I'm lucky that
 google is even finding my site!

You'd probably want to do some 301 redirects with mod_rewrite to
force the domain over to the subdomain if under that directory.  In so
doing, Google (and other search engines) will drop the /subdomain
folder, and index only the destination.

-- 
/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



Fwd: [PHP] Basic Auth

2013-08-27 Thread Stuart Dallas
Oops, sent this message from the wrong email address, so the list rejected it.

Begin forwarded message:

 From: Stuart Dallas stu...@3ft9.com
 Subject: Re: [PHP] Basic Auth
 Date: 27 August 2013 16:36:27 BST
 To: jim.gi...@albanyhandball.com
 Cc: php-general@lists.php.net
 
 On 27 Aug 2013, at 15:59, Jim Giner jim.gi...@albanyhandball.com wrote:
 
 On 8/27/2013 10:55 AM, Stuart Dallas wrote:
 On 27 Aug 2013, at 15:51, Jim Giner jim.gi...@albanyhandball.com wrote:
 
 On 8/27/2013 10:39 AM, Stuart Dallas wrote:
 On 27 Aug 2013, at 15:18, Jim Giner jim.gi...@albanyhandball.com wrote:
 
 On 8/27/2013 10:14 AM, Stuart Dallas wrote:
 It's not really confusing so long as you understand how PHP works. Each 
 request is brand new - nothing is retained from previous requests. The 
 two variable you're changing are set by PHP when the request comes in 
 from the browser. The fact you changed them in a previous request is 
 irrelevant because 1) that change was not communicated to the browser 
 in any way, and 2) PHP doesn't retain any data between requests [1].
 
 If you've been coding assuming that changes you make to global 
 variables are retained between requests you must have been having some 
 pretty frustrating times!
 
 -Stuart
 
 Not really - this is the first time I've had something not work as 
 expected.
 That was said with my tongue very much firmly in my cheek, and so is this:
 
  I've been playing with dynamite since I was 4 - hey, it must be a safe, 
 proper thing to do!
 
 Just because nothing has blown up in your face yet doesn't mean it won't, 
 and I'm concerned that you might not actually see how important it is to 
 make sure you're using the tool correctly.
 
 -Stuart
 
 This may very well be the first time with this problem because I haven't 
 tried anything like this before.
 
 That said - can you give me some pointers on how to do the JS solution?  
 I'm calling a script that is similar to the one I used to signon.  It 
 sends out something like:
 
   header(WWW-Authenticate: Basic realm=$realm);
   header('HTTP/1.0 401 Unauthorized');
   echo h3You have entered invalid credentialsbr;
   echo Click a href='$return_url' here /a to return to the menu.;
   exit();
 
 when it doesn't detect the PHP_AUTH_USER or it is an invalid value.
 
 So - to effect a signoff, what does one do?   You said to use an invalid 
 value, but what do I do with that?  How do I ignore the 401?   Now I'm 
 getting the signin dialog and I'm stuck.
 You don't need to do anything on the server-side. You simply need a JS 
 function that sends a request to a URL that requires basic auth, with an 
 Authenticate header that contains an invalid username and password. Then, 
 when your server responds with a 401 Authentication required (which it 
 should already do for an invalid request) you can set location.href to 
 whatever URL you want the logged out user to see.
 
 If you don't know how to make a request from Javascript -- commonly known 
 as an AJAX request -- then google for it. I'd recommend the jquery library 
 if you want a very easy way to do it.
 
 -Stuart
 
 I am familiar with an ajax request (xmlhttprequest) and I have a function 
 ready to call a script to effect this signoff.  I just don't know what to 
 put in that php script I'm calling.  From what you just wrote I'm guessing 
 that my headers as shown previously  may be close - Im confused about your 
 mention of contains an invalid username  As you can see from my sample 
 I don't include such a thing.
 
 For the last time: YOU DO NOT NEED TO MAKE ANY CHANGES SERVER-SIDE.
 
 From the Javascript, request any URL that requires authentication - it 
 doesn't matter. When you make the AJAX request, pass an Authentication header 
 that contains an invalid username and password. If you don't know what I mean 
 by that, please google how HTTP Basic Auth works.
 
 -Stuart
 
 -- 
 Stuart Dallas
 3ft9 Ltd
 http://3ft9.com/


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



Re: [PHP] Re: Permissions

2013-08-27 Thread Daniel Brown
On Tue, Aug 27, 2013 at 3:07 AM, David Robley robl...@zoho.com wrote:

 I beg to differ here. If the x bit isn't set on a directory, that will
 prevent scanning of the directory; in this case apache will be prevented
 from scanning the directory and will return a 403.

Well, that's partially correct.  If a directory is owned by
someone other than the current user (for example, root) and is 0776,
you can list the directory content from outside of the directory to
get a basic file listing.  What you won't get by doing that, however,
is anything other than the file name and type, because the kernel is
forbidden from executing mtime, ctime, and owner/group queries on the
files.  In addition, you won't be able to enter the directory (cd).

That said, if Ethan is running his Apache server as the user
'ethan' (which isn't mentioned) then it would be fine regardless.

As for the 's' notation, that's either a bitmask of 0400 or 0200,
which are for setuid and setgid, respectively.

-- 
/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: Fwd: [PHP] Basic Auth

2013-08-27 Thread Jim Giner

On 8/27/2013 11:56 AM, Stuart Dallas wrote:

Oops, sent this message from the wrong email address, so the list rejected it.

Begin forwarded message:


From: Stuart Dallas stu...@3ft9.com
Subject: Re: [PHP] Basic Auth
Date: 27 August 2013 16:36:27 BST
To: jim.gi...@albanyhandball.com
Cc: php-general@lists.php.net

On 27 Aug 2013, at 15:59, Jim Giner jim.gi...@albanyhandball.com wrote:


On 8/27/2013 10:55 AM, Stuart Dallas wrote:

On 27 Aug 2013, at 15:51, Jim Giner jim.gi...@albanyhandball.com wrote:


On 8/27/2013 10:39 AM, Stuart Dallas wrote:

On 27 Aug 2013, at 15:18, Jim Giner jim.gi...@albanyhandball.com wrote:


On 8/27/2013 10:14 AM, Stuart Dallas wrote:

It's not really confusing so long as you understand how PHP works. Each request 
is brand new - nothing is retained from previous requests. The two variable 
you're changing are set by PHP when the request comes in from the browser. The 
fact you changed them in a previous request is irrelevant because 1) that 
change was not communicated to the browser in any way, and 2) PHP doesn't 
retain any data between requests [1].

If you've been coding assuming that changes you make to global variables are 
retained between requests you must have been having some pretty frustrating 
times!

-Stuart


Not really - this is the first time I've had something not work as expected.

That was said with my tongue very much firmly in my cheek, and so is this:

  I've been playing with dynamite since I was 4 - hey, it must be a safe, 
proper thing to do!

Just because nothing has blown up in your face yet doesn't mean it won't, and 
I'm concerned that you might not actually see how important it is to make sure 
you're using the tool correctly.

-Stuart


This may very well be the first time with this problem because I haven't tried 
anything like this before.

That said - can you give me some pointers on how to do the JS solution?  I'm 
calling a script that is similar to the one I used to signon.  It sends out 
something like:

   header(WWW-Authenticate: Basic realm=$realm);
   header('HTTP/1.0 401 Unauthorized');
   echo h3You have entered invalid credentialsbr;
   echo Click a href='$return_url' here /a to return to the menu.;
   exit();

when it doesn't detect the PHP_AUTH_USER or it is an invalid value.

So - to effect a signoff, what does one do?   You said to use an invalid value, 
but what do I do with that?  How do I ignore the 401?   Now I'm getting the 
signin dialog and I'm stuck.

You don't need to do anything on the server-side. You simply need a JS function 
that sends a request to a URL that requires basic auth, with an Authenticate 
header that contains an invalid username and password. Then, when your server 
responds with a 401 Authentication required (which it should already do for an 
invalid request) you can set location.href to whatever URL you want the logged 
out user to see.

If you don't know how to make a request from Javascript -- commonly known as an 
AJAX request -- then google for it. I'd recommend the jquery library if you 
want a very easy way to do it.

-Stuart


I am familiar with an ajax request (xmlhttprequest) and I have a function ready to call a 
script to effect this signoff.  I just don't know what to put in that php script I'm calling.  
From what you just wrote I'm guessing that my headers as shown previously  may be close - 
Im confused about your mention of contains an invalid username  As you 
can see from my sample I don't include such a thing.


For the last time: YOU DO NOT NEED TO MAKE ANY CHANGES SERVER-SIDE.

 From the Javascript, request any URL that requires authentication - it doesn't 
matter. When you make the AJAX request, pass an Authentication header that 
contains an invalid username and password. If you don't know what I mean by 
that, please google how HTTP Basic Auth works.

-Stuart

--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/


It's not the basic auth that I'm having the issue with - it's the 
'header' thing and understanding what a 401 is doing and how I'm to 
ignore it.  Never had to play with these things before and this part is 
all new.  Let's face it - I'm an applications guy, not a systems guy. 
All this talk of headers and such is greek to me.


I have spent the last hour googling away on this topic - still no 
understanding.


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



Re: [PHP] How to send post-variables in a Location header

2013-08-27 Thread Daniel Brown
On Mon, Aug 26, 2013 at 3:48 PM, Ajay Garg ajaygargn...@gmail.com wrote:
 Hi all.

 I have a scenario, wherein I need to do something like this ::

 ###
 $original_url = /autologin.php;
 $username = ajay;
 $password = garg;

 header('Location: ' . $original_url);
 ###

 As can be seen, I wish to redirect to the URL autologin.php.

 Additionally, I wish to pass two POST key-value pairs :: user=ajay and
 password=garg (I understand that passing GET key-value pairs is trivial).

 Is it  even possible?
 If yes, I will be grateful if someone could let me know how to redirect to
 a URL, passing the POST key-value pairs as necessary.

No.  Sending a 'Location:' header issues an HTTP 301 by default,
which means the browser will follow it using a GET request.  If you
can't pass the information from one location to another using sessions
or (less ideally) cookies, you might consider doing a cURL POST
request in the background and passing the session ID back to the
browser, and having it handle it appropriately (read: session
hijack).

-- 
/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



[PHP] Re: Basic Auth

2013-08-27 Thread B. Aerts

On 27/08/13 15:37, Jim Giner wrote:

Im using basic auth for a few of my pages that I want to limit access
to - nothing of a sensitive nature, but simply want to limit access to.
  Want to implement a signoff process, but can't figure it out.

 From the comments in the manual I take it one can't do this by simply
unsetting the PHP_AUTH_USER and _PW vars.  Can someone explain to me why
this doesn't suffice?  The signon process expects them to be there, so
when they are not (after the 'unset'), how come my signon process still
detects them and their values?


Hello Jim,

at the risk of under-estimating your knowledge (and over-estimating 
mine) of HTTP-requests in PHP - but here it goes.


I see two options of bypassing the JavaScript option.

The first one is to use the default authorization, and error pages of 
your HTTP server.
(For example, in Apache: 
http://httpd.apache.org/docs/2.2/custom-error.html)

This is for a login with invalid credentials.
For some-one to leave the protected site, a HTTP-request without 
credentials, and to a URI outside the protected domain, should do (as 
every HTTP request into the protected domain should repeat the 
Authorisation header).



The second one is to leave header(), and go down one level, to the likes 
of fsockopen() or stream_socket_server() - though personally, I've only 
limited knowledge of a bit of client-side programming.


Unless I've completely misunderstood your question,
Hope this helps,

Bert

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



Re: [PHP] exec and system do not work

2013-08-27 Thread Daniel Brown
On Sun, Aug 25, 2013 at 11:41 PM, Ethan Rosenberg
erosenb...@hygeiabiomedical.com wrote:
 Dear List -

 I'm lost on this one -

 This works -

 $out = system(ls -l ,$retvals);
 printf(%s, $out);

 This does -

 echo exec(ls -l);

 This does not -

 if( !file_exists(/var/www/orders.txt));
 {
$out = system(touch /var/www/orders.txt, $ret);
$out2 = system(chmod 766 /var/www/orders.txt, $ret);
echo 'file2br /';
echo file_exists(/var/www/orders.txt);
 }

?php echo `whoami`; ?

-- 
/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] Basic Auth

2013-08-27 Thread Stuart Dallas
On 27 Aug 2013, at 17:28, Jim Giner jim.gi...@albanyhandball.com wrote:

 On 8/27/2013 11:56 AM, Stuart Dallas wrote:
 Oops, sent this message from the wrong email address, so the list rejected 
 it.
 
 Begin forwarded message:
 
 From: Stuart Dallas stu...@3ft9.com
 Subject: Re: [PHP] Basic Auth
 Date: 27 August 2013 16:36:27 BST
 To: jim.gi...@albanyhandball.com
 Cc: php-general@lists.php.net
 
 On 27 Aug 2013, at 15:59, Jim Giner jim.gi...@albanyhandball.com wrote:
 
 On 8/27/2013 10:55 AM, Stuart Dallas wrote:
 On 27 Aug 2013, at 15:51, Jim Giner jim.gi...@albanyhandball.com wrote:
 
 On 8/27/2013 10:39 AM, Stuart Dallas wrote:
 On 27 Aug 2013, at 15:18, Jim Giner jim.gi...@albanyhandball.com 
 wrote:
 
 On 8/27/2013 10:14 AM, Stuart Dallas wrote:
 It's not really confusing so long as you understand how PHP works. 
 Each request is brand new - nothing is retained from previous 
 requests. The two variable you're changing are set by PHP when the 
 request comes in from the browser. The fact you changed them in a 
 previous request is irrelevant because 1) that change was not 
 communicated to the browser in any way, and 2) PHP doesn't retain any 
 data between requests [1].
 
 If you've been coding assuming that changes you make to global 
 variables are retained between requests you must have been having 
 some pretty frustrating times!
 
 -Stuart
 
 Not really - this is the first time I've had something not work as 
 expected.
 That was said with my tongue very much firmly in my cheek, and so is 
 this:
 
  I've been playing with dynamite since I was 4 - hey, it must be a 
 safe, proper thing to do!
 
 Just because nothing has blown up in your face yet doesn't mean it 
 won't, and I'm concerned that you might not actually see how important 
 it is to make sure you're using the tool correctly.
 
 -Stuart
 
 This may very well be the first time with this problem because I haven't 
 tried anything like this before.
 
 That said - can you give me some pointers on how to do the JS solution?  
 I'm calling a script that is similar to the one I used to signon.  It 
 sends out something like:
 
   header(WWW-Authenticate: Basic realm=$realm);
   header('HTTP/1.0 401 Unauthorized');
   echo h3You have entered invalid credentialsbr;
   echo Click a href='$return_url' here /a to return to the 
 menu.;
   exit();
 
 when it doesn't detect the PHP_AUTH_USER or it is an invalid value.
 
 So - to effect a signoff, what does one do?   You said to use an invalid 
 value, but what do I do with that?  How do I ignore the 401?   Now I'm 
 getting the signin dialog and I'm stuck.
 You don't need to do anything on the server-side. You simply need a JS 
 function that sends a request to a URL that requires basic auth, with an 
 Authenticate header that contains an invalid username and password. Then, 
 when your server responds with a 401 Authentication required (which it 
 should already do for an invalid request) you can set location.href to 
 whatever URL you want the logged out user to see.
 
 If you don't know how to make a request from Javascript -- commonly known 
 as an AJAX request -- then google for it. I'd recommend the jquery 
 library if you want a very easy way to do it.
 
 -Stuart
 
 I am familiar with an ajax request (xmlhttprequest) and I have a function 
 ready to call a script to effect this signoff.  I just don't know what to 
 put in that php script I'm calling.  From what you just wrote I'm guessing 
 that my headers as shown previously  may be close - Im confused about 
 your mention of contains an invalid username  As you can see from my 
 sample I don't include such a thing.
 
 For the last time: YOU DO NOT NEED TO MAKE ANY CHANGES SERVER-SIDE.
 
 From the Javascript, request any URL that requires authentication - it 
 doesn't matter. When you make the AJAX request, pass an Authentication 
 header that contains an invalid username and password. If you don't know 
 what I mean by that, please google how HTTP Basic Auth works.
 
 -Stuart
 
 It's not the basic auth that I'm having the issue with - it's the 'header' 
 thing and understanding what a 401 is doing and how I'm to ignore it.  Never 
 had to play with these things before and this part is all new.  Let's face it 
 - I'm an applications guy, not a systems guy. All this talk of headers and 
 such is greek to me.

HTTP headers are as important for application guys as they are for systems 
guys. I appreciate that this may be new to you, but it's pretty basic knowledge 
about how HTTP works.

Basic auth is simple, and you need to understand how it works to understand 
what I've been trying to say. Here's how HTTP auth works:

1) Browser hits page.
2) The PHP script knows this page requires HTTP Auth, checks the 
PHP_AUTH_[USER|PW] variables but doesn't find anything, so it responds with an 
HTTP status of 401 Unauthorised.
3) The browser gets the 401 response and displays the login box.
4) User enters username and password

Re: [PHP] Basic Auth

2013-08-27 Thread Jim Giner


On 8/27/2013 12:53 PM, Stuart Dallas wrote:

On 27 Aug 2013, at 17:28, Jim Giner jim.gi...@albanyhandball.com wrote:


On 8/27/2013 11:56 AM, Stuart Dallas wrote:

Oops, sent this message from the wrong email address, so the list rejected it.

Begin forwarded message:


From: Stuart Dallas stu...@3ft9.com
Subject: Re: [PHP] Basic Auth
Date: 27 August 2013 16:36:27 BST
To: jim.gi...@albanyhandball.com
Cc: php-general@lists.php.net

On 27 Aug 2013, at 15:59, Jim Giner jim.gi...@albanyhandball.com wrote:


On 8/27/2013 10:55 AM, Stuart Dallas wrote:

On 27 Aug 2013, at 15:51, Jim Giner jim.gi...@albanyhandball.com wrote:


On 8/27/2013 10:39 AM, Stuart Dallas wrote:

On 27 Aug 2013, at 15:18, Jim Giner jim.gi...@albanyhandball.com wrote:


On 8/27/2013 10:14 AM, Stuart Dallas wrote:

It's not really confusing so long as you understand how PHP works. Each request 
is brand new - nothing is retained from previous requests. The two variable 
you're changing are set by PHP when the request comes in from the browser. The 
fact you changed them in a previous request is irrelevant because 1) that 
change was not communicated to the browser in any way, and 2) PHP doesn't 
retain any data between requests [1].

If you've been coding assuming that changes you make to global variables are 
retained between requests you must have been having some pretty frustrating 
times!

-Stuart


Not really - this is the first time I've had something not work as expected.

That was said with my tongue very much firmly in my cheek, and so is this:

  I've been playing with dynamite since I was 4 - hey, it must be a safe, 
proper thing to do!

Just because nothing has blown up in your face yet doesn't mean it won't, and 
I'm concerned that you might not actually see how important it is to make sure 
you're using the tool correctly.

-Stuart


This may very well be the first time with this problem because I haven't tried 
anything like this before.

That said - can you give me some pointers on how to do the JS solution?  I'm 
calling a script that is similar to the one I used to signon.  It sends out 
something like:

   header(WWW-Authenticate: Basic realm=$realm);
   header('HTTP/1.0 401 Unauthorized');
   echo h3You have entered invalid credentialsbr;
   echo Click a href='$return_url' here /a to return to the menu.;
   exit();

when it doesn't detect the PHP_AUTH_USER or it is an invalid value.

So - to effect a signoff, what does one do?   You said to use an invalid value, 
but what do I do with that?  How do I ignore the 401?   Now I'm getting the 
signin dialog and I'm stuck.

You don't need to do anything on the server-side. You simply need a JS function 
that sends a request to a URL that requires basic auth, with an Authenticate 
header that contains an invalid username and password. Then, when your server 
responds with a 401 Authentication required (which it should already do for an 
invalid request) you can set location.href to whatever URL you want the logged 
out user to see.

If you don't know how to make a request from Javascript -- commonly known as an 
AJAX request -- then google for it. I'd recommend the jquery library if you 
want a very easy way to do it.

-Stuart


I am familiar with an ajax request (xmlhttprequest) and I have a function ready to call a 
script to effect this signoff.  I just don't know what to put in that php script I'm calling.  
From what you just wrote I'm guessing that my headers as shown previously  may be close - 
Im confused about your mention of contains an invalid username  As you 
can see from my sample I don't include such a thing.

For the last time: YOU DO NOT NEED TO MAKE ANY CHANGES SERVER-SIDE.

 From the Javascript, request any URL that requires authentication - it doesn't 
matter. When you make the AJAX request, pass an Authentication header that 
contains an invalid username and password. If you don't know what I mean by 
that, please google how HTTP Basic Auth works.

-Stuart

It's not the basic auth that I'm having the issue with - it's the 'header' 
thing and understanding what a 401 is doing and how I'm to ignore it.  Never 
had to play with these things before and this part is all new.  Let's face it - 
I'm an applications guy, not a systems guy. All this talk of headers and such 
is greek to me.

HTTP headers are as important for application guys as they are for systems 
guys. I appreciate that this may be new to you, but it's pretty basic knowledge 
about how HTTP works.

Basic auth is simple, and you need to understand how it works to understand 
what I've been trying to say. Here's how HTTP auth works:

1) Browser hits page.
2) The PHP script knows this page requires HTTP Auth, checks the 
PHP_AUTH_[USER|PW] variables but doesn't find anything, so it responds with an 
HTTP status of 401 Unauthorised.
3) The browser gets the 401 response and displays the login box.
4) User enters username and password.
5) Browser sends the request again

Re: [PHP] Re: Permissions

2013-08-27 Thread Ethan Rosenberg


On 08/27/2013 03:07 AM, David Robley wrote:

Ashley Sheridan wrote:


On Tue, 2013-08-27 at 16:16 +0930, David Robley wrote:


Ethan Rosenberg wrote:


Dear List -

Tried to run the program, that we have been discussing, and received a
403 error.

rosenberg:/var/www# ls -la StoreInventory.php
-rwxrwxrw- 1 ethan ethan 4188 Aug 26 20:26 StoreInventory.php

rosenberg:/var# ls -ld www
drwxrwxrw- 37 ethan ethan 20480 Aug 26 20:26 www

I had set the S bit [probably a nasty mistake] and I thought I was able
to remove the bit. [it doesn't show above]

How do I extricate myself from the hole into which I have planted
myself?

TIA

Ethan


This is in no way a php question, as the same result will happen no
matter what you ask apache to serve from that directory.

You have the directory permissions set to 776 not 777.
--
Cheers
David Robley

Steal this tagline and I'll tie-dye your cat!





776 won't matter in the case of a directory, as the last bit is for the
eXecute permissions, which aren't applicable to a directory. What


I beg to differ here. If the x bit isn't set on a directory, that will
prevent scanning of the directory; in this case apache will be prevented
from scanning the directory and will return a 403.


It's possible that this is an SELinux issue, which adds an extra layer
of permissions over files. To see what those permissions are, use the -Z
flag for ls. Also, check the SELinux logs (assuming that it's running
and it is causing a problem) to see if it brings up anything. It's
typically found on RedHat-based distros.

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



I checked with the -Z option

ethan@rosenberg:/var/www$ ls -lZ StoreInventory.php
-rwxrwsr-t 1 ethan ethan ? 4232 Aug 27 00:18 StoreInventory.php

Ethan

PS David-

I promise that I will not steal your tag line.  My short hair American 
tabby cat [Gingy Feline Rosenberg]is too nice to have anything done to her.


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



Re: [PHP] Re: Permissions

2013-08-27 Thread Ethan Rosenberg


On 08/27/2013 01:52 PM, Ethan Rosenberg wrote:


On 08/27/2013 03:07 AM, David Robley wrote:

Ashley Sheridan wrote:


On Tue, 2013-08-27 at 16:16 +0930, David Robley wrote:


Ethan Rosenberg wrote:


Dear List -

Tried to run the program, that we have been discussing, and received a
403 error.

rosenberg:/var/www# ls -la StoreInventory.php
-rwxrwxrw- 1 ethan ethan 4188 Aug 26 20:26 StoreInventory.php

rosenberg:/var# ls -ld www
drwxrwxrw- 37 ethan ethan 20480 Aug 26 20:26 www

I had set the S bit [probably a nasty mistake] and I thought I was
able
to remove the bit. [it doesn't show above]

How do I extricate myself from the hole into which I have planted
myself?

TIA

Ethan


This is in no way a php question, as the same result will happen no
matter what you ask apache to serve from that directory.

You have the directory permissions set to 776 not 777.
--
Cheers
David Robley

Steal this tagline and I'll tie-dye your cat!





776 won't matter in the case of a directory, as the last bit is for the
eXecute permissions, which aren't applicable to a directory. What


I beg to differ here. If the x bit isn't set on a directory, that will
prevent scanning of the directory; in this case apache will be prevented
from scanning the directory and will return a 403.


It's possible that this is an SELinux issue, which adds an extra layer
of permissions over files. To see what those permissions are, use the -Z
flag for ls. Also, check the SELinux logs (assuming that it's running
and it is causing a problem) to see if it brings up anything. It's
typically found on RedHat-based distros.

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



I checked with the -Z option

ethan@rosenberg:/var/www$ ls -lZ StoreInventory.php
-rwxrwsr-t 1 ethan ethan ? 4232 Aug 27 00:18 StoreInventory.php

Ethan

PS David-

I promise that I will not steal your tag line.  My short hair American
tabby cat [Gingy Feline Rosenberg]is too nice to have anything done to her.

This has really morphed into a Debian issue.  I have sent it to the 
Debian list.  I will keep you informed.


Ethan

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



[PHP] Re: Permissions

2013-08-27 Thread Ethan Rosenberg


On 08/27/2013 03:31 PM, Steven Post wrote:

On Tue, 2013-08-27 at 13:43 -0400, Ethan Rosenberg wrote:

Dear List -

I apologize for this needle in a haystack  but...

This was originally posted on the PHP list, but has changed into a
Debian question...

Tried to run the program, that we have been discussing,{on the PHP list}
and received a 403 error.

rosenberg:/var/www# ls -la StoreInventory.php
-rwxrwxrw- 1 ethan ethan 4188 Aug 26 20:26 StoreInventory.php

rosenberg:/var# ls -ld www
drwxrwxrw- 37 ethan ethan 20480 Aug 26 20:26 www

I had set the S bit [probably a nasty mistake] and I thought I was able
to remove the bit. [it doesn't show above]

I made the following stupid mistakes...
note commands from the root prompt have a su appended

467  chown -R ethan:www-data wwwsu
469  chown -R ethan:www-data wwwsu
470  chmod -R g+s www   su
471  chgrp -R  www  su
477  chgrp -R ethan www su  
480  chmod -R 766 www   su
482  chmod g-S www  su
485  chmod -S www   su
486  chmod g S www  su
487  chmod gS www   su
488  chmod S wwwsu
489  chmod 776 www  su
492  chmod 776 -R www   su
494  chmod -s -R wwwsu
504  chmod 666 StoreInventory.php
512  chmod 3775 StoreInventory.php

I now have

ethan@rosenberg:/var/www$ ls -la StoreInventory.php
-rwxrwsr-t 1 ethan ethan 4232 Aug 27 00:18 StoreInventory.php

ethan@rosenberg:/var$ ls -ld www
drwxrwxrw- 37 ethan ethan 20480 Aug 26 20:26 www

and still have the 403 error.

How do I extricate myself from the hole into which I have planted myself?



The problem appears to be that Apache does not have access to the file.
Looking at the permissions of the file it should work, however, apache
is not able to go into your /var/www folder. Either you need to set
www-data as the owner of the directory, or as the group owner, or,
possibility number 3, give execute rights to 'others' on that folder.

Pick one (you might need to be root for the first 2 in your situation):
1) chown www-data /var/www
2) chgrp www-data /var/www
3) chmod -R o+X /var/www

Note the capital 'X' on option 3, this gives execute permissions on
folders only, not files, as the -R means all files and subdirectories as
well.

The 't' is known as the sticky bit if I recall correctly, set with 1 on
the first number in a 4 number chmod command, for details see [1].
I guess in your case you can use 0664 for the files and 0775 for
directories (or 0640 and 0750 if you set owner or group back to
www-data)

Best regards,
Steven



you wrote about a 403 error, so I assume you invoke the script by
calling a webserver via browser.
In that case the webserver needs the permission to access /var/www and
to read StoreInventory.php.

By default the webserver runs as user/group www-data (it can be changed
in the webservers config-file(s)).

Try this:

#chown -R ethan:www-data /var/www
#chmod 775 /var/www
#chmod 640 /var/www/StoreInventory.php

Your ls should return something like this:

$ls -hal /var/www
drwxr-x--- 1 ethan www-data 4.0K Jun 3 20:35 .
-rw-r- 1 ethan www-data 623 Jun 3 20:35 StoreInventory.php


If that does not work you might check the configuration- and log-files
of your webserver.

Dear List -

I had to go to a meeting but before I left I tried one last thing -

 chmod 000 www
 chmod 0777 www
rosenberg:/var# ls -ld www
drwxrwxrwx 37 ethan ethan 20480 Aug 27 17:30 www

 chown ethan StoreInventory.php
 chgrp ethan StoreInventory.php
 chmod 000 StoreInventory.php
 chmod 777 StoreInventory.php
ethan@rosenberg:/var/www$ ls -la StoreInventory.php
-rwxrwxrwx 1 ethan ethan 4232 Aug 27 17:25 StoreInventory.php

when I returned...

IT WORKS!!!

Thanks to all.

Ethan

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



php-general Digest 26 Aug 2013 18:41:27 -0000 Issue 8345

2013-08-26 Thread php-general-digest-help

php-general Digest 26 Aug 2013 18:41:27 - Issue 8345

Topics (messages 321966 through 321970):

Re: exec and system do not work
321966 by: Sorin Badea
321967 by: Robert Cummings
321968 by: Tamara Temple
321969 by: marco.behnke.biz
321970 by: Ethan Rosenberg

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---
*/var/www* is usually under *www* user. It may be a permissions problem.


On Mon, Aug 26, 2013 at 6:41 AM, Ethan Rosenberg 
erosenb...@hygeiabiomedical.com wrote:

 Dear List -

 I'm lost on this one -

 This works -

 $out = system(ls -l ,$retvals);
 printf(%s, $out);

 This does -

 echo exec(ls -l);

 This does not -

 if( !file_exists(/var/www/orders.**txt));
 {
$out = system(touch /var/www/orders.txt, $ret);
$out2 = system(chmod 766 /var/www/orders.txt, $ret);
echo 'file2br /';
echo file_exists(/var/www/orders.**txt);
 }

 and this does not -

 if( !file_exists(/var/www/orders.**txt));
 {
exec(touch /var/www/orders.txt);
exec(chmod 766 /var/www/orders.txt);
echo 'file2br /';
echo file_exists(/var/www/orders.**txt);
 }

 Ethan

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




-- 
Sorin Badea - Software Engineer
---End Message---
---BeginMessage---

On 13-08-25 11:41 PM, Ethan Rosenberg wrote:

Dear List -

I'm lost on this one -

This works -

$out = system(ls -l ,$retvals);
printf(%s, $out);

This does -

echo exec(ls -l);

This does not -

if( !file_exists(/var/www/orders.txt));
{
 $out = system(touch /var/www/orders.txt, $ret);
 $out2 = system(chmod 766 /var/www/orders.txt, $ret);
 echo 'file2br /';
 echo file_exists(/var/www/orders.txt);
}

and this does not -

if( !file_exists(/var/www/orders.txt));
{
 exec(touch /var/www/orders.txt);
 exec(chmod 766 /var/www/orders.txt);
 echo 'file2br /';
 echo file_exists(/var/www/orders.txt);
}

Ethan


Hi Ethan,

Is there a reason you're using shell commands to achieve the following:

?php

$path = '/var/www/orders.txt';
if( !file_exists( $path ) )
{
if( !touch( $path ) )
{
echo 'Failed to touch file into existence: '.$path.\n;
}
else
{
if( !chmod( $path, 0766 ) )
{
echo 'Failed to update file permissions: '.$path.\n;
}
}
}

?

Also, why are you setting the executable bit on a text file? :)

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.
---End Message---
---BeginMessage---

On Aug 25, 2013, at 10:41 PM, Ethan Rosenberg erosenb...@hygeiabiomedical.com 
wrote:

 Dear List -
 
 I'm lost on this one -
 
 This works -
 
 $out = system(ls -l ,$retvals);
 printf(%s, $out);
 
 This does -
 
 echo exec(ls -l);
 
 This does not -
 
 if( !file_exists(/var/www/orders.txt));
 {
   $out = system(touch /var/www/orders.txt, $ret);
   $out2 = system(chmod 766 /var/www/orders.txt, $ret);
   echo 'file2br /';
   echo file_exists(/var/www/orders.txt);
 }
 
 and this does not -
 
 if( !file_exists(/var/www/orders.txt));
 {
   exec(touch /var/www/orders.txt);
   exec(chmod 766 /var/www/orders.txt);
   echo 'file2br /';
   echo file_exists(/var/www/orders.txt);
 }
 
 Ethan
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

When you say does not work, can you show what is actually not working? I 
believe the exec and system functions are likely working just fine, but that 
the commands you've passed to them may not be.


---End Message---
---BeginMessage---


 Tamara Temple tamouse.li...@gmail.com hat am 26. August 2013 um 08:33
 geschrieben:



 On Aug 25, 2013, at 10:41 PM, Ethan Rosenberg
 erosenb...@hygeiabiomedical.com wrote:

  Dear List -
 
  I'm lost on this one -
 
  This works -
 
  $out = system(ls -l ,$retvals);
  printf(%s, $out);
 
  This does -
 
  echo exec(ls -l);

Please show the output of the directory listing.
Please us ls -la

 
  This does not -
 
  if( !file_exists(/var/www/orders.txt));
  {
    $out = system(touch /var/www/orders.txt, $ret);

Maybe you don't have write permissions on the folder?

    $out2 = system(chmod 766 /var/www/orders.txt, $ret);
    echo 'file2br /';
    echo file_exists(/var/www/orders.txt);
  }
 
  and this does not -
 
  if( !file_exists(/var/www/orders.txt));
  {
    exec(touch /var/www/orders.txt);
    exec(chmod 766 /var/www/orders.txt);
    echo

Re: [PHP] exec and system do not work

2013-08-26 Thread Robert Cummings

On 13-08-25 11:41 PM, Ethan Rosenberg wrote:

Dear List -

I'm lost on this one -

This works -

$out = system(ls -l ,$retvals);
printf(%s, $out);

This does -

echo exec(ls -l);

This does not -

if( !file_exists(/var/www/orders.txt));
{
 $out = system(touch /var/www/orders.txt, $ret);
 $out2 = system(chmod 766 /var/www/orders.txt, $ret);
 echo 'file2br /';
 echo file_exists(/var/www/orders.txt);
}

and this does not -

if( !file_exists(/var/www/orders.txt));
{
 exec(touch /var/www/orders.txt);
 exec(chmod 766 /var/www/orders.txt);
 echo 'file2br /';
 echo file_exists(/var/www/orders.txt);
}

Ethan


Hi Ethan,

Is there a reason you're using shell commands to achieve the following:

?php

$path = '/var/www/orders.txt';
if( !file_exists( $path ) )
{
if( !touch( $path ) )
{
echo 'Failed to touch file into existence: '.$path.\n;
}
else
{
if( !chmod( $path, 0766 ) )
{
echo 'Failed to update file permissions: '.$path.\n;
}
}
}

?

Also, why are you setting the executable bit on a text file? :)

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] exec and system do not work

2013-08-26 Thread Tamara Temple

On Aug 25, 2013, at 10:41 PM, Ethan Rosenberg erosenb...@hygeiabiomedical.com 
wrote:

 Dear List -
 
 I'm lost on this one -
 
 This works -
 
 $out = system(ls -l ,$retvals);
 printf(%s, $out);
 
 This does -
 
 echo exec(ls -l);
 
 This does not -
 
 if( !file_exists(/var/www/orders.txt));
 {
   $out = system(touch /var/www/orders.txt, $ret);
   $out2 = system(chmod 766 /var/www/orders.txt, $ret);
   echo 'file2br /';
   echo file_exists(/var/www/orders.txt);
 }
 
 and this does not -
 
 if( !file_exists(/var/www/orders.txt));
 {
   exec(touch /var/www/orders.txt);
   exec(chmod 766 /var/www/orders.txt);
   echo 'file2br /';
   echo file_exists(/var/www/orders.txt);
 }
 
 Ethan
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

When you say does not work, can you show what is actually not working? I 
believe the exec and system functions are likely working just fine, but that 
the commands you've passed to them may not be.



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



Re: [PHP] exec and system do not work

2013-08-26 Thread ma...@behnke.biz


 Tamara Temple tamouse.li...@gmail.com hat am 26. August 2013 um 08:33
 geschrieben:



 On Aug 25, 2013, at 10:41 PM, Ethan Rosenberg
 erosenb...@hygeiabiomedical.com wrote:

  Dear List -
 
  I'm lost on this one -
 
  This works -
 
  $out = system(ls -l ,$retvals);
  printf(%s, $out);
 
  This does -
 
  echo exec(ls -l);

Please show the output of the directory listing.
Please us ls -la

 
  This does not -
 
  if( !file_exists(/var/www/orders.txt));
  {
    $out = system(touch /var/www/orders.txt, $ret);

Maybe you don't have write permissions on the folder?

    $out2 = system(chmod 766 /var/www/orders.txt, $ret);
    echo 'file2br /';
    echo file_exists(/var/www/orders.txt);
  }
 
  and this does not -
 
  if( !file_exists(/var/www/orders.txt));
  {
    exec(touch /var/www/orders.txt);
    exec(chmod 766 /var/www/orders.txt);
    echo 'file2br /';
    echo file_exists(/var/www/orders.txt);
  }
 
  Ethan
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 

 When you say does not work, can you show what is actually not working? I
 believe the exec and system functions are likely working just fine, but that
 the commands you've passed to them may not be.



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


--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] exec and system do not work

2013-08-26 Thread Ethan Rosenberg


On 08/26/2013 11:36 AM, ma...@behnke.biz wrote:




Tamara Temple tamouse.li...@gmail.com hat am 26. August 2013 um 08:33
geschrieben:



On Aug 25, 2013, at 10:41 PM, Ethan Rosenberg
erosenb...@hygeiabiomedical.com wrote:


Dear List -

I'm lost on this one -

This works -

$out = system(ls -l ,$retvals);
printf(%s, $out);

This does -

echo exec(ls -l);


Please show the output of the directory listing.
Please us ls -la



This does not -

if( !file_exists(/var/www/orders.txt));
{
$out = system(touch /var/www/orders.txt, $ret);


Maybe you don't have write permissions on the folder?


$out2 = system(chmod 766 /var/www/orders.txt, $ret);
echo 'file2br /';
echo file_exists(/var/www/orders.txt);
}

and this does not -

if( !file_exists(/var/www/orders.txt));
{
exec(touch /var/www/orders.txt);
exec(chmod 766 /var/www/orders.txt);
echo 'file2br /';
echo file_exists(/var/www/orders.txt);
}

Ethan




When you say does not work, can you show what is actually not working? I
believe the exec and system functions are likely working just fine, but that
the commands you've passed to them may not be.




--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz



Tamara -

 Please show the output of the directory listing.
 Please us ls -la

echo exec('ls -la orders.txt');

-rw-rw-rw- 1 ethan ethan 43 Aug 25 23:50 orders.txt


Maybe you don't have write permissions on the folder?

If I perform the touch and chmod from the command line, everything works.


 When you say does not work, can you show what is actually not 
working? I
 believe the exec and system functions are likely working just fine, 
but that

 the commands you've passed to them may not be.

Here are my commands.

if( !file_exists(/var/www/orders.txt));
{
echo system(touch /var/www/orders.txt, $ret);
echo system(chmod 766 /var/www/orders.txt, $ret);
echo 'file2br /';
echo file_exists(/var/www/orders.txt);
}

If I now try a ls from the command line, the return is
 cannot access /var/www/orders.txt: No such file or directory

The ls -la  works because the file was created from the command line.

TIA

Ethan






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



Re: [PHP] exec and system do not work

2013-08-26 Thread Jim Giner

On 8/26/2013 2:41 PM, Ethan Rosenberg wrote:


On 08/26/2013 11:36 AM, ma...@behnke.biz wrote:




Tamara Temple tamouse.li...@gmail.com hat am 26. August 2013 um 08:33
geschrieben:



On Aug 25, 2013, at 10:41 PM, Ethan Rosenberg
erosenb...@hygeiabiomedical.com wrote:


Dear List -

I'm lost on this one -

This works -

$out = system(ls -l ,$retvals);
printf(%s, $out);

This does -

echo exec(ls -l);


Please show the output of the directory listing.
Please us ls -la



This does not -

if( !file_exists(/var/www/orders.txt));
{
$out = system(touch /var/www/orders.txt, $ret);


Maybe you don't have write permissions on the folder?


$out2 = system(chmod 766 /var/www/orders.txt, $ret);
echo 'file2br /';
echo file_exists(/var/www/orders.txt);
}

and this does not -

if( !file_exists(/var/www/orders.txt));
{
exec(touch /var/www/orders.txt);
exec(chmod 766 /var/www/orders.txt);
echo 'file2br /';
echo file_exists(/var/www/orders.txt);
}

Ethan




When you say does not work, can you show what is actually not
working? I
believe the exec and system functions are likely working just fine,
but that
the commands you've passed to them may not be.




--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz



Tamara -

  Please show the output of the directory listing.
  Please us ls -la

echo exec('ls -la orders.txt');

-rw-rw-rw- 1 ethan ethan 43 Aug 25 23:50 orders.txt


Maybe you don't have write permissions on the folder?

If I perform the touch and chmod from the command line, everything works.


  When you say does not work, can you show what is actually not
working? I
  believe the exec and system functions are likely working just fine,
but that
  the commands you've passed to them may not be.

Here are my commands.

if( !file_exists(/var/www/orders.txt));
{
echo system(touch /var/www/orders.txt, $ret);
echo system(chmod 766 /var/www/orders.txt, $ret);
echo 'file2br /';
echo file_exists(/var/www/orders.txt);
}

If I now try a ls from the command line, the return is
  cannot access /var/www/orders.txt: No such file or directory

The ls -la  works because the file was created from the command line.

TIA

Ethan






Ethan - YOU'RE DOING IT AGAIN!!!

Either you are not using error checking AGAIN!!
OR
You are showing us re-typed in code that YOU DIDNT ACTUALLY RUN.

I've told you multiple times that you need to do these two things and 
you are back at it again.


The sample php above has plain simple syntax errors that would keep it 
from running, which error checking would tell you IF YOU RAN IT.


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



[PHP] How to send post-variables in a Location header

2013-08-26 Thread Ajay Garg
Hi all.

I have a scenario, wherein I need to do something like this ::

###
$original_url = /autologin.php;
$username = ajay;
$password = garg;

header('Location: ' . $original_url);
###

As can be seen, I wish to redirect to the URL autologin.php.

Additionally, I wish to pass two POST key-value pairs :: user=ajay and
password=garg (I understand that passing GET key-value pairs is trivial).

Is it  even possible?
If yes, I will be grateful if someone could let me know how to redirect to
a URL, passing the POST key-value pairs as necessary.


Looking forward to a reply :)


-- 
Regards,
Ajay


Re: [PHP] exec and system do not work

2013-08-26 Thread ma...@behnke.biz


 Ethan Rosenberg erosenb...@hygeiabiomedical.com hat am 26. August 2013 um
 20:41 geschrieben:


   Please show the output of the directory listing.
   Please us ls -la

 echo exec('ls -la orders.txt');

 -rw-rw-rw- 1 ethan ethan 43 Aug 25 23:50 orders.txt

Please supply the complete output. Especially the rights for . and ..

 Maybe you don't have write permissions on the folder?

 If I perform the touch and chmod from the command line, everything works.

cli and ww are different users.

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



Re: [PHP] How to send post-variables in a Location header

2013-08-26 Thread ma...@behnke.biz


 Ajay Garg ajaygargn...@gmail.com hat am 26. August 2013 um 21:48
 geschrieben:


 Hi all.

 I have a scenario, wherein I need to do something like this ::

 ###
         $original_url = /autologin.php;
         $username = ajay;
         $password = garg;

         header('Location: ' . $original_url);
 ###

 As can be seen, I wish to redirect to the URL autologin.php.

 Additionally, I wish to pass two POST key-value pairs :: user=ajay and
 password=garg (I understand that passing GET key-value pairs is trivial).

 Is it  even possible?
 If yes, I will be grateful if someone could let me know how to redirect to
 a URL, passing the POST key-value pairs as necessary.

Iirc it is not possible to pass post body content via location redirect.
What you can do: Set auth headers

http://forums.phpfreaks.com/topic/84480-solved-how-to-send-authorization-basic-header/



 Looking forward to a reply :)


 --
 Regards,
 Ajay

--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] How to send post-variables in a Location header

2013-08-26 Thread Matijn Woudt
On Mon, Aug 26, 2013 at 9:48 PM, Ajay Garg ajaygargn...@gmail.com wrote:

 Hi all.

 I have a scenario, wherein I need to do something like this ::

 ###
 $original_url = /autologin.php;
 $username = ajay;
 $password = garg;

 header('Location: ' . $original_url);
 ###

 As can be seen, I wish to redirect to the URL autologin.php.

 Additionally, I wish to pass two POST key-value pairs :: user=ajay and
 password=garg (I understand that passing GET key-value pairs is trivial).

 Is it  even possible?
 If yes, I will be grateful if someone could let me know how to redirect to
 a URL, passing the POST key-value pairs as necessary.


 Looking forward to a reply :)


Usually you would pass this around in sessions. If you must however use
post, you can only do so with using some javascript magic. Write a form
with hidden input and auto submit it.

- Matijn


Re: [PHP] exec and system do not work

2013-08-26 Thread Tamara Temple

On Aug 26, 2013, at 1:41 PM, Ethan Rosenberg erosenb...@hygeiabiomedical.com 
wrote:
 On 08/26/2013 11:36 AM, ma...@behnke.biz wrote:
 Tamara Temple tamouse.li...@gmail.com hat am 26. August 2013 um 08:33
 geschrieben:
 
 
 
 On Aug 25, 2013, at 10:41 PM, Ethan Rosenberg
 erosenb...@hygeiabiomedical.com wrote:
 
 Dear List -
 
 I'm lost on this one -
 
 This works -
 
 $out = system(ls -l ,$retvals);
 printf(%s, $out);
 
 This does -
 
 echo exec(ls -l);
 
 Please show the output of the directory listing.
 Please us ls -la
 
 
 This does not -
 
 if( !file_exists(/var/www/orders.txt));
 {
$out = system(touch /var/www/orders.txt, $ret);
 
 Maybe you don't have write permissions on the folder?
 
$out2 = system(chmod 766 /var/www/orders.txt, $ret);
echo 'file2br /';
echo file_exists(/var/www/orders.txt);
 }
 
 and this does not -
 
 if( !file_exists(/var/www/orders.txt));
 {
exec(touch /var/www/orders.txt);
exec(chmod 766 /var/www/orders.txt);
echo 'file2br /';
echo file_exists(/var/www/orders.txt);
 }
 
 Ethan
 
 
 
 When you say does not work, can you show what is actually not working? I
 believe the exec and system functions are likely working just fine, but that
 the commands you've passed to them may not be.
 
 
 
 --
 Marco Behnke
 Dipl. Informatiker (FH), SAE Audio Engineer Diploma
 Zend Certified Engineer PHP 5.3
 
 Tel.: 0174 / 9722336
 e-Mail: ma...@behnke.biz
 
 Softwaretechnik Behnke
 Heinrich-Heine-Str. 7D
 21218 Seevetal
 
 http://www.behnke.biz
 
 
 Tamara -

You're replying to me about something someone else asked you.

 
  Please show the output of the directory listing.
  Please us ls -la
 
 echo exec('ls -la orders.txt');
 
 -rw-rw-rw- 1 ethan ethan 43 Aug 25 23:50 orders.txt
 
 
 Maybe you don't have write permissions on the folder?
 
 If I perform the touch and chmod from the command line, everything works.
 
 
  When you say does not work, can you show what is actually not working? I
  believe the exec and system functions are likely working just fine, but 
  that
  the commands you've passed to them may not be.
 
 Here are my commands.
 
 if( !file_exists(/var/www/orders.txt));
 {
 echo system(touch /var/www/orders.txt, $ret);
 echo system(chmod 766 /var/www/orders.txt, $ret);
 echo 'file2br /';
 echo file_exists(/var/www/orders.txt);
 }
 
 If I now try a ls from the command line, the return is
 cannot access /var/www/orders.txt: No such file or directory
 
 The ls -la  works because the file was created from the command line.
 
 TIA
 
 Ethan
 
 
 
 
 
 
 -- 
 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] How to send post-variables in a Location header

2013-08-26 Thread Tamara Temple

On Aug 26, 2013, at 2:48 PM, Ajay Garg ajaygargn...@gmail.com wrote:
 Hi all.
 
 I have a scenario, wherein I need to do something like this ::
 
 ###
$original_url = /autologin.php;
$username = ajay;
$password = garg;
 
header('Location: ' . $original_url);
 ###
 
 As can be seen, I wish to redirect to the URL autologin.php.
 
 Additionally, I wish to pass two POST key-value pairs :: user=ajay and
 password=garg (I understand that passing GET key-value pairs is trivial).
 
 Is it  even possible?
 If yes, I will be grateful if someone could let me know how to redirect to
 a URL, passing the POST key-value pairs as necessary.
 
 
 Looking forward to a reply :)

Since this seems that it will not work, I'm wondering if you could take a step 
back for us and say what is it you're hoping to accomplish by this. Maybe 
there's a better way to get you what you need that is possible, and also will 
be good PHP. Describe your scenario in higher level terms, not how you'd 
implement it, but what the outcome you need is, and what the design goal is for 
the user.


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



Re: [PHP] exec and system do not work

2013-08-26 Thread Ethan Rosenberg, PhD


On 08/26/2013 03:28 PM, Jim Giner wrote:

On 8/26/2013 2:41 PM, Ethan Rosenberg wrote:


On 08/26/2013 11:36 AM, ma...@behnke.biz wrote:




Tamara Temple tamouse.li...@gmail.com hat am 26. August 2013 um 08:33
geschrieben:



On Aug 25, 2013, at 10:41 PM, Ethan Rosenberg
erosenb...@hygeiabiomedical.com wrote:


Dear List -

I'm lost on this one -

This works -

$out = system(ls -l ,$retvals);
printf(%s, $out);

This does -

echo exec(ls -l);


Please show the output of the directory listing.
Please us ls -la



This does not -

if( !file_exists(/var/www/orders.txt));
{
$out = system(touch /var/www/orders.txt, $ret);


Maybe you don't have write permissions on the folder?


$out2 = system(chmod 766 /var/www/orders.txt, $ret);
echo 'file2br /';
echo file_exists(/var/www/orders.txt);
}

and this does not -

if( !file_exists(/var/www/orders.txt));
{
exec(touch /var/www/orders.txt);
exec(chmod 766 /var/www/orders.txt);
echo 'file2br /';
echo file_exists(/var/www/orders.txt);
}

Ethan




When you say does not work, can you show what is actually not
working? I
believe the exec and system functions are likely working just fine,
but that
the commands you've passed to them may not be.




--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz



Tamara -

  Please show the output of the directory listing.
  Please us ls -la

echo exec('ls -la orders.txt');

-rw-rw-rw- 1 ethan ethan 43 Aug 25 23:50 orders.txt


Maybe you don't have write permissions on the folder?

If I perform the touch and chmod from the command line, everything works.


  When you say does not work, can you show what is actually not
working? I
  believe the exec and system functions are likely working just fine,
but that
  the commands you've passed to them may not be.

Here are my commands.

if( !file_exists(/var/www/orders.txt));
{
echo system(touch /var/www/orders.txt, $ret);
echo system(chmod 766 /var/www/orders.txt, $ret);
echo 'file2br /';
echo file_exists(/var/www/orders.txt);
}

If I now try a ls from the command line, the return is
  cannot access /var/www/orders.txt: No such file or directory

The ls -la  works because the file was created from the command line.

TIA

Ethan






Ethan - YOU'RE DOING IT AGAIN!!!

Either you are not using error checking AGAIN!!
OR
You are showing us re-typed in code that YOU DIDNT ACTUALLY RUN.

I've told you multiple times that you need to do these two things and
you are back at it again.

The sample php above has plain simple syntax errors that would keep it
from running, which error checking would tell you IF YOU RAN IT.



Jim -

Thank you.

I don't totally understand your reply ...

but I will try to answer

The code is taken from an operating program.  My error checking is set 
to maximum sensitivity.


If you would point out my syntax errors, I will fix them.

TIA

Ethan


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



[PHP] Re: exec and system do not work

2013-08-26 Thread Tim Streater
On 26 Aug 2013 at 22:01, PhD Ethan Rosenberg erosenb...@hygeiabiomedical.com 
wrote: 

 if( !file_exists(/var/www/orders.txt));

^
|
What's the semicolon doing there ---+

 {
 echo system(touch /var/www/orders.txt, $ret);
 echo system(chmod 766 /var/www/orders.txt, $ret);
 echo 'file2br /';
 echo file_exists(/var/www/orders.txt);
 }

 If you would point out my syntax errors, I will fix them.

See above.

--
Cheers  --  Tim

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

Re: [PHP] exec and system do not work

2013-08-26 Thread David Robley
Ethan Rosenberg wrote:

 
 On 08/26/2013 11:36 AM, ma...@behnke.biz wrote:


 Tamara Temple tamouse.li...@gmail.com hat am 26. August 2013 um 08:33
 geschrieben:



 On Aug 25, 2013, at 10:41 PM, Ethan Rosenberg
 erosenb...@hygeiabiomedical.com wrote:

 Dear List -

 I'm lost on this one -

 This works -

 $out = system(ls -l ,$retvals);
 printf(%s, $out);

 This does -

 echo exec(ls -l);

 Please show the output of the directory listing.
 Please us ls -la


 This does not -

 if( !file_exists(/var/www/orders.txt));
 {
 $out = system(touch /var/www/orders.txt, $ret);

 Maybe you don't have write permissions on the folder?

 $out2 = system(chmod 766 /var/www/orders.txt, $ret);
 echo 'file2br /';
 echo file_exists(/var/www/orders.txt);
 }

 and this does not -

 if( !file_exists(/var/www/orders.txt));
 {
 exec(touch /var/www/orders.txt);
 exec(chmod 766 /var/www/orders.txt);
 echo 'file2br /';
 echo file_exists(/var/www/orders.txt);
 }

 Ethan



 When you say does not work, can you show what is actually not working?
 I believe the exec and system functions are likely working just fine,
 but that the commands you've passed to them may not be.



 --
 Marco Behnke
 Dipl. Informatiker (FH), SAE Audio Engineer Diploma
 Zend Certified Engineer PHP 5.3

 Tel.: 0174 / 9722336
 e-Mail: ma...@behnke.biz

 Softwaretechnik Behnke
 Heinrich-Heine-Str. 7D
 21218 Seevetal

 http://www.behnke.biz

 
 Tamara -
 
   Please show the output of the directory listing.
   Please us ls -la
 
 echo exec('ls -la orders.txt');
 
 -rw-rw-rw- 1 ethan ethan 43 Aug 25 23:50 orders.txt
 
 
 Maybe you don't have write permissions on the folder?
 
 If I perform the touch and chmod from the command line, everything works.
 
 
   When you say does not work, can you show what is actually not
 working? I
   believe the exec and system functions are likely working just fine,
 but that
   the commands you've passed to them may not be.
 
 Here are my commands.
 
 if( !file_exists(/var/www/orders.txt));
 {
 echo system(touch /var/www/orders.txt, $ret);
 echo system(chmod 766 /var/www/orders.txt, $ret);
 echo 'file2br /';
 echo file_exists(/var/www/orders.txt);
 }
 
 If I now try a ls from the command line, the return is
   cannot access /var/www/orders.txt: No such file or directory
 
 The ls -la  works because the file was created from the command line.
 
 TIA
 
 Ethan

Note that touch and chmod don't return any output, so echoing the result of 
a system call for those commands will give an empty string.

You should be checking the values of $ret for each execution of system to 
see whether the command was successful or not - the return status of the 
executed command will be written to this variable. I'd guess that touch is 
returning 13 - permission denied.

if( !file_exists(/var/www/orders.txt))
{
  system(touch /var/www/orders.txt, $ret1);
  echo 'touch returned '.$ret1.'br /';
  system(chmod 766 /var/www/orders.txt, $ret2);
  echo 'chmod returned ' .$ret2.'br /';
  echo 'file2br /';
echo file_exists(/var/www/orders.txt); }

Check the permissions for directory /var/www; you'll probably find it is 
writable by the user you log on as, but not by the user that apache/php runs 
as, which is often www - a user with limited privileges.

As other(s) have pointed out, there are php functions to do what you want 
without introducing the possible insecurities involved with system et al.

-- 
Cheers
David Robley

Don't try to pull the wool over my eyes, Tom said sheepishly.


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



Re: [PHP] exec and system do not work

2013-08-26 Thread Ethan Rosenberg, PhD



Ethan Rosenberg, PhD
/Pres/CEO/
*Hygeia Biomedical Research, Inc*
2 Cameo Ridge Road
Monsey, NY 10952
T: 845 352-3908
F: 845 352-7566
erosenb...@hygeiabiomedical.com

On 08/26/2013 07:33 PM, David Robley wrote:

Ethan Rosenberg wrote:



On 08/26/2013 11:36 AM, ma...@behnke.biz wrote:




Tamara Temple tamouse.li...@gmail.com hat am 26. August 2013 um 08:33
geschrieben:



On Aug 25, 2013, at 10:41 PM, Ethan Rosenberg
erosenb...@hygeiabiomedical.com wrote:


Dear List -

I'm lost on this one -

This works -

$out = system(ls -l ,$retvals);
printf(%s, $out);

This does -

echo exec(ls -l);


Please show the output of the directory listing.
Please us ls -la



This does not -

if( !file_exists(/var/www/orders.txt));
{
 $out = system(touch /var/www/orders.txt, $ret);


Maybe you don't have write permissions on the folder?


 $out2 = system(chmod 766 /var/www/orders.txt, $ret);
 echo 'file2br /';
 echo file_exists(/var/www/orders.txt);
}

and this does not -

if( !file_exists(/var/www/orders.txt));
{
 exec(touch /var/www/orders.txt);
 exec(chmod 766 /var/www/orders.txt);
 echo 'file2br /';
 echo file_exists(/var/www/orders.txt);
}

Ethan




When you say does not work, can you show what is actually not working?
I believe the exec and system functions are likely working just fine,
but that the commands you've passed to them may not be.




--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz



Tamara -

   Please show the output of the directory listing.
   Please us ls -la

echo exec('ls -la orders.txt');

-rw-rw-rw- 1 ethan ethan 43 Aug 25 23:50 orders.txt


Maybe you don't have write permissions on the folder?

If I perform the touch and chmod from the command line, everything works.


   When you say does not work, can you show what is actually not
working? I
   believe the exec and system functions are likely working just fine,
but that
   the commands you've passed to them may not be.

Here are my commands.

if( !file_exists(/var/www/orders.txt));
{
echo system(touch /var/www/orders.txt, $ret);
echo system(chmod 766 /var/www/orders.txt, $ret);
echo 'file2br /';
echo file_exists(/var/www/orders.txt);
}

If I now try a ls from the command line, the return is
   cannot access /var/www/orders.txt: No such file or directory

The ls -la  works because the file was created from the command line.

TIA

Ethan


Note that touch and chmod don't return any output, so echoing the result of
a system call for those commands will give an empty string.

You should be checking the values of $ret for each execution of system to
see whether the command was successful or not - the return status of the
executed command will be written to this variable. I'd guess that touch is
returning 13 - permission denied.

if( !file_exists(/var/www/orders.txt))
{
   system(touch /var/www/orders.txt, $ret1);
   echo 'touch returned '.$ret1.'br /';
   system(chmod 766 /var/www/orders.txt, $ret2);
   echo 'chmod returned ' .$ret2.'br /';
   echo 'file2br /';
echo file_exists(/var/www/orders.txt); }

Check the permissions for directory /var/www; you'll probably find it is
writable by the user you log on as, but not by the user that apache/php runs
as, which is often www - a user with limited privileges.

As other(s) have pointed out, there are php functions to do what you want
without introducing the possible insecurities involved with system et al.



David -

touch returned 1
 /chmod returned 1

rosenberg:/var/www# ls orders.txt
ls: cannot access orders.txt: No such file or directory

rosenberg:/var# ls -ld www
drwxr-xr-x 37 ethan ethan 20480 Aug 26 20:15 www

TIA

Ethan

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



Re: [PHP] exec and system do not work

2013-08-26 Thread Jasper Kips
Ethan,
A return code of not 0 means an error occured.
Probably /var/www is not writable. Test that one by doing this:
$a = is_writable(/var/www);
var_dump($a);
If that says anything else than (boolean) TRUE, you can't write in the 
directory. 


Sincerely,

Jasper Kips


Op 27 aug. 2013, om 02:32 heeft Ethan Rosenberg, PhD 
erosenb...@hygeiabiomedical.com het volgende geschreven:

 
 
 Ethan Rosenberg, PhD
 /Pres/CEO/
 *Hygeia Biomedical Research, Inc*
 2 Cameo Ridge Road
 Monsey, NY 10952
 T: 845 352-3908
 F: 845 352-7566
 erosenb...@hygeiabiomedical.com
 
 On 08/26/2013 07:33 PM, David Robley wrote:
 Ethan Rosenberg wrote:
 
 
 On 08/26/2013 11:36 AM, ma...@behnke.biz wrote:
 
 
 Tamara Temple tamouse.li...@gmail.com hat am 26. August 2013 um 08:33
 geschrieben:
 
 
 
 On Aug 25, 2013, at 10:41 PM, Ethan Rosenberg
 erosenb...@hygeiabiomedical.com wrote:
 
 Dear List -
 
 I'm lost on this one -
 
 This works -
 
 $out = system(ls -l ,$retvals);
 printf(%s, $out);
 
 This does -
 
 echo exec(ls -l);
 
 Please show the output of the directory listing.
 Please us ls -la
 
 
 This does not -
 
 if( !file_exists(/var/www/orders.txt));
 {
 $out = system(touch /var/www/orders.txt, $ret);
 
 Maybe you don't have write permissions on the folder?
 
 $out2 = system(chmod 766 /var/www/orders.txt, $ret);
 echo 'file2br /';
 echo file_exists(/var/www/orders.txt);
 }
 
 and this does not -
 
 if( !file_exists(/var/www/orders.txt));
 {
 exec(touch /var/www/orders.txt);
 exec(chmod 766 /var/www/orders.txt);
 echo 'file2br /';
 echo file_exists(/var/www/orders.txt);
 }
 
 Ethan
 
 
 
 When you say does not work, can you show what is actually not working?
 I believe the exec and system functions are likely working just fine,
 but that the commands you've passed to them may not be.
 
 
 
 --
 Marco Behnke
 Dipl. Informatiker (FH), SAE Audio Engineer Diploma
 Zend Certified Engineer PHP 5.3
 
 Tel.: 0174 / 9722336
 e-Mail: ma...@behnke.biz
 
 Softwaretechnik Behnke
 Heinrich-Heine-Str. 7D
 21218 Seevetal
 
 http://www.behnke.biz
 
 
 Tamara -
 
   Please show the output of the directory listing.
   Please us ls -la
 
 echo exec('ls -la orders.txt');
 
 -rw-rw-rw- 1 ethan ethan 43 Aug 25 23:50 orders.txt
 
 
 Maybe you don't have write permissions on the folder?
 
 If I perform the touch and chmod from the command line, everything works.
 
 
   When you say does not work, can you show what is actually not
 working? I
   believe the exec and system functions are likely working just fine,
 but that
   the commands you've passed to them may not be.
 
 Here are my commands.
 
 if( !file_exists(/var/www/orders.txt));
 {
 echo system(touch /var/www/orders.txt, $ret);
 echo system(chmod 766 /var/www/orders.txt, $ret);
 echo 'file2br /';
 echo file_exists(/var/www/orders.txt);
 }
 
 If I now try a ls from the command line, the return is
   cannot access /var/www/orders.txt: No such file or directory
 
 The ls -la  works because the file was created from the command line.
 
 TIA
 
 Ethan
 
 Note that touch and chmod don't return any output, so echoing the result of
 a system call for those commands will give an empty string.
 
 You should be checking the values of $ret for each execution of system to
 see whether the command was successful or not - the return status of the
 executed command will be written to this variable. I'd guess that touch is
 returning 13 - permission denied.
 
 if( !file_exists(/var/www/orders.txt))
 {
   system(touch /var/www/orders.txt, $ret1);
   echo 'touch returned '.$ret1.'br /';
   system(chmod 766 /var/www/orders.txt, $ret2);
   echo 'chmod returned ' .$ret2.'br /';
   echo 'file2br /';
 echo file_exists(/var/www/orders.txt); }
 
 Check the permissions for directory /var/www; you'll probably find it is
 writable by the user you log on as, but not by the user that apache/php runs
 as, which is often www - a user with limited privileges.
 
 As other(s) have pointed out, there are php functions to do what you want
 without introducing the possible insecurities involved with system et al.
 
 
 David -
 
 touch returned 1
 /chmod returned 1
 
 rosenberg:/var/www# ls orders.txt
 ls: cannot access orders.txt: No such file or directory
 
 rosenberg:/var# ls -ld www
 drwxr-xr-x 37 ethan ethan 20480 Aug 26 20:15 www
 
 TIA
 
 Ethan
 
 -- 
 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] exec and system do not work

2013-08-26 Thread David Robley
Ethan Rosenberg, PhD wrote:

 
 
 Ethan Rosenberg, PhD
 /Pres/CEO/
 *Hygeia Biomedical Research, Inc*
 2 Cameo Ridge Road
 Monsey, NY 10952
 T: 845 352-3908
 F: 845 352-7566
 erosenb...@hygeiabiomedical.com
 
 On 08/26/2013 07:33 PM, David Robley wrote:
 Ethan Rosenberg wrote:


 On 08/26/2013 11:36 AM, ma...@behnke.biz wrote:


 Tamara Temple tamouse.li...@gmail.com hat am 26. August 2013 um
 08:33 geschrieben:



 On Aug 25, 2013, at 10:41 PM, Ethan Rosenberg
 erosenb...@hygeiabiomedical.com wrote:

 Dear List -

 I'm lost on this one -

 This works -

 $out = system(ls -l ,$retvals);
 printf(%s, $out);

 This does -

 echo exec(ls -l);

 Please show the output of the directory listing.
 Please us ls -la


 This does not -

 if( !file_exists(/var/www/orders.txt));
 {
  $out = system(touch /var/www/orders.txt, $ret);

 Maybe you don't have write permissions on the folder?

  $out2 = system(chmod 766 /var/www/orders.txt, $ret);
  echo 'file2br /';
  echo file_exists(/var/www/orders.txt);
 }

 and this does not -

 if( !file_exists(/var/www/orders.txt));
 {
  exec(touch /var/www/orders.txt);
  exec(chmod 766 /var/www/orders.txt);
  echo 'file2br /';
  echo file_exists(/var/www/orders.txt);
 }

 Ethan



 When you say does not work, can you show what is actually not
 working? I believe the exec and system functions are likely working
 just fine, but that the commands you've passed to them may not be.



 --
 Marco Behnke
 Dipl. Informatiker (FH), SAE Audio Engineer Diploma
 Zend Certified Engineer PHP 5.3

 Tel.: 0174 / 9722336
 e-Mail: ma...@behnke.biz

 Softwaretechnik Behnke
 Heinrich-Heine-Str. 7D
 21218 Seevetal

 http://www.behnke.biz


 Tamara -

Please show the output of the directory listing.
Please us ls -la

 echo exec('ls -la orders.txt');

 -rw-rw-rw- 1 ethan ethan 43 Aug 25 23:50 orders.txt


 Maybe you don't have write permissions on the folder?

 If I perform the touch and chmod from the command line, everything
 works.


When you say does not work, can you show what is actually not
 working? I
believe the exec and system functions are likely working just fine,
 but that
the commands you've passed to them may not be.

 Here are my commands.

 if( !file_exists(/var/www/orders.txt));
 {
 echo system(touch /var/www/orders.txt, $ret);
 echo system(chmod 766 /var/www/orders.txt, $ret);
 echo 'file2br /';
 echo file_exists(/var/www/orders.txt);
 }

 If I now try a ls from the command line, the return is
cannot access /var/www/orders.txt: No such file or directory

 The ls -la  works because the file was created from the command line.

 TIA

 Ethan

 Note that touch and chmod don't return any output, so echoing the result
 of a system call for those commands will give an empty string.

 You should be checking the values of $ret for each execution of system to
 see whether the command was successful or not - the return status of the
 executed command will be written to this variable. I'd guess that touch
 is returning 13 - permission denied.

 if( !file_exists(/var/www/orders.txt))
 {
system(touch /var/www/orders.txt, $ret1);
echo 'touch returned '.$ret1.'br /';
system(chmod 766 /var/www/orders.txt, $ret2);
echo 'chmod returned ' .$ret2.'br /';
echo 'file2br /';
 echo file_exists(/var/www/orders.txt); }

 Check the permissions for directory /var/www; you'll probably find it is
 writable by the user you log on as, but not by the user that apache/php
 runs as, which is often www - a user with limited privileges.

 As other(s) have pointed out, there are php functions to do what you want
 without introducing the possible insecurities involved with system et al.

 
 David -
 
 touch returned 1
   /chmod returned 1
 

Non-zero return value indicates an error; touch failed and as a result there 
is no file to chmod, hence chmod also failed.

 rosenberg:/var/www# ls orders.txt
 ls: cannot access orders.txt: No such file or directory
 
 rosenberg:/var# ls -ld www
 drwxr-xr-x 37 ethan ethan 20480 Aug 26 20:15 www

/var/www is only writeable by the user ethan
-- 
Cheers
David Robley

INTERLACE: To tie two boots together.


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



[PHP] Permissions

2013-08-26 Thread Ethan Rosenberg

Dear List -

Tried to run the program, that we have been discussing, and received a 
403 error.


rosenberg:/var/www# ls -la StoreInventory.php
-rwxrwxrw- 1 ethan ethan 4188 Aug 26 20:26 StoreInventory.php

rosenberg:/var# ls -ld www
drwxrwxrw- 37 ethan ethan 20480 Aug 26 20:26 www

I had set the S bit [probably a nasty mistake] and I thought I was able 
to remove the bit. [it doesn't show above]


How do I extricate myself from the hole into which I have planted myself?

TIA

Ethan




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



php-general Digest 25 Aug 2013 09:31:34 -0000 Issue 8343

2013-08-25 Thread php-general-digest-help

php-general Digest 25 Aug 2013 09:31:34 - Issue 8343

Topics (messages 321960 through 321964):

Re: Alternate list for eclipse ide support?
321960 by: Sebastian Krebs
321961 by: Lester Caine
321962 by: Sebastian Krebs
321963 by: Lester Caine

PHP-5.5.2 +opcache segfaults with Piwik
321964 by: Grant

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---
2013/8/24 Lester Caine les...@lsces.co.uk

 With composer being pushed as the 'in way to go' and not being able to see
 how to get some code relating to bootstrap and smarty development because
 the links only show composer I've downloaded a plug-in for eclipse that is
 supposed to handle that. But it's not working as I expect, and while
 heading over to the plug-ins developers is the obvious step, what I'd
 actually prefer is a more general PHP/Eclipse list to discuss general IDE
 problems rather than even PDT biased discussions.

 Is there a suitable list? And if not is there any interest in setting one
 up? ... at the risk of proliferating even more lists ...


Hi,

I for myself switched over to PhpStorm from Eclipse/PDT and I fear meany
hear use either PhpStorm, or Netbeans in the meantime. I'm not saying, that
nobody is using Eclipse/PDT anymore, but I fear you wont find much interest
here.

Regards,
Sebastian



 --
 Lester Caine - G8HFL
 -
 Contact - 
 http://lsces.co.uk/wiki/?page=**contacthttp://lsces.co.uk/wiki/?page=contact
 L.S.Caine Electronic Services - http://lsces.co.uk
 EnquirySolve - http://enquirysolve.com/
 Model Engineers Digital Workshop - http://medw.co.uk
 Rainbow Digital Media - 
 http://rainbowdigitalmedia.co.**ukhttp://rainbowdigitalmedia.co.uk

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




-- 
github.com/KingCrunch
---End Message---
---BeginMessage---

Sebastian Krebs wrote:

With composer being pushed as the 'in way to go' and not being able to see
how to get some code relating to bootstrap and smarty development because
the links only show composer I've downloaded a plug-in for eclipse that is
supposed to handle that. But it's not working as I expect, and while
heading over to the plug-ins developers is the obvious step, what I'd
actually prefer is a more general PHP/Eclipse list to discuss general IDE
problems rather than even PDT biased discussions.

Is there a suitable list? And if not is there any interest in setting one
up? ... at the risk of proliferating even more lists ...


I for myself switched over to PhpStorm from Eclipse/PDT and I fear meany
hear use either PhpStorm, or Netbeans in the meantime. I'm not saying, that
nobody is using Eclipse/PDT anymore, but I fear you wont find much interest
here.


I'm still on PHPEclipse for PHP. PDT just does not work for me, and neither did 
Netbeans for some of the other languages I have to live with, which is why 
PHPStorm is no use either. I need python in addition to C/C++ with document 
handling, and firebird which don't get any support from either so Eclipse is 
really my only option.


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
---End Message---
---BeginMessage---
2013/8/24 Lester Caine les...@lsces.co.uk

 Sebastian Krebs wrote:

 With composer being pushed as the 'in way to go' and not being able to see
 how to get some code relating to bootstrap and smarty development
 because
 the links only show composer I've downloaded a plug-in for eclipse that
 is
 supposed to handle that. But it's not working as I expect, and while
 heading over to the plug-ins developers is the obvious step, what I'd
 actually prefer is a more general PHP/Eclipse list to discuss general
 IDE
 problems rather than even PDT biased discussions.
 
 Is there a suitable list? And if not is there any interest in setting
 one
 up? ... at the risk of proliferating even more lists ...


 I for myself switched over to PhpStorm from Eclipse/PDT and I fear meany
 hear use either PhpStorm, or Netbeans in the meantime. I'm not saying,
 that
 nobody is using Eclipse/PDT anymore, but I fear you wont find much
 interest
 here.


 I'm still on PHPEclipse for PHP. PDT just does not work for me, and
 neither did Netbeans for some of the other languages I have to live with,
 which is why PHPStorm is no use either.


PHPEclipse is still in development? O_o The last time I noticed it, it
looked abandoned. However, if it works for you

php-general Digest 26 Aug 2013 03:41:12 -0000 Issue 8344

2013-08-25 Thread php-general-digest-help

php-general Digest 26 Aug 2013 03:41:12 - Issue 8344

Topics (messages 321965 through 321965):

exec and system do not work
321965 by: Ethan Rosenberg

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---

Dear List -

I'm lost on this one -

This works -

$out = system(ls -l ,$retvals);
printf(%s, $out);

This does -

echo exec(ls -l);

This does not -

if( !file_exists(/var/www/orders.txt));
{
   $out = system(touch /var/www/orders.txt, $ret);
   $out2 = system(chmod 766 /var/www/orders.txt, $ret);
   echo 'file2br /';
   echo file_exists(/var/www/orders.txt);
}

and this does not -

if( !file_exists(/var/www/orders.txt));
{
   exec(touch /var/www/orders.txt);
   exec(chmod 766 /var/www/orders.txt);
   echo 'file2br /';
   echo file_exists(/var/www/orders.txt);
}

Ethan
---End Message---


[PHP] PHP-5.5.2 +opcache segfaults with Piwik

2013-08-25 Thread Grant
I've tried php-5.5.2 and 5.5.3 but both segfault with piwik unless the
opcache is disabled.  Someone filed a piwik bug but was told it's a
php bug:

http://dev.piwik.org/trac/ticket/4093

- Grant

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



[PHP] exec and system do not work

2013-08-25 Thread Ethan Rosenberg

Dear List -

I'm lost on this one -

This works -

$out = system(ls -l ,$retvals);
printf(%s, $out);

This does -

echo exec(ls -l);

This does not -

if( !file_exists(/var/www/orders.txt));
{
   $out = system(touch /var/www/orders.txt, $ret);
   $out2 = system(chmod 766 /var/www/orders.txt, $ret);
   echo 'file2br /';
   echo file_exists(/var/www/orders.txt);
}

and this does not -

if( !file_exists(/var/www/orders.txt));
{
   exec(touch /var/www/orders.txt);
   exec(chmod 766 /var/www/orders.txt);
   echo 'file2br /';
   echo file_exists(/var/www/orders.txt);
}

Ethan

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



Re: [PHP] exec and system do not work

2013-08-25 Thread Sorin Badea
*/var/www* is usually under *www* user. It may be a permissions problem.


On Mon, Aug 26, 2013 at 6:41 AM, Ethan Rosenberg 
erosenb...@hygeiabiomedical.com wrote:

 Dear List -

 I'm lost on this one -

 This works -

 $out = system(ls -l ,$retvals);
 printf(%s, $out);

 This does -

 echo exec(ls -l);

 This does not -

 if( !file_exists(/var/www/orders.**txt));
 {
$out = system(touch /var/www/orders.txt, $ret);
$out2 = system(chmod 766 /var/www/orders.txt, $ret);
echo 'file2br /';
echo file_exists(/var/www/orders.**txt);
 }

 and this does not -

 if( !file_exists(/var/www/orders.**txt));
 {
exec(touch /var/www/orders.txt);
exec(chmod 766 /var/www/orders.txt);
echo 'file2br /';
echo file_exists(/var/www/orders.**txt);
 }

 Ethan

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




-- 
Sorin Badea - Software Engineer


php-general Digest 24 Aug 2013 11:45:26 -0000 Issue 8342

2013-08-24 Thread php-general-digest-help

php-general Digest 24 Aug 2013 11:45:26 - Issue 8342

Topics (messages 321955 through 321959):

Re: windows files and folders permission
321955 by: Carlos Medina

files and folders windows permission
321956 by: Emiliano Boragina
321957 by: Matijn Woudt
321958 by: Maciek Sokolewicz

Alternate list for eclipse ide support?
321959 by: Lester Caine

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---
Hola Emiliano,
i think you should to redefine your question because i can not
understand what you want. Please post parts of the code, examples,
errors, etc.

regards

Carlos Medina

Am 23.08.2013 06:28, schrieb Emiliano Boragina:
 Night everyone, I did a upload page and when upload a JPG file this is not
 available. Why this happens? Thanks a lot.
 
 
 Emiliano Boragina | gráfico + web
 desarrollos  comunicación
 
 + 15 33 92 60 02
 » emiliano.borag...@gmail.com
 
 © 2013
 
 
 

---End Message---
---BeginMessage---
Hi everyone, sorry my ugly english. I did an upload file form. Works
very good. Upload the files in the right folder, with the right name.
I use chmod 0644, and for try I use 0777. But always the files are
copyed blocked. I cant see them with windows preview for example. I
read in forums that is Windows fault. How can I fix this? Thanks a
lot.

-- 

Emiliano Boragina | gráfico + web
desarrollos  comunicación

+ 15 33 92 60 02
» emiliano.borag...@gmail.com

© 2013

---End Message---
---BeginMessage---
On Fri, Aug 23, 2013 at 4:03 PM, Emiliano Boragina 
emiliano.borag...@gmail.com wrote:

 Hi everyone, sorry my ugly english. I did an upload file form. Works
 very good. Upload the files in the right folder, with the right name.
 I use chmod 0644, and for try I use 0777. But always the files are
 copyed blocked. I cant see them with windows preview for example. I
 read in forums that is Windows fault. How can I fix this? Thanks a
 lot.

 Code?
---End Message---
---BeginMessage---

On 23-8-2013 16:37, Matijn Woudt wrote:

On Fri, Aug 23, 2013 at 4:03 PM, Emiliano Boragina 
emiliano.borag...@gmail.com wrote:


Hi everyone, sorry my ugly english. I did an upload file form. Works
very good. Upload the files in the right folder, with the right name.
I use chmod 0644, and for try I use 0777. But always the files are
copyed blocked. I cant see them with windows preview for example. I
read in forums that is Windows fault. How can I fix this? Thanks a
lot.

Code?




On a sidenote, how the hell did you manage to chmod files on _windows_ ???
---End Message---
---BeginMessage---
With composer being pushed as the 'in way to go' and not being able to see how 
to get some code relating to bootstrap and smarty development because the links 
only show composer I've downloaded a plug-in for eclipse that is supposed to 
handle that. But it's not working as I expect, and while heading over to the 
plug-ins developers is the obvious step, what I'd actually prefer is a more 
general PHP/Eclipse list to discuss general IDE problems rather than even PDT 
biased discussions.


Is there a suitable list? And if not is there any interest in setting one up? 
... at the risk of proliferating even more lists ...


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
---End Message---


[PHP] Alternate list for eclipse ide support?

2013-08-24 Thread Lester Caine
With composer being pushed as the 'in way to go' and not being able to see how 
to get some code relating to bootstrap and smarty development because the links 
only show composer I've downloaded a plug-in for eclipse that is supposed to 
handle that. But it's not working as I expect, and while heading over to the 
plug-ins developers is the obvious step, what I'd actually prefer is a more 
general PHP/Eclipse list to discuss general IDE problems rather than even PDT 
biased discussions.


Is there a suitable list? And if not is there any interest in setting one up? 
... at the risk of proliferating even more lists ...


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

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



Re: [PHP] Alternate list for eclipse ide support?

2013-08-24 Thread Sebastian Krebs
2013/8/24 Lester Caine les...@lsces.co.uk

 With composer being pushed as the 'in way to go' and not being able to see
 how to get some code relating to bootstrap and smarty development because
 the links only show composer I've downloaded a plug-in for eclipse that is
 supposed to handle that. But it's not working as I expect, and while
 heading over to the plug-ins developers is the obvious step, what I'd
 actually prefer is a more general PHP/Eclipse list to discuss general IDE
 problems rather than even PDT biased discussions.

 Is there a suitable list? And if not is there any interest in setting one
 up? ... at the risk of proliferating even more lists ...


Hi,

I for myself switched over to PhpStorm from Eclipse/PDT and I fear meany
hear use either PhpStorm, or Netbeans in the meantime. I'm not saying, that
nobody is using Eclipse/PDT anymore, but I fear you wont find much interest
here.

Regards,
Sebastian



 --
 Lester Caine - G8HFL
 -
 Contact - 
 http://lsces.co.uk/wiki/?page=**contacthttp://lsces.co.uk/wiki/?page=contact
 L.S.Caine Electronic Services - http://lsces.co.uk
 EnquirySolve - http://enquirysolve.com/
 Model Engineers Digital Workshop - http://medw.co.uk
 Rainbow Digital Media - 
 http://rainbowdigitalmedia.co.**ukhttp://rainbowdigitalmedia.co.uk

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




-- 
github.com/KingCrunch


Re: [PHP] Alternate list for eclipse ide support?

2013-08-24 Thread Lester Caine

Sebastian Krebs wrote:

With composer being pushed as the 'in way to go' and not being able to see
how to get some code relating to bootstrap and smarty development because
the links only show composer I've downloaded a plug-in for eclipse that is
supposed to handle that. But it's not working as I expect, and while
heading over to the plug-ins developers is the obvious step, what I'd
actually prefer is a more general PHP/Eclipse list to discuss general IDE
problems rather than even PDT biased discussions.

Is there a suitable list? And if not is there any interest in setting one
up? ... at the risk of proliferating even more lists ...


I for myself switched over to PhpStorm from Eclipse/PDT and I fear meany
hear use either PhpStorm, or Netbeans in the meantime. I'm not saying, that
nobody is using Eclipse/PDT anymore, but I fear you wont find much interest
here.


I'm still on PHPEclipse for PHP. PDT just does not work for me, and neither did 
Netbeans for some of the other languages I have to live with, which is why 
PHPStorm is no use either. I need python in addition to C/C++ with document 
handling, and firebird which don't get any support from either so Eclipse is 
really my only option.


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

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



Re: [PHP] Alternate list for eclipse ide support?

2013-08-24 Thread Sebastian Krebs
2013/8/24 Lester Caine les...@lsces.co.uk

 Sebastian Krebs wrote:

 With composer being pushed as the 'in way to go' and not being able to see
 how to get some code relating to bootstrap and smarty development
 because
 the links only show composer I've downloaded a plug-in for eclipse that
 is
 supposed to handle that. But it's not working as I expect, and while
 heading over to the plug-ins developers is the obvious step, what I'd
 actually prefer is a more general PHP/Eclipse list to discuss general
 IDE
 problems rather than even PDT biased discussions.
 
 Is there a suitable list? And if not is there any interest in setting
 one
 up? ... at the risk of proliferating even more lists ...


 I for myself switched over to PhpStorm from Eclipse/PDT and I fear meany
 hear use either PhpStorm, or Netbeans in the meantime. I'm not saying,
 that
 nobody is using Eclipse/PDT anymore, but I fear you wont find much
 interest
 here.


 I'm still on PHPEclipse for PHP. PDT just does not work for me, and
 neither did Netbeans for some of the other languages I have to live with,
 which is why PHPStorm is no use either.


PHPEclipse is still in development? O_o The last time I noticed it, it
looked abandoned. However, if it works for you, there is nothing wrong with
it.

(Just realized: There are really back in business. Interesting ^^)


 I need python in addition to C/C++ with document handling, and firebird
 which don't get any support from either so Eclipse is really my only option.


Well, Firebird is quite specific (dont know if its supported bei the
IntelliJ-platform), but for Python and C Jetbrains has other IDEs (PyCharm,
AppCode) :D Just saying: There _are_ alternatives :)


However, my last mail wasn't about telling you, that your IDE is bad. But I
have the feeling, that this audience may be simply not interested.

Regards,
Sebastian




 --
 Lester Caine - G8HFL
 -
 Contact - 
 http://lsces.co.uk/wiki/?page=**contacthttp://lsces.co.uk/wiki/?page=contact
 L.S.Caine Electronic Services - http://lsces.co.uk
 EnquirySolve - http://enquirysolve.com/
 Model Engineers Digital Workshop - http://medw.co.uk
 Rainbow Digital Media - 
 http://rainbowdigitalmedia.co.**ukhttp://rainbowdigitalmedia.co.uk

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




-- 
github.com/KingCrunch


Re: [PHP] Alternate list for eclipse ide support?

2013-08-24 Thread Lester Caine

Sebastian Krebs wrote:

However, my last mail wasn't about telling you, that your IDE is bad. But I have
the feeling, that this audience may be simply not interested.


I'm only using Java in order to make tweaks to PHPEclipse and and other support 
packages. ( and the same with python ).  We could do with more support in these 
areas, and comments like yours don't help, but there IS enough interest from 
users dissatisfied with the alternatives ...
The problem is that there are perhaps too many options and combining the 
activities of a few would create a more popular common base?


The vast number of different 'frameworks' add further to the dilution of effort. 
It's a pity that there is not a single universally accepted development base in 
addition to a single IDE into which support could be pooled. It's not going to 
happen as PHP now has too many diverse ways of doing the same thing? :(


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

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



[PHP] Re: windows files and folders permission

2013-08-23 Thread Carlos Medina
Hola Emiliano,
i think you should to redefine your question because i can not
understand what you want. Please post parts of the code, examples,
errors, etc.

regards

Carlos Medina

Am 23.08.2013 06:28, schrieb Emiliano Boragina:
 Night everyone, I did a upload page and when upload a JPG file this is not
 available. Why this happens? Thanks a lot.
 
 
 Emiliano Boragina | gráfico + web
 desarrollos  comunicación
 
 + 15 33 92 60 02
 » emiliano.borag...@gmail.com
 
 © 2013
 
 
 


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



[PHP] files and folders windows permission

2013-08-23 Thread Emiliano Boragina
Hi everyone, sorry my ugly english. I did an upload file form. Works
very good. Upload the files in the right folder, with the right name.
I use chmod 0644, and for try I use 0777. But always the files are
copyed blocked. I cant see them with windows preview for example. I
read in forums that is Windows fault. How can I fix this? Thanks a
lot.

-- 

Emiliano Boragina | gráfico + web
desarrollos  comunicación

+ 15 33 92 60 02
» emiliano.borag...@gmail.com

© 2013


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



Re: [PHP] files and folders windows permission

2013-08-23 Thread Matijn Woudt
On Fri, Aug 23, 2013 at 4:03 PM, Emiliano Boragina 
emiliano.borag...@gmail.com wrote:

 Hi everyone, sorry my ugly english. I did an upload file form. Works
 very good. Upload the files in the right folder, with the right name.
 I use chmod 0644, and for try I use 0777. But always the files are
 copyed blocked. I cant see them with windows preview for example. I
 read in forums that is Windows fault. How can I fix this? Thanks a
 lot.

 Code?


Re: [PHP] files and folders windows permission

2013-08-23 Thread Maciek Sokolewicz

On 23-8-2013 16:37, Matijn Woudt wrote:

On Fri, Aug 23, 2013 at 4:03 PM, Emiliano Boragina 
emiliano.borag...@gmail.com wrote:


Hi everyone, sorry my ugly english. I did an upload file form. Works
very good. Upload the files in the right folder, with the right name.
I use chmod 0644, and for try I use 0777. But always the files are
copyed blocked. I cant see them with windows preview for example. I
read in forums that is Windows fault. How can I fix this? Thanks a
lot.

Code?




On a sidenote, how the hell did you manage to chmod files on _windows_ ???

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



php-general Digest 22 Aug 2013 15:34:18 -0000 Issue 8340

2013-08-22 Thread php-general-digest-help

php-general Digest 22 Aug 2013 15:34:18 - Issue 8340

Topics (messages 321944 through 321952):

Re: PHP vs JAVA
321944 by: David Harkness
321945 by: Sebastian Krebs
321952 by: David Harkness

Re: Off the wall - sub-domain question
321946 by: Curtis Maurand
321947 by: Jim Giner
321948 by: Willie
321949 by: Jim Giner
321950 by: Dan McCullough
321951 by: Lester Caine

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---
On Wed, Aug 21, 2013 at 7:56 PM, Curtis Maurand cur...@maurand.com wrote:

 Sebastian Krebs wrote:

 Actually the problem is, that the dot . is already in use. With

 $foo.bar() you cannot tell, if you want to call the method bar() on the
  object $foo, or if you want to concatenate the value of $foo to the
  result of the function bar(). There is no other way around this than a
  different operator for method calls.

 I didn't think
 of that.  It seems to me there could be an easier operator than -
 which sometimes will make me stop and look at what keys I'm trying to
 hit.  Just a thought.  I forgot about the concatenation operator
 which is + in Java/C#


The PHP language developers were pretty stuck. Because of automatic
string-to-numeric-conversion, they couldn't use + for string concatenation.
Sadly, they chose . rather than .. which I believe one or two other
languages use. If they had, . would have been available once objects
rolled around in PHP 4/5. I suspect they chose - since that's used in C
and C++ to dereference a pointer.


  Ever tried the jetbrains products? :D (No, they don't pay me)

 I have not, but it looks interesting.
 I'll have to try it.


Those are very good products which have had a strong following for a
decade. The free IDE NetBeans also has quite good support for both Java and
PHP, and the latest beta version provides a web project that provides
front- and back-end debugging of PHP + JavaScript. You can be stepping
through JS code and hit an AJAX call and then seamlessly step through the
PHP code that handles it.

I use NetBeans for PHP/HTML/JS (though I am evaluating JetBrains' PHPStorm
now) and Eclipse for Java. You can't beat Eclipse's refactoring support in
a free tool, though I think NetBeans is close to catching up. I would bet
IntelliJ IDEA for Java by JetBrains is on par at least.

Peace,
David
---End Message---
---BeginMessage---
2013/8/22 David Harkness davi...@highgearmedia.com

 On Wed, Aug 21, 2013 at 7:56 PM, Curtis Maurand cur...@maurand.comwrote:

 Sebastian Krebs wrote:

  Actually the problem is, that the dot . is already in use. With

   $foo.bar() you cannot tell, if you want to call the method bar() on
 the
  object $foo, or if you want to concatenate the value of $foo to the
  result of the function bar(). There is no other way around this than a
  different operator for method calls.

 I didn't think
 of that.  It seems to me there could be an easier operator than -
 which sometimes will make me stop and look at what keys I'm trying to
 hit.  Just a thought.  I forgot about the concatenation operator
 which is + in Java/C#


 The PHP language developers were pretty stuck. Because of automatic
 string-to-numeric-conversion, they couldn't use + for string concatenation.
 Sadly, they chose . rather than .. which I believe one or two other
 languages use. If they had, . would have been available once objects
 rolled around in PHP 4/5. I suspect they chose - since that's used in C
 and C++ to dereference a pointer.


Actually I think .. is quite error-prone, because it is hard to
distinguish from . or _ on the _first_ glance, which makes the get
quickly through the code. [1]
So . is maybe not the best choice, but also remember when it was
introduced: That was decades ago. That time it was (probably ;)) the best
choice and nowadays I don't think it is too bad at all, beside that _other_
languages use it for other purposes now ;)


[1] Yes, I know, that _ is not an operator, but mixed with strings and
variables names it is there ;)




  Ever tried the jetbrains products? :D (No, they don't pay me)

 I have not, but it looks interesting.
 I'll have to try it.


 Those are very good products which have had a strong following for a
 decade. The free IDE NetBeans also has quite good support for both Java and
 PHP, and the latest beta version provides a web project that provides
 front- and back-end debugging of PHP + JavaScript. You can be stepping
 through JS code and hit an AJAX call and then seamlessly step through the
 PHP code that handles it.

 I use NetBeans for PHP/HTML/JS (though I am evaluating JetBrains' PHPStorm
 now) and Eclipse for Java. You can't beat Eclipse's

php-general Digest 23 Aug 2013 04:28:41 -0000 Issue 8341

2013-08-22 Thread php-general-digest-help

php-general Digest 23 Aug 2013 04:28:41 - Issue 8341

Topics (messages 321953 through 321954):

PHP 5.4.19 and PHP 5.5.3 Released!
321953 by: Stas Malyshev

windows files and folders permission
321954 by: Emiliano Boragina

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---
Hello!

The PHP development team announces the immediate availability of PHP
5.4.19 and PHP 5.5.3. These releases fix a bug in the patch for
CVE-2013-4248 in OpenSSL module and compile failure with ZTS enabled in
PHP 5.4, which were introduced in previously released 5.4.18 and 5.5.2.

All PHP users are encouraged to upgrade to either PHP 5.5.3 or PHP 5.4.19.

For source downloads of PHP 5.4.19 and PHP 5.5.3 please visit our
downloads page:

http://www.php.net/downloads.php

Windows binaries can be found on:

http://windows.php.net/download/

The list of changes is recorded in the ChangeLog at:

http://www.php.net/ChangeLog-5.php

Regards,

Stanislav Malyshev
PHP 5.4 Release Manager
---End Message---
---BeginMessage---
Night everyone, I did a upload page and when upload a JPG file this is not
available. Why this happens? Thanks a lot.


Emiliano Boragina | gráfico + web
desarrollos  comunicación

+ 15 33 92 60 02
» emiliano.borag...@gmail.com

© 2013



---End Message---


Re: [PHP] Re: PHP vs JAVA

2013-08-22 Thread Sebastian Krebs
2013/8/22 David Harkness davi...@highgearmedia.com

 On Wed, Aug 21, 2013 at 7:56 PM, Curtis Maurand cur...@maurand.comwrote:

 Sebastian Krebs wrote:

  Actually the problem is, that the dot . is already in use. With

   $foo.bar() you cannot tell, if you want to call the method bar() on
 the
  object $foo, or if you want to concatenate the value of $foo to the
  result of the function bar(). There is no other way around this than a
  different operator for method calls.

 I didn't think
 of that.  It seems to me there could be an easier operator than -
 which sometimes will make me stop and look at what keys I'm trying to
 hit.  Just a thought.  I forgot about the concatenation operator
 which is + in Java/C#


 The PHP language developers were pretty stuck. Because of automatic
 string-to-numeric-conversion, they couldn't use + for string concatenation.
 Sadly, they chose . rather than .. which I believe one or two other
 languages use. If they had, . would have been available once objects
 rolled around in PHP 4/5. I suspect they chose - since that's used in C
 and C++ to dereference a pointer.


Actually I think .. is quite error-prone, because it is hard to
distinguish from . or _ on the _first_ glance, which makes the get
quickly through the code. [1]
So . is maybe not the best choice, but also remember when it was
introduced: That was decades ago. That time it was (probably ;)) the best
choice and nowadays I don't think it is too bad at all, beside that _other_
languages use it for other purposes now ;)


[1] Yes, I know, that _ is not an operator, but mixed with strings and
variables names it is there ;)




  Ever tried the jetbrains products? :D (No, they don't pay me)

 I have not, but it looks interesting.
 I'll have to try it.


 Those are very good products which have had a strong following for a
 decade. The free IDE NetBeans also has quite good support for both Java and
 PHP, and the latest beta version provides a web project that provides
 front- and back-end debugging of PHP + JavaScript. You can be stepping
 through JS code and hit an AJAX call and then seamlessly step through the
 PHP code that handles it.

 I use NetBeans for PHP/HTML/JS (though I am evaluating JetBrains' PHPStorm
 now) and Eclipse for Java. You can't beat Eclipse's refactoring support in
 a free tool, though I think NetBeans is close to catching up. I would bet
 IntelliJ IDEA for Java by JetBrains is on par at least.


Eclipse' code-completion and debugger never worked for me well (and most of
the time: at all). It became slower and less responsive with every release.
That was the reason I decided to leave it and I don't regret it :)



 Peace,
 David




-- 
github.com/KingCrunch


Re: [PHP] Off the wall - sub-domain question

2013-08-22 Thread Curtis Maurand



Is the subdomain also in a subfolder of the main domain?

Jim Giner wrote:
 I have a main domain (of course) and a sub
domain.  I'm really trying to
 steer my personal stuff away from
the main one and have focused all of
 my php development to the
sub-domain.
 
 Lately I noticed that google catalogs my
sub-domain site stuff under the
 main domain name and the links
that come up lead to that domain name
 with the path that takes
the user to the sub-domain's home folder and
 beyond.


 Is there something that php (apache??) can do to control either
google's
 robots or the user's view (url) so that it appears as a
page of my
 sub-domain?  I'm really new at this stuff and know
nothing.  I'm lucky
 that google is even finding my site!
 
 IN advance - I apologize for this off-topic question,
but this place is
 a source of much knowledge, so I just threw in
a quick interlude here to
 pick someone's brain.  :)


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



Re: [PHP] Off the wall - sub-domain question

2013-08-22 Thread Jim Giner

On 8/22/2013 8:05 AM, Curtis Maurand wrote:




Is the subdomain also in a subfolder of the main domain?

Jim Giner wrote:

I have a main domain (of course) and a sub

domain.  I'm really trying to

steer my personal stuff away from

the main one and have focused all of

my php development to the

sub-domain.


Lately I noticed that google catalogs my

sub-domain site stuff under the

main domain name and the links

that come up lead to that domain name

with the path that takes

the user to the sub-domain's home folder and

beyond.




Is there something that php (apache??) can do to control either

google's

robots or the user's view (url) so that it appears as a

page of my

sub-domain?  I'm really new at this stuff and know

nothing.  I'm lucky

that google is even finding my site!

IN advance - I apologize for this off-topic question,

but this place is

a source of much knowledge, so I just threw in

a quick interlude here to

pick someone's brain.  :)




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




Yes - the sub is an add-on domain to my primary domain.  Hence the 
overlap and problem.


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



Re: [PHP] Off the wall - sub-domain question

2013-08-22 Thread Willie
The only way that I know of to take care of that is to put a file in your
main directory called robots.txt. In that file you will put:


User-agent: *
Disallow: /FolderName



On Thu, Aug 22, 2013 at 6:19 AM, Jim Giner jim.gi...@albanyhandball.comwrote:

 On 8/22/2013 8:05 AM, Curtis Maurand wrote:




 Is the subdomain also in a subfolder of the main domain?

 Jim Giner wrote:

 I have a main domain (of course) and a sub

 domain.  I'm really trying to

 steer my personal stuff away from

 the main one and have focused all of

 my php development to the

 sub-domain.


 Lately I noticed that google catalogs my

 sub-domain site stuff under the

 main domain name and the links

 that come up lead to that domain name

 with the path that takes

 the user to the sub-domain's home folder and

 beyond.


  Is there something that php (apache??) can do to control either

 google's

 robots or the user's view (url) so that it appears as a

 page of my

 sub-domain?  I'm really new at this stuff and know

 nothing.  I'm lucky

 that google is even finding my site!

 IN advance - I apologize for this off-topic question,

 but this place is

 a source of much knowledge, so I just threw in

 a quick interlude here to

 pick someone's brain.  :)


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



  Yes - the sub is an add-on domain to my primary domain.  Hence the
 overlap and problem.


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




-- 

Willie Matthews
matthews.wil...@gmail.com


Re: [PHP] Off the wall - sub-domain question

2013-08-22 Thread Jim Giner

On 8/22/2013 9:43 AM, Willie wrote:

The only way that I know of to take care of that is to put a file in your
main directory called robots.txt. In that file you will put:


User-agent: *
Disallow: /FolderName



On Thu, Aug 22, 2013 at 6:19 AM, Jim Giner jim.gi...@albanyhandball.comwrote:


On 8/22/2013 8:05 AM, Curtis Maurand wrote:





Is the subdomain also in a subfolder of the main domain?

Jim Giner wrote:


I have a main domain (of course) and a sub


domain.  I'm really trying to


steer my personal stuff away from


the main one and have focused all of


my php development to the


sub-domain.



Lately I noticed that google catalogs my


sub-domain site stuff under the


main domain name and the links


that come up lead to that domain name


with the path that takes


the user to the sub-domain's home folder and


beyond.



  Is there something that php (apache??) can do to control either



google's


robots or the user's view (url) so that it appears as a


page of my


sub-domain?  I'm really new at this stuff and know


nothing.  I'm lucky


that google is even finding my site!

IN advance - I apologize for this off-topic question,


but this place is


a source of much knowledge, so I just threw in


a quick interlude here to


pick someone's brain.  :)



  --

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




  Yes - the sub is an add-on domain to my primary domain.  Hence the

overlap and problem.


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






I'll try it.

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



Re: [PHP] Off the wall - sub-domain question

2013-08-22 Thread Dan McCullough
So its indexing http://www.domain.com/subdomain/page.php and you would
rather it index http://subdomain.domain.com/page.php.  If that is the case
then what Willie said holds true

User-agent: *
Disallow: /subdomain

Place a robots.txt in the domain.com public root directory.

To Googles indexer http://subdomain.domain.com/page.php and
http://www.domain.com/subdomain/page.php are totally different and
therefore blocking /subdomain will not affect subdomain.domain.com.

Sign up for Google Webmaster and add two sites subdomain.domain and
www.domain  that way you can delete improperly indexed pages.
Do some test scans and see if there are links on your www.domain that are
linked to www.domain.com/subdomain rather then subdomain.domain.com


On Thu, Aug 22, 2013 at 9:43 AM, Willie matthews.wil...@gmail.com wrote:

 The only way that I know of to take care of that is to put a file in your
 main directory called robots.txt. In that file you will put:


 User-agent: *
 Disallow: /FolderName



 On Thu, Aug 22, 2013 at 6:19 AM, Jim Giner jim.gi...@albanyhandball.com
 wrote:

  On 8/22/2013 8:05 AM, Curtis Maurand wrote:
 
 
 
 
  Is the subdomain also in a subfolder of the main domain?
 
  Jim Giner wrote:
 
  I have a main domain (of course) and a sub
 
  domain.  I'm really trying to
 
  steer my personal stuff away from
 
  the main one and have focused all of
 
  my php development to the
 
  sub-domain.
 
 
  Lately I noticed that google catalogs my
 
  sub-domain site stuff under the
 
  main domain name and the links
 
  that come up lead to that domain name
 
  with the path that takes
 
  the user to the sub-domain's home folder and
 
  beyond.
 
 
   Is there something that php (apache??) can do to control either
 
  google's
 
  robots or the user's view (url) so that it appears as a
 
  page of my
 
  sub-domain?  I'm really new at this stuff and know
 
  nothing.  I'm lucky
 
  that google is even finding my site!
 
  IN advance - I apologize for this off-topic question,
 
  but this place is
 
  a source of much knowledge, so I just threw in
 
  a quick interlude here to
 
  pick someone's brain.  :)
 
 
   --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
   Yes - the sub is an add-on domain to my primary domain.  Hence the
  overlap and problem.
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


 --

 Willie Matthews
 matthews.wil...@gmail.com




-- 
Thank you,

Dan

Cell:  484-459-2856

https://www.facebook.com/dpmccullough
http://www.linkedin.com/in/danmccullough


Re: [PHP] Off the wall - sub-domain question

2013-08-22 Thread Lester Caine

Jim Giner wrote:

Yes - the sub is an add-on domain to my primary domain.  Hence the overlap and
problem.
I don't think there is any way to get google to separate filing information on 
different subdomains from the main domain, but you can stop them filing content 
altogether by identifying folders you do not want them to use. I have fun with 
them indexing the page histories if I forget to block that particular functions 
.php file.


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

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



Re: [PHP] Re: PHP vs JAVA

2013-08-22 Thread David Harkness
On Thu, Aug 22, 2013 at 12:29 AM, Sebastian Krebs krebs@gmail.comwrote:

 Actually I think .. is quite error-prone, because it is hard to
 distinguish from . or _ on the _first_ glance, which makes the get
 quickly through the code. [1]


I surround all operators except member access (. and -) with spaces,
so that wouldn't be a problem for me. I thought there was an older language
that used .., but all I can find now is Lua which was developed in the
early nineties.

So . is maybe not the best choice, but also remember when it was
 introduced: That was decades ago. That time it was (probably ;)) the best
 choice and nowadays I don't think it is too bad at all, beside that _other_
 languages use it for other purposes now ;)


C introduced . as the field access operator for structs in the early
seventies, C++ kept it for object access, and Java adopted it in the early
nineties. C's use of pointers required a way to access members through a
pointer, and I suppose KR thought - looked like following a pointer (I
agree).

Since PHP was modeled on Perl and wouldn't implement objects or structs for
another decade, it adopted . for string concatenation. It works fine, and
I don't have too much trouble bouncing back-and-forth. I honestly would
have preferred . to be overloaded when the left hand side was an object.
In the rare cases that you want to convert an object to a string to be
concatenated with the RHS, you can always cast it to string, use strval(),
or call __toString() manually. But I'm not staging any protests over the
use of -. :)


 Eclipse' code-completion and debugger never worked for me well (and most
 of the time: at all). It became slower and less responsive with every
 release. That was the reason I decided to leave it and I don't regret it :)


I agree about the slowness, and until this latest release I've always left
autocompletion manual (ctrl + space). They did something with Kepler to
speed it up drastically, so much so I have it turned on with every
keypress. However, it's a little too aggressive in providing choices.
Typing null which is a Java keyword as in PHP, it will insert
nullValue() which is a method from Hamcrest. :( After a couple weeks of
this, I think I'll be switching it back to manual activation. I can type
quickly enough that I only need it when I'm not sure of a method name.

NetBeans, while not as good with refactoring and plugin support, is still
zippier than Eclipse. And my short time with the JetBrains products found
them to be fast as well. Eclipse's PHP support via PDT is not nearly as
good as NetBeans, and no doubt PHPStorm beats them both.

Peace,
David


[PHP] PHP 5.4.19 and PHP 5.5.3 Released!

2013-08-22 Thread Stas Malyshev
Hello!

The PHP development team announces the immediate availability of PHP
5.4.19 and PHP 5.5.3. These releases fix a bug in the patch for
CVE-2013-4248 in OpenSSL module and compile failure with ZTS enabled in
PHP 5.4, which were introduced in previously released 5.4.18 and 5.5.2.

All PHP users are encouraged to upgrade to either PHP 5.5.3 or PHP 5.4.19.

For source downloads of PHP 5.4.19 and PHP 5.5.3 please visit our
downloads page:

http://www.php.net/downloads.php

Windows binaries can be found on:

http://windows.php.net/download/

The list of changes is recorded in the ChangeLog at:

http://www.php.net/ChangeLog-5.php

Regards,

Stanislav Malyshev
PHP 5.4 Release Manager

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



[PHP] windows files and folders permission

2013-08-22 Thread Emiliano Boragina
Night everyone, I did a upload page and when upload a JPG file this is not
available. Why this happens? Thanks a lot.


Emiliano Boragina | gráfico + web
desarrollos  comunicación

+ 15 33 92 60 02
» emiliano.borag...@gmail.com

© 2013




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



<    1   2   3   4   5   6   7   8   9   10   >