Date: Thu, 23 Feb 2006 20:16:33 -0800 From: je killen <jekillen@prodigy.net> To: questions@freebsd.org Subject: problem with file creation script Message-ID: <7811c9428278be86b492ad52e3e4f91a@prodigy.net>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7811c9428278be86b492ad52e3e4f91a>