Re: Create .php file with php
| From: | jekillen | Date: | Tue, 26 Jun 2007 04:19:12 +0000 |
| Subject: | Re: Create .php file with php | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-257771@lists.php.net to get a copy of this message | ||
On Jun 25, 2007, at 9:08 PM, jekillen wrote:
On Jun 25, 2007, at 5:13 PM, Marius Toma wrote:fwrite($fp, "<?php\n(code)\n?>"); fclose($fp); Also in my code editor, the closing php tag screws up the syntax coloring but does not indicate a coding error, so I do $close_tag = '?'.'>'; and in the fclose($fp, "<?php\n(code)\n$close_tag ); and my editor will keep the syntax coloring. (BBEdit) JKI can not create .php files from PHP. I can save them as *.php5, *.php3, asp, *.txt , etc... but not as .php. I tried both touch and fopen but none of them worked. I'm running PHP 5.1.6 on Apache 2, safe_mode is off Is this a security measure somewhere? How can I bypass it? Thank you, MariusI had trouble with this also running php 5.1.2 and now 5.2.1. But I got the hang of it to the point that I have mostly abandoned xml and flat files for temporary files and quick and dirty data bases that can just be included for their content. I do not remember what I did that got it going but it is definitely possible, almost spooky. You certainly do not want any user supplied content written to a php file as variable values or anything without being completely sanitized. I also had trouble opening and modifying html files but got the hang of that too. I am running Apache 1.3.x on FreeBSD 6.0, 6.2, Mac OSX, and Yellow Dog Linux. Keep trying...I had to. JK I just do $fp = fopen('so_and_so.php', 'w+'); // the 'w+' is necessary for creating files that do not exist and writing to them, just 'w' requires the file to exist already.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php