problem with file creation script

je killen jekillen at prodigy.net
Thu Feb 23 20:16:36 PST 2006


I have a question that has not been answered by the php lists I 
subscribe to.
I have written a script that reads a directory in which I have placed 
True Type font files
for use with gd and php 5.1.2 on FreeBSD v6.0. This is used to generate 
a text file
that serves as input for another script that reads this and calls up 
each font and
writes sample text to a png file. I use touch(<such and such>.png) in a 
loop to create
corresponding empty png files in a separate directory.
The problem is that the server Apache 1.3.34 w/php on FreeBSD has 
written a ? to
the end of the file name: E.G. <such and such file>.png? So the 
subsequent script
that is supposed to actually write to the file fails silently ( no 
errors, just runs and
quits, with nothing written to the files.)
I am working with an ftp client from another machine and when I call up 
the contents of
this directory the files are presented as they are supposed to be but 
if I try to change
permissions, the server returns message that the file doesn't exist. I 
went to the
machine and cd'd into the directory and did ls -la and saw the ? on the 
end of each
file name.
Could this be written to STANDARD ERROR on the server so not visible 
via ftp connection?
My shell on the FreeBSD machine (the server) is csh.
I looked over the actual script and I can't see anything in the script 
that would have added
the question mark.
#/*<?php   (comment chars added to protect the innocent)
#$items = array();
#function gen_img($b)
  #               {
   #               $file = fopen('A-menu.txt', 'r');
    #              $i = 0;
     #             while(!feof($file))
      #                 {
       #                 $b[$i] = fgets($file, 128);
        #                $b[$i] = ereg_replace('.ttf', '.png', $b[$i]);
         #               print $b[$i].'<br>';
          #              $i++;
           #             };
            #      fclose($file);
#                 $i = 0;
  #                print(getcwd()."<br>");
   #               for($i; $i < count($b); $i++)
    #                  {
     #                  touch($b[$i]); // this is the line executing 
touch(), $b is $items in function call below
      #                 print $b[$i].'<br>';
       #               };
        #
         #         }
#//gen_img($items); <----- function call

#function re_name()
#                {$a = array();
#                 $i = 0;
#                 $dir = opendir('ttf_samples') or die("Couldn't open 
dir named ttf_samples");
#                 While($a[$i] = readdir($dir))
#                      {if(ereg('png?', $a[$i]))
#                         {
#                          ereg_replace('png?', 'png', $a[$i]);
#                         }
#                       $i++;
#                      }
#                 }
#//re_name(); <-------this would not work
#?>(comment chars added to protect the innocent) */
The following is a portion of the out put of ls -la echoed to a txt 
file, notice the absence of the '?'.

-rwx---rwx  1 jekillen  wheel  2214 Feb 20 23:27 A-menu.txt
-rwx---rwx  1 jekillen  wheel     0 Feb 24 02:49 BRASSETB.png

-rwx---rwx  1 jekillen  wheel     0 Feb 24 02:49 BRASSETO.png

-rwx---rwx  1 jekillen  wheel     0 Feb 24 02:49 BRASSETT.png

-rwx---rwx  1 jekillen  wheel     0 Feb 24 02:49 Bolton.png

-rwx---rwx  1 jekillen  wheel     0 Feb 24 02:49 BoltonBold.png

-rwx---rwx  1 jekillen  wheel     0 Feb 24 02:49 BoltonBoldItalic.png

-rwx---rwx  1 jekillen  wheel     0 Feb 24 02:49 BoltonDropCaps.png

-rwx---rwx  1 jekillen  wheel     0 Feb 24 02:49 BoltonElongated.png

-rwx---rwx  1 jekillen  wheel     0 Feb 24 02:49 BoltonItalic.png

-rwx---rwx  1 jekillen  wheel     0 Feb 24 02:49 BoltonItalicOutline.png

-rwx---rwx  1 jekillen  wheel     0 Feb 24 02:49 BoltonLight.png

-rwx---rwx  1 jekillen  wheel     0 Feb 24 02:49 BoltonLightItalic.png

I hope this is acceptable for this list.
Also I hope this text hasn't been reflowed to bad. I notice that
messages I write often show up much differently that the way I
originally wrote them.
thank you;
JK



More information about the freebsd-questions mailing list