Re: [PHP] create archive file in memory with zipArchive class

2010-02-10 Thread Richard Quadling
On 9 February 2010 16:47, Ryan Sun ryansu...@gmail.com wrote:
 thanks, Richard, maybe you are right, the actual file name is not my job
 I changed it to 'php://temp' but its still the same, nothing has been 
 changed...

 On Tue, Feb 9, 2010 at 11:13 AM, Richard Quadling
 rquadl...@googlemail.com wrote:
 On 9 February 2010 15:42, Ryan Sun ryansu...@gmail.com wrote:
 I want to generate credential zip file for user on the fly with
 zipArchive and render it for download, so I created following code
 -
 $zip = new ZipArchive();
 $filename = '/tmp/xxx.zip';
 if ($zip-open($filename, ZIPARCHIVE::CREATE)!==TRUE) {
  throw new Exception();
 }
 if($zip)
 {
     $zip-addFromString('xxx.xx', $fileString);
 }
 $zip-close();
 $fileString = file_get_contents($filename);
 unlink($filename);

 $this-getResponse()-setHeader('Content-Type', 'application/zip');
 $this-getResponse()-setHeader('Content-Disposition','attachment;filename=xxx.zip');
 $this-getResponse()-setBody($fileString);
 -
 it works, but I think creating the file in memory is a better
 approach, so I changed the 2nd lineI(using php 5.2.0) to
 $filename = 'php://temp/xxx.zip';
 then the php just won't archive the file and the file downloaded is
 just a plain text file.

 so
 question 1, how to create zip Archive file in memory on the fly and
 download it (I don't have to save it on disk)?
 question 2, if there is no way to create in memory, is it safe to just
 unlink() the file?

 thanks in advance.

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



 According to http://docs.php.net/manual/en/wrappers.php.php, it looks
 like you should be using ...

 $filename = 'php://temp';

 That's it.

 The actual file name is not your job.



 --
 -
 Richard Quadling
 Standing on the shoulders of some very clever giants!
 EE : http://www.experts-exchange.com/M_248814.html
 EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
 Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
 ZOPA : http://uk.zopa.com/member/RQuadling



It looks like this isn't possible.





-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



[PHP] create archive file in memory with zipArchive class

2010-02-09 Thread Ryan Sun
I want to generate credential zip file for user on the fly with
zipArchive and render it for download, so I created following code
-
$zip = new ZipArchive();
$filename = '/tmp/xxx.zip';
if ($zip-open($filename, ZIPARCHIVE::CREATE)!==TRUE) {
 throw new Exception();
}
if($zip)
{
    $zip-addFromString('xxx.xx', $fileString);
}
$zip-close();
$fileString = file_get_contents($filename);
unlink($filename);

$this-getResponse()-setHeader('Content-Type', 'application/zip');
$this-getResponse()-setHeader('Content-Disposition','attachment;filename=xxx.zip');
$this-getResponse()-setBody($fileString);
-
it works, but I think creating the file in memory is a better
approach, so I changed the 2nd lineI(using php 5.2.0) to
$filename = 'php://temp/xxx.zip';
then the php just won't archive the file and the file downloaded is
just a plain text file.

so
question 1, how to create zip Archive file in memory on the fly and
download it (I don't have to save it on disk)?
question 2, if there is no way to create in memory, is it safe to just
unlink() the file?

thanks in advance.

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



Re: [PHP] create archive file in memory with zipArchive class

2010-02-09 Thread Richard Quadling
On 9 February 2010 15:42, Ryan Sun ryansu...@gmail.com wrote:
 I want to generate credential zip file for user on the fly with
 zipArchive and render it for download, so I created following code
 -
 $zip = new ZipArchive();
 $filename = '/tmp/xxx.zip';
 if ($zip-open($filename, ZIPARCHIVE::CREATE)!==TRUE) {
  throw new Exception();
 }
 if($zip)
 {
     $zip-addFromString('xxx.xx', $fileString);
 }
 $zip-close();
 $fileString = file_get_contents($filename);
 unlink($filename);

 $this-getResponse()-setHeader('Content-Type', 'application/zip');
 $this-getResponse()-setHeader('Content-Disposition','attachment;filename=xxx.zip');
 $this-getResponse()-setBody($fileString);
 -
 it works, but I think creating the file in memory is a better
 approach, so I changed the 2nd lineI(using php 5.2.0) to
 $filename = 'php://temp/xxx.zip';
 then the php just won't archive the file and the file downloaded is
 just a plain text file.

 so
 question 1, how to create zip Archive file in memory on the fly and
 download it (I don't have to save it on disk)?
 question 2, if there is no way to create in memory, is it safe to just
 unlink() the file?

 thanks in advance.

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



According to http://docs.php.net/manual/en/wrappers.php.php, it looks
like you should be using ...

$filename = 'php://temp';

That's it.

The actual file name is not your job.



-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [PHP] create archive file in memory with zipArchive class

2010-02-09 Thread Ryan Sun
thanks, Richard, maybe you are right, the actual file name is not my job
I changed it to 'php://temp' but its still the same, nothing has been changed...

On Tue, Feb 9, 2010 at 11:13 AM, Richard Quadling
rquadl...@googlemail.com wrote:
 On 9 February 2010 15:42, Ryan Sun ryansu...@gmail.com wrote:
 I want to generate credential zip file for user on the fly with
 zipArchive and render it for download, so I created following code
 -
 $zip = new ZipArchive();
 $filename = '/tmp/xxx.zip';
 if ($zip-open($filename, ZIPARCHIVE::CREATE)!==TRUE) {
  throw new Exception();
 }
 if($zip)
 {
     $zip-addFromString('xxx.xx', $fileString);
 }
 $zip-close();
 $fileString = file_get_contents($filename);
 unlink($filename);

 $this-getResponse()-setHeader('Content-Type', 'application/zip');
 $this-getResponse()-setHeader('Content-Disposition','attachment;filename=xxx.zip');
 $this-getResponse()-setBody($fileString);
 -
 it works, but I think creating the file in memory is a better
 approach, so I changed the 2nd lineI(using php 5.2.0) to
 $filename = 'php://temp/xxx.zip';
 then the php just won't archive the file and the file downloaded is
 just a plain text file.

 so
 question 1, how to create zip Archive file in memory on the fly and
 download it (I don't have to save it on disk)?
 question 2, if there is no way to create in memory, is it safe to just
 unlink() the file?

 thanks in advance.

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



 According to http://docs.php.net/manual/en/wrappers.php.php, it looks
 like you should be using ...

 $filename = 'php://temp';

 That's it.

 The actual file name is not your job.



 --
 -
 Richard Quadling
 Standing on the shoulders of some very clever giants!
 EE : http://www.experts-exchange.com/M_248814.html
 EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
 Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
 ZOPA : http://uk.zopa.com/member/RQuadling


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



Re: [PHP] Create .php file with php

2007-07-03 Thread Richard Lynch
On Mon, June 25, 2007 7:13 pm, Marius Toma wrote:
 I 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?

There is nothing whatsoever in PHP nor Apache to stop you from writing
files whose names happen to end in .php

Whatever else you did differently for the .php files is what messed
you up, not the filenames.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Create .php file with php [POC CODE INCLUDED]

2007-06-27 Thread Crayon Shin Chan
On Wednesday 27 June 2007 06:32, Edward Vermillion wrote:

 Most /tmp directories are world rwx. So anyone that can log into the
 server through a shell, or any account running on the server, has at
 least read access to anything in the /tmp directory. They wouldn't
 need to do it through a web script.

On a production machine the only people who should be logging in would be 
doing system admin stuff and hence implicitly trusted. If you have 
determined hostile users logged in then whether you hide your 
files in /tmp or in a directory only accessible by the webserver is 
hardly relevant. Similarly the same poc can be used just as well 
on /tmp as well as on a directory only accessible by the webserver.

-- 
Crayon

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



Re: [PHP] Create .php file with php

2007-06-26 Thread Marius Toma

I can not believe how stupid I can be sometime.

I was trying to create a file, but a file with the same name already 
existed on the server - and I did not have the write permission to it, 
so from here I got the error message saying that I can not create the 
file :(


Thank for your time,
Marius

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



Re: [PHP] Create .php file with php

2007-06-26 Thread Tijnema

On 6/26/07, Marius Toma [EMAIL PROTECTED] wrote:

I can not believe how stupid I can be sometime.

I was trying to create a file, but a file with the same name already
existed on the server - and I did not have the write permission to it,
so from here I got the error message saying that I can not create the
file :(

Thank for your time,
Marius


Don't worry, you're not the only one who posts to this list, and just
a little time later finds out that it was a little stupid thing...

Tijnema
--
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info

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



Re: [PHP] Create .php file with php

2007-06-26 Thread Daniel Brown

On 6/26/07, Marius Toma [EMAIL PROTECTED] wrote:

I can not believe how stupid I can be sometime.

I was trying to create a file, but a file with the same name already
existed on the server - and I did not have the write permission to it,
so from here I got the error message saying that I can not create the
file :(

Thank for your time,
Marius

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




   If you absolutely *must* create PHP files on-the-fly, and only
need them for a one-off thing, put them in a specific directory that
only the web server has access to read, write, and execute, and then
delete the files immediately after you've used them as needed.


--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] Create .php file with php

2007-06-26 Thread Daniel Brown

On 6/26/07, Daniel Brown [EMAIL PROTECTED] wrote:

On 6/26/07, Marius Toma [EMAIL PROTECTED] wrote:
 I can not believe how stupid I can be sometime.

 I was trying to create a file, but a file with the same name already
 existed on the server - and I did not have the write permission to it,
 so from here I got the error message saying that I can not create the
 file :(

 Thank for your time,
 Marius

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



If you absolutely *must* create PHP files on-the-fly, and only
need them for a one-off thing, put them in a specific directory that
only the web server has access to read, write, and execute, and then
delete the files immediately after you've used them as needed.


--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107



If you absolutely *must* create PHP files on-the-fly, and only
need them for a one-off thing, put them in a specific directory that
only the web server has access to read, write, and execute, and then
delete the files immediately after you've used them as needed.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] Create .php file with php

2007-06-26 Thread Daniel Brown

On 6/26/07, Marius Toma [EMAIL PROTECTED] wrote:

I can not believe how stupid I can be sometime.

I was trying to create a file, but a file with the same name already
existed on the server - and I did not have the write permission to it,
so from here I got the error message saying that I can not create the
file :(

Thank for your time,
Marius

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




If you absolutely *must* create PHP files on-the-fly, and only
need them for a one-off thing, put them in a specific directory that
only the web server has access to read, write, and execute, and then
delete the files immediately after you've used them as needed.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] Create .php file with php

2007-06-26 Thread Adam Schroeder
You might also consider looking at variable variables and dynamic PHP 
(writing and evaluating php expressions on the fly). 


http://us.php.net/variables.variable
http://us.php.net/eval

Writing the PHP to a file could be a potential security vulnerability.  
Especially if this was going to go into usage within a high usage web 
app. =)


Adam


Daniel Brown wrote:


On 6/26/07, Marius Toma [EMAIL PROTECTED] wrote:


I can not believe how stupid I can be sometime.

I was trying to create a file, but a file with the same name already
existed on the server - and I did not have the write permission to it,
so from here I got the error message saying that I can not create the
file :(

Thank for your time,
Marius

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




If you absolutely *must* create PHP files on-the-fly, and only
need them for a one-off thing, put them in a specific directory that
only the web server has access to read, write, and execute, and then
delete the files immediately after you've used them as needed.



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



Re: [PHP] Create .php file with php

2007-06-26 Thread Al
Would it not be better to create the file with tmpfile() and to put it in the 
system /tmp dir; which, I believe, is generally not in the webspace?






Daniel Brown wrote:

On 6/26/07, Marius Toma [EMAIL PROTECTED] wrote:

I can not believe how stupid I can be sometime.

I was trying to create a file, but a file with the same name already
existed on the server - and I did not have the write permission to it,
so from here I got the error message saying that I can not create the
file :(

Thank for your time,
Marius

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




   If you absolutely *must* create PHP files on-the-fly, and only
need them for a one-off thing, put them in a specific directory that
only the web server has access to read, write, and execute, and then
delete the files immediately after you've used them as needed.




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



Re: [PHP] Create .php file with php

2007-06-26 Thread Daniel Brown

On 6/26/07, Al [EMAIL PROTECTED] wrote:

Would it not be better to create the file with tmpfile() and to put it in the
system /tmp dir; which, I believe, is generally not in the webspace?


   The problem here, though, Al, is that it relies on the server
admin not to be lazy, and to have the box properly configured.  Else,
any files in the /tmp directory can easily be ready by anyone on the
same machine.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] Create .php file with php

2007-06-26 Thread Daniel Brown

On 6/26/07, Al Rider [EMAIL PROTECTED] wrote:

I thought that the php engine took care of deleting tmp files when the
script ended.

Thus, if his script is terminated before his code deletes the file, the
engine will insure it's deleted.  Otherwise, he should use an
ignore_user_abort().


   You're right, and good point about ignore_user_abort();.  I'd
actually never used that function before, but there are several places
where I could (and probably should).

   The point I was making is that, unless the server is set up
properly, as the files exist on the server, they'll be readable,
clone-able, and possibly even executable.  All a malicious user would
need to do is watch the /tmp directory for files being written and
immediately copy or read them.  This doesn't take into account proper
usage of suexec, correct chmod'ing of /tmp (and mounting, if you're
like myself), et cetera, but keep in mind that not all (perhaps even
most) hosting providers out there are one-man operations, and a gross
majority of those are run by people with almost no knowledge of - or
maybe concern for - best practices regarding their customer's
security.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] Create .php file with php [POC CODE INCLUDED]

2007-06-26 Thread Daniel Brown

On 6/26/07, Al Rider [EMAIL PROTECTED] wrote:

I think most systems have a /tmp directory above the web dir, so
outsiders can't watch it anyhow.


   True, but on an unsecured box, this becomes possible, as Apache
will most likely be running universally as `nobody`, `httpd`,
`apache`, or `daemon` for all scripts, including all web-based scripts
writing to the /tmp directory.  This includes session information,
temporary .php files (as Marius requested), et cetera.

   Proof of concept:

?

if(is_dir('/tmp')) {
   $handle = opendir('/tmp');
   while(False !== ($ls_file = readdir($handle))) {
   if(is_file('/tmp/'.$ls_file)) {
   echo  /tmp/.$ls_file.: \n;
   $filename = fopen('/tmp/'.$ls_file,r);
   fread($filename,filesize($filename));
   echo  END .$ls_file. \n;
   }
   }
}

closedir($handle);

?


--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] Create .php file with php [POC CODE INCLUDED]

2007-06-26 Thread Crayon Shin Chan
On Wednesday 27 June 2007 03:53, Daniel Brown wrote:
 On 6/26/07, Al Rider [EMAIL PROTECTED] wrote:
  I think most systems have a /tmp directory above the web dir, so
  outsiders can't watch it anyhow.

 True, but on an unsecured box, this becomes possible, as Apache
 will most likely be running universally as `nobody`, `httpd`,
 `apache`, or `daemon` for all scripts, including all web-based scripts
 writing to the /tmp directory.  This includes session information,
 temporary .php files (as Marius requested), et cetera.

How is this different from:

put them in a specific directory that only the web server has access to 
read, write, and execute

-- 
Crayon

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



Re: [PHP] Create .php file with php [POC CODE INCLUDED]

2007-06-26 Thread Daniel Brown

On 6/26/07, Crayon Shin Chan [EMAIL PROTECTED] wrote:

On Wednesday 27 June 2007 03:53, Daniel Brown wrote:
 On 6/26/07, Al Rider [EMAIL PROTECTED] wrote:
  I think most systems have a /tmp directory above the web dir, so
  outsiders can't watch it anyhow.

 True, but on an unsecured box, this becomes possible, as Apache
 will most likely be running universally as `nobody`, `httpd`,
 `apache`, or `daemon` for all scripts, including all web-based scripts
 writing to the /tmp directory.  This includes session information,
 temporary .php files (as Marius requested), et cetera.

How is this different from:

put them in a specific directory that only the web server has access to
read, write, and execute

--
Crayon

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




   There were more posts that someone hadn't sent to the list,
whereas I replied to the list.  I didn't pay attention to see if the
posts were included or not.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] Create .php file with php [POC CODE INCLUDED]

2007-06-26 Thread Edward Vermillion


On Jun 26, 2007, at 3:31 PM, Crayon Shin Chan wrote:


On Wednesday 27 June 2007 03:53, Daniel Brown wrote:

On 6/26/07, Al Rider [EMAIL PROTECTED] wrote:

I think most systems have a /tmp directory above the web dir, so
outsiders can't watch it anyhow.


True, but on an unsecured box, this becomes possible, as Apache
will most likely be running universally as `nobody`, `httpd`,
`apache`, or `daemon` for all scripts, including all web-based  
scripts

writing to the /tmp directory.  This includes session information,
temporary .php files (as Marius requested), et cetera.


How is this different from:

put them in a specific directory that only the web server has  
access to

read, write, and execute



Most /tmp directories are world rwx. So anyone that can log into the  
server through a shell, or any account running on the server, has at  
least read access to anything in the /tmp directory. They wouldn't  
need to do it through a web script.


At least if the temp directory is rwx web server only, shell logins  
and other accoounts are denied access. Any web script can still get  
to it though.


Ed

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



Re: [PHP] Create .php file with php [POC CODE INCLUDED]

2007-06-26 Thread Adam Schroeder
... if you really couldn't write it as dynamic PHP -- you could also 
save it in a database.



Edward Vermillion wrote:



On Jun 26, 2007, at 3:31 PM, Crayon Shin Chan wrote:


On Wednesday 27 June 2007 03:53, Daniel Brown wrote:


On 6/26/07, Al Rider [EMAIL PROTECTED] wrote:


I think most systems have a /tmp directory above the web dir, so
outsiders can't watch it anyhow.



True, but on an unsecured box, this becomes possible, as Apache
will most likely be running universally as `nobody`, `httpd`,
`apache`, or `daemon` for all scripts, including all web-based  scripts
writing to the /tmp directory.  This includes session information,
temporary .php files (as Marius requested), et cetera.



How is this different from:

put them in a specific directory that only the web server has  
access to

read, write, and execute



Most /tmp directories are world rwx. So anyone that can log into the  
server through a shell, or any account running on the server, has at  
least read access to anything in the /tmp directory. They wouldn't  
need to do it through a web script.


At least if the temp directory is rwx web server only, shell logins  
and other accoounts are denied access. Any web script can still get  
to it though.


Ed



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



[PHP] Create .php file with php

2007-06-25 Thread Marius Toma
I 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,
Marius

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



Re: [PHP] Create .php file with php

2007-06-25 Thread Daniel Brown

On 6/25/07, Marius Toma [EMAIL PROTECTED] wrote:

I 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,
Marius

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




   I doubt it will help you, but with a default installation of 5.2.2
on a Linux box (fresh install), I was able to do this from the CLI
with no issues whatsoever:
?
   $handle = fopen('writetest.php','w');
   fwrite($handle,This is a test.);
?

   I know that you said that you were able to write a file, but are
you using the correct parameters in your .php writes to create or
append to a file (as needed), and are the write permissions set
properly for the exact directory to which you're attempting to write?


--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Fwd: [PHP] Create .php file with php

2007-06-25 Thread Daniel Brown

   Hmm Google gave me an error when sending before.

-- Forwarded message --
From: Daniel Brown [EMAIL PROTECTED]
Date: Jun 25, 2007 8:28 PM
Subject: Re: [PHP] Create .php file with php
To: Marius Toma [EMAIL PROTECTED]
Cc: php-general@lists.php.net


On 6/25/07, Marius Toma [EMAIL PROTECTED] wrote:

I 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,
Marius

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




   I doubt it will help you, but with a default installation of 5.2.2
on a Linux box (fresh install), I was able to do this from the CLI
with no issues whatsoever:
?
   $handle = fopen('writetest.php','w');
   fwrite($handle,This is a test.);
?

   I know that you said that you were able to write a file, but are
you using the correct parameters in your .php writes to create or
append to a file (as needed), and are the write permissions set
properly for the exact directory to which you're attempting to write?


--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107


--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] Create .php file with php

2007-06-25 Thread jekillen


On Jun 25, 2007, at 5:13 PM, Marius Toma wrote:

I 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,
Marius

I 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

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



Re: [PHP] Create .php file with php

2007-06-25 Thread jekillen


On Jun 25, 2007, at 9:08 PM, jekillen wrote:



On Jun 25, 2007, at 5:13 PM, Marius Toma wrote:

I 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,
Marius

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

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)

JK


--
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] Create MDB File

2005-03-29 Thread gustav
What's the reason reason converting from MySQL to Access? *curious*

/G
@varupiraten.se



 Thanks for your reply,

 but this only works on Windows. I need a program that will create an MDB
 file on the fly from a query on the MySQL database...


 Johannes Findeisen [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 Sorry,

 i forgot that link:

 http://www.convert-in.com/sql2acc.htm


 On Monday 28 March 2005 22:46, Johannes Findeisen wrote:
 Hello,

 i had the same problem some years ago. At this time i have set up all
 tables in Access and wrote a script which reads from MySQL and inserts
 into
 the MDB file via the ODBC connector. This works but is much work when
 your
 database is very big.

 2 Years ago i had the same problem but it must go as fast as possible
 so
 i
 decided to buy a converteer since i didn't find anything free. They are
 working very good. I don't know where i have buyed them but i think
 there
 is only one company which delivers this software.

 Regards
 Johannes

 On Monday 28 March 2005 22:08, Shaun wrote:
  Hi,
 
  Does anyone know if its possible to create an MDB file from a Mysql
  database using a PHP script, I have only managed to find Access to
  Mysql
  conversion programs so far...
 
  Thanks for your help

 --
 # Johannes Findeisen

 --
 # Johannes Findeisen

 --
 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] Create MDB File

2005-03-28 Thread Shaun
Hi,

Does anyone know if its possible to create an MDB file from a Mysql database 
using a PHP script, I have only managed to find Access to Mysql conversion 
programs so far...

Thanks for your help 

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



Re: [PHP] Create MDB File

2005-03-28 Thread Johannes Findeisen
Hello,

i had the same problem some years ago. At this time i have set up all tables 
in Access and wrote a script which reads from MySQL and inserts into the MDB 
file via the ODBC connector. This works but is much work when your database 
is very big.

2 Years ago i had the same problem but it must go as fast as possible so i 
decided to buy a converteer since i didn't find anything free. They are 
working very good. I don't know where i have buyed them but i think there is 
only one company which delivers this software.

Regards
Johannes

On Monday 28 March 2005 22:08, Shaun wrote:
 Hi,

 Does anyone know if its possible to create an MDB file from a Mysql
 database using a PHP script, I have only managed to find Access to Mysql
 conversion programs so far...

 Thanks for your help

-- 
# Johannes Findeisen

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



Re: [PHP] Create MDB File

2005-03-28 Thread Johannes Findeisen
Sorry,

i forgot that link:

http://www.convert-in.com/sql2acc.htm


On Monday 28 March 2005 22:46, Johannes Findeisen wrote:
 Hello,

 i had the same problem some years ago. At this time i have set up all
 tables in Access and wrote a script which reads from MySQL and inserts into
 the MDB file via the ODBC connector. This works but is much work when your
 database is very big.

 2 Years ago i had the same problem but it must go as fast as possible so i
 decided to buy a converteer since i didn't find anything free. They are
 working very good. I don't know where i have buyed them but i think there
 is only one company which delivers this software.

 Regards
 Johannes

 On Monday 28 March 2005 22:08, Shaun wrote:
  Hi,
 
  Does anyone know if its possible to create an MDB file from a Mysql
  database using a PHP script, I have only managed to find Access to Mysql
  conversion programs so far...
 
  Thanks for your help

 --
 # Johannes Findeisen

-- 
# Johannes Findeisen

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



Re: [PHP] Create MDB File

2005-03-28 Thread Shaun
Thanks for your reply,

but this only works on Windows. I need a program that will create an MDB 
file on the fly from a query on the MySQL database...


Johannes Findeisen [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Sorry,

 i forgot that link:

 http://www.convert-in.com/sql2acc.htm


 On Monday 28 March 2005 22:46, Johannes Findeisen wrote:
 Hello,

 i had the same problem some years ago. At this time i have set up all
 tables in Access and wrote a script which reads from MySQL and inserts 
 into
 the MDB file via the ODBC connector. This works but is much work when 
 your
 database is very big.

 2 Years ago i had the same problem but it must go as fast as possible so 
 i
 decided to buy a converteer since i didn't find anything free. They are
 working very good. I don't know where i have buyed them but i think there
 is only one company which delivers this software.

 Regards
 Johannes

 On Monday 28 March 2005 22:08, Shaun wrote:
  Hi,
 
  Does anyone know if its possible to create an MDB file from a Mysql
  database using a PHP script, I have only managed to find Access to 
  Mysql
  conversion programs so far...
 
  Thanks for your help

 --
 # Johannes Findeisen

 -- 
 # Johannes Findeisen 

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



[PHP] create a file

2004-01-26 Thread Viviane Hu
hi,

How can I create a file (txt) in client-side?


Thanks a lot for you help.

viviane


Re: [PHP] create a file

2004-01-26 Thread Raditha Dissanayake
Hi,

Certainly not with PHP! you will need to use a signed java applet or an 
activex
all the best

Viviane Hu wrote:

hi,

How can I create a file (txt) in client-side?

Thanks a lot for you help.

viviane

 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] create a file

2004-01-26 Thread Matt Matijevich
snip
How can I create a file (txt) in client-side?
/snip

I dont think there is a way unless you are using some kind of java
applet.  You can create the text on the server and give the user a link
to save the text file on their computer.

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



[PHP] Create PDF FIle

2004-01-20 Thread Mike Mapsnac
Hello

I want to create PDF file from PHP output. So instead of sending output to 
the browser, I need to insert PHP output  into PDF FILE. How that's can be 
done? Looking for some short example or some documentation.

Thanks

_
Let the new MSN Premium Internet Software make the most of your high-speed 
experience. http://join.msn.com/?pgmarket=en-uspage=byoa/premST=1

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


RE: [PHP] create a file?

2002-05-23 Thread John Holmes

www.php.net/fopen

---John Holmes...

 -Original Message-
 From: Nick Wilson [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, May 23, 2002 7:29 AM
 To: php-general
 Subject: [PHP] create a file?
 
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Hi
 I'm clearly missing the obvious here ;-) but I can't seem to find a
 function for creating a text file? Can someone please point me in the
 right direction?
 
 Many thanks...
 - --
 Nick Wilson //  www.explodingnet.com
 
 
 
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.0.6 (GNU/Linux)
 
 iD8DBQE87NKXHpvrrTa6L5oRAm3IAJ0UZ/Tjwvht4jzOeckH/d+k2IhXdwCggNWZ
 Dg1MjMX0o14J5MVSqh42ZR8=
 =1mmr
 -END PGP SIGNATURE-
 
 --
 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] create a file?

2002-05-23 Thread Nick Wilson

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


* and then John Holmes declared
 www.php.net/fopen

Damn! I looked at that (of course) but must have missed it. Jeez, I
looked at that page twice!

Thanks John.
- -- 
Nick Wilson //  www.explodingnet.com



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE87NY6HpvrrTa6L5oRAorpAJ44qLfWZciGD7p5ge77io86IMQIwwCgp6WE
ZDlC49dRhB7yflJ6HU4cr2Q=
=QFS5
-END PGP SIGNATURE-

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




[PHP] create a file

2002-02-28 Thread Thomas Franz

good morning,

i want to create a new file and save it in the current dir I look in the
manual but only i found how to create a dir

Thanks for help

Thomas



-- 
PHP General Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




RE: [PHP] create a file

2002-02-28 Thread Niklas Lampén

fopen(file, w)

-Original Message-
From: Thomas Franz [mailto:[EMAIL PROTECTED]] 
Sent: 1. maaliskuuta 2002 9:55
To: [EMAIL PROTECTED]
Subject: [PHP] create a file


good morning,

i want to create a new file and save it in the current dir. I look in
the manual but only i found how to create a dir.

Thanks for help.

Thomas



-- 
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] create a file .png

2002-01-07 Thread aurelio

Hi, i wanna create a file png, but i don´t want.

i don´t know what happens but an error occurs...

Warning: ImagePng: unable to open /home/httpd/html/pollolitoral/tempo/07012002.png for 
writing in /home/httpd/html/admin/generic/create_png_clima.php3 on line 80

i put imagepng($img,pollolitoral/tempo/07012002.png);
 
please, help me

Aurélio Sabino



RE: [PHP] create a file .png

2002-01-07 Thread Michael Geier

problems with this email:
- no script to look at

problems with the script:
- directory permissions?
- gd installation incomplete?
- php installation missing gd?

-Original Message-
From: aurelio [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 07, 2002 12:46 PM
To: [EMAIL PROTECTED]
Subject: [PHP] create a file .png


Hi, i wanna create a file png, but i don´t want.

i don´t know what happens but an error occurs...

Warning: ImagePng: unable to open
/home/httpd/html/pollolitoral/tempo/07012002.png for writing in
/home/httpd/html/admin/generic/create_png_clima.php3 on line 80

i put imagepng($img,pollolitoral/tempo/07012002.png);

please, help me

Aurélio Sabino


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]