php-general Digest 16 Jul 2006 02:53:26 -0000 Issue 4242

Topics (messages 239508 through 239511):

php-head-shrink  WAS: Re: [PHP] Zend Studio, phpMyAdmin, and mysql.sock
        239508 by: Paul Scott

Re: Zend Studio, phpMyAdmin, and mysql.sock
        239509 by: tedd

strange behavior
        239510 by: jekillen
        239511 by: Richard Lynch

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
------=neXtPaRt_1152981398
Content-Type: text/plain
Content-Transfer-Encoding: 7bit


My IBM laptop and I are having relationship issues...

--Paul


------=neXtPaRt_1152981398
Content-Type: text/plain;

All Email originating from UWC is covered by disclaimer  
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

------=neXtPaRt_1152981398--

--- End Message ---
--- Begin Message ---
At 5:05 PM +1000 7/15/06, Kevin Waterson wrote:
>This one time, at band camp, Dave M G <[EMAIL PROTECTED]> wrote:
> 
>> Please understand that I was *hoping* for advice here, as Zend and PHP
>> are surely highly correlated. But I apologize if I came across as if I
>> *expected* answers.
>
>You raise an interesting point. Whilst PHP uses the Zend Engine it is the
>only Zend product in use as far as I know. Zend have an array of other
>commercial products that are built with PHP, but are no different than
>any other commercial venture.
>
>Being that these products are commercial in nature, should not they
>be supporting thier own products, rather than relying on the good
>will of the open source/PHP folks for tech support? If we should support
>Zend products, why not other commercial applications also?
>Is Zend hoping for volunteer contributions for commercial enterprises?
>Should we support Zend business partners also?
>
>
>Kind regards
>Kevin

Kevin:

You raise obvious points, which few would disagree -- we shouldn't be expected 
to be the "free" support for a commercial product. However, if a php developer 
is looking for other developers who may have had similar experiences with Zend, 
or Apache, or whatever as it relates to php, is this not the forum for those 
types of questions?

Again, just wondering where to draw the line.

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

--- End Message ---
--- Begin Message ---
Hello:
I have a directory on a server that has php code that creates and writes to directories as such; /tiles_.*/. Each directory with a matching name has graphics files written to it. i'm trying to write a script the will eliminate the graphics files and the directories they are in (tiles_.*). The present code is:
<?php
function prune()
              {
               $f = 0;
               $pat = 'tiles_.*';
               $view = array();
               $t = array();
               $str = '';
               $start = opendir('.');
               //print"Hello???<br>"; debug code
               while($lst = readdir($start))
                   {
                    if(ereg($pat, $lst))
                      {
                       $t[$f] = $lst;
                       $str .= $t[$f].'<br>'; //debug code
                      }
                     $f++;
                    }
               rewind($start);
               closedir($start);
//print $str; debug code----the array $t has all valid values at this point.
               for($f = 0; $f < count($t); $f++)
                 {$tmp = $t[$f];
                  chdir($tmp);
                  $dir = opendir($tmp);
                  $r = 0;
                  while($i = readdir($dir))
                       {
                        @unlink($i);
                        $r++;
                       };
                   rewind($dir);
                   closedir($dir);
                   unset($dir);
                   chdir('../');
                   rmdir($tmp);
                  }

              }
prune();
?>
The problem is that each time the for loop tries to chdir to an array $t item, errors regarding invalid resources and none existent files are generated. If I use chdir('./'.$tmp) and opendir('./'.$tmp) the code removes all the files in the directory the script is located in, including the script file itself. So, I am thinking that, in this case, the directories aren't even changed when the @unlink() line is reached and unlink() only sees the current directory files and not included directories, and removes everything that isn't a directory.
Here is a sample of the errors generated:
Warning: chdir() [function.chdir]: No such file or directory (errno 2) in (path)/prune.php on line 30 // (all resources used based on this are invalid)
and;
Warning: opendir(tiles_9215fd05) [function.opendir]: failed to open dir: No such file or directory in /var/www/html/exp/tile_puzzle/prune.php on line 31 (this happens on the second iteration of the loop......tiles_9215fd05 is a valid array $t item) So, Can someone tell me what I might be doing wrong here. I don't want to swim around with any more trial and error if possible.
I'm using php 5.1.2, Apache 1.3.34
Thanks in advance.
JK

--- End Message ---
--- Begin Message ---

$i only has the name of the FILE in it, not the whole path.

You need to provide the full path to unlink() to make this work right.

In theory, you could manage to provide just the relative path from the
current working directory, but, honestly, 99% of the time, a FULL PATH
is just easier to figure out.

On Sun, July 16, 2006 3:46 pm, jekillen wrote:
> Hello:
> I have a directory on a server that has php code that creates and
> writes to directories as such;  /tiles_.*/.
> Each directory with a matching name has graphics files written to it.
> i'm trying to write a script the will
> eliminate the graphics files and the directories they are in
> (tiles_.*). The present code is:
> <?php
> function prune()
>                {
>                 $f = 0;
>                 $pat = 'tiles_.*';
>                 $view = array();
>                 $t = array();
>                 $str = '';
>                 $start = opendir('.');
>                 //print"Hello???<br>"; debug code
>                 while($lst = readdir($start))
>                     {
>                      if(ereg($pat, $lst))
>                        {
>                         $t[$f] = $lst;
>                         $str .= $t[$f].'<br>'; //debug code
>                        }
>                       $f++;
>                      }
>                 rewind($start);
>                 closedir($start);
>                 //print $str; debug code----the array $t has all valid
> values at this point.
>                 for($f = 0; $f < count($t); $f++)
>                   {$tmp = $t[$f];
>                    chdir($tmp);
>                    $dir = opendir($tmp);
>                    $r = 0;
>                    while($i = readdir($dir))
>                         {
>                          @unlink($i);
>                          $r++;
>                         };
>                     rewind($dir);
>                     closedir($dir);
>                     unset($dir);
>                     chdir('../');
>                     rmdir($tmp);
>                    }
>
>                }
> prune();
> ?>
> The problem is that each time the for loop tries to chdir to an array
> $t item, errors regarding invalid resources and none existent files
> are
> generated.
> If I use chdir('./'.$tmp) and opendir('./'.$tmp) the code removes all
> the files in the directory the script is located in, including the
> script file itself.
> So, I am thinking that, in this case, the directories aren't even
> changed when the @unlink() line is reached and unlink() only sees the
> current
> directory files and not included directories, and removes everything
> that isn't a directory.
> Here is a sample of the errors generated:
> Warning: chdir() [function.chdir]: No such file or directory (errno 2)
> in (path)/prune.php on line 30 // (all resources used based on this
> are
> invalid)
> and;
> Warning: opendir(tiles_9215fd05) [function.opendir]: failed to open
> dir: No such file or directory in
> /var/www/html/exp/tile_puzzle/prune.php on line 31
> (this happens on the second iteration of the loop......tiles_9215fd05
> is a valid array $t item)
> So, Can someone tell me what I might be doing wrong here. I don't want
> to swim around with any more trial and error if possible.
> I'm using php 5.1.2, Apache 1.3.34
> Thanks in advance.
> JK
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---

Reply via email to