php-general Digest 2 Feb 2005 10:37:10 -0000 Issue 3263
Topics (messages 207863 through 207881):
Re: Escaped characters
207863 by: Richard Lynch
Re: Problem with SELECT SQL_CALC_FOUND_ROWS
207864 by: Richard Lynch
File upload difference between browsers
207865 by: Graham Cossey
207867 by: Richard Lynch
207869 by: Marek Kilimajer
Re: stream_set_timeout() mystery
207866 by: Richard Lynch
Re: XML-RPC problem with array
207868 by: Richard Lynch
Re: Switch Form
207870 by: Richard Lynch
Re: cal_days_in_month() missing, how can I tell if it exists
207871 by: James Kaufman
207872 by: RaTT
Required the speakers for LAMP at HYD on 18th or 19th for OU and LUG HYD EVENT
207873 by: Sasidhar Kalagara
Re: mail problem at interland
207874 by: kids_pro
207875 by: kids_pro
Re: Credit card storing, for processing
207876 by: Angelo Zanetti
Re: fsockopen
207877 by: Bostjan Skufca . domenca.com
regular expresion
207878 by: php
207881 by: Mirco Blitz
how create system users with php
207879 by: Umar Draz
PHP Memory limit exceeded
207880 by: Ben-Nes Yonatan
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 ---
Brian Dunning wrote:
> I am storing some text from forms into MySQL as base64_encode(). So far
> this has worked well at dealing with weird characters. But when I
> output it, everything is escaped with \. I can't replace those out with
> '' since sometimes they are supposed to be in there. What's the best
> way to output this text from the database and not have the \ visible?
The problem is, almost for sure, that your data had
http://php.net/addslashes called on it, possibly because "magic quotes
gpc" was turned on.
So when you then base64_encode() it, the extra slashes that are there for
MySQL to "know" what is data rather than syntax are *ALSO* turned into
data in your base64-encoded content.
Your choices are:
Fix the original source code that called *both* addslashes (directory or
indirectly through magic quotes)
Or, be stuck with bogus data and always have to remember to call
http://php.net/stripslashes on it after you base64_decode() it.
The first solution is preferrable, but you'll need to:
Record the record number where the data is currently bogus.
Fix the source to NOT call addslashes + base64_encode
Copy out all the bogus records.
Call base64_decode/strip_slashes/base64_encode and store that result back in
In the short-sighted view, it looks easier to just do the second solution
-- but every time you come back to this data, you'll curse yourself for
that...
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
Matt Babineau wrote:
> Ok I installed PHP 4.3.10 and it still has not fixed the problem. If I
> remove the SQL_CALC_FOUND_ROWS from the query, it works no problems! This
> is
> very strange behavior!
Not really that strange, I think...
While you might want to read this:
http://us4.php.net/manual/en/faq.databases.php#faq.databases.upgraded
It sounds like your problem is more closely related to this:
http://bugs.php.net/bug.php?id=16906&edit=1
paying particular attention to this bit:
[1 Oct 2002 4:37am CEST] g at firebolt dot com
I was able to solve this bug by doing the following... granted, the bug
only existed for me once I had a table with > 90000 rows.
Run a:
SET SQL_BIG_TABLES=1;
And MySQL will utilize more memory and be able to save the result set.
Optionally, when done, do this:
SET SQL_BIG_TABLES=0;
(tip courtesy of:
http://www.faqts.com/knowledge_base/view.phtml/aid/9824)
Keep in mind that when you do SQL_CALC_FOUND_ROWS MySQL has to do a BUNCH
more work and MySQL and PHP have to save a TON of temporary somewhere for
a large table.
So if your tables are large, or if you are doing a JOIN between two
moderate sized tables, it seems quite possible to me that
SQL_CALC_FOUND_ROWS will trigger a problem with running out of storage
space, when the same query without it won't trigger that problem.
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
I have a problem uploading a file in IE6 or Firefox1.0 but it works
fine using Opera7.54.
The problem is that I want to ensure that the file being uploaded is a
CSV file, so I test the $_FILES['file']['type'] value.
In Firefox & IE it is returned as "application/octet-stream" but in
Opera it is returned as "text/comma-separated-values", the latter
being what I would expect.
The posting form has: enctype="multipart/form-data"
Can anyone offer some advice on how I can reliably test for a valid CSV file?
(At least I have some security built-in, in so much as you have to use
Opera to upload files !!)
--
Graham
--- End Message ---
--- Begin Message ---
Graham Cossey wrote:
> The problem is that I want to ensure that the file being uploaded is a
> CSV file, so I test the $_FILES['file']['type'] value.
That only ensures that somebody else can forge the type header being sent
to you.
Anybody with half a clue (okay, a clue and a half) could do that:
telnet example.com 80
POST /your_form.php HTTP/1.1
Host: example.com
Content-type: text/comma-separated-values
INSERT FAVORITE TROJAN WORM HERE
So it's pretty useless as a security measure...
> In Firefox & IE it is returned as "application/octet-stream" but in
> Opera it is returned as "text/comma-separated-values", the latter
> being what I would expect.
Plus, as you have discovered, the browser manufacturers have absolutely no
concept of "standards" when it comes to setting Content-type: on an
uploaded file.
> Can anyone offer some advice on how I can reliably test for a valid CSV
> file?
Actually, you're very lucky on this one, in that you can use
http://php.net/fgetcsv on it, repeatedly, and either PHP has an error, or
PHP doesn't, and then you KNOW it parses as a valid CSV file, from
beginning to end.
So, what you *MIGHT* do would be something like this:
<?php
.
.
.
flush();
ob_start();
$old_reporting = error_reportin(E_ALL | E_STRICT);
$csv = fopen($_FILES['file']['tmpname']) or print("ERROR: could not open "
. $_FILES['file']['tmpname']);
if ($csv){
while (!feof($csv)){
$line = fgetcsv($csv, 1000000); //Lose the 1000000 in PHP 5
}
}
$php_output = ob_get_clean();
if (stristr($php_output, 'Error') || stristr($php_output, 'Warning') ||
stristr($php_output, 'Notice')){
//NOT a valid CSV file
}
else{
//CSV file is valid
}
//play nice, and set it back to what it was.
error_reporting($old_reporting);
?>
You may not be able to READ $_FILE['file']['tmpname'], so you'd have to
move_uploaded_file() it to a staging area first, and then read that.
You might want to play around with the error_reporting setting a bit, and
a bunch of CSV test files from different sources.
You may want to rule that ANY output (strlen($php_output)) is indicative
of an error, rather than checking for 'Error' 'Warning' 'Notice' as I
did... In fact, that would probably be better.
If the files might be large, you may want to cache the CSV data you read,
and then you can use it later in your script, after you've read the whole
thing in and you know it's kosher... Course, if it's REALLY large, you'll
want to cache that in something like a temp table in MySQL or something,
just so you won't fill up RAM with some monster Array in PHP...
For a small CSV file, it really won't matter that much if you read it
twice -- It will probably be in the File System cache for you anyway,
depending on server load.
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
Graham Cossey wrote:
I have a problem uploading a file in IE6 or Firefox1.0 but it works
fine using Opera7.54.
The problem is that I want to ensure that the file being uploaded is a
CSV file, so I test the $_FILES['file']['type'] value.
In Firefox & IE it is returned as "application/octet-stream" but in
Opera it is returned as "text/comma-separated-values", the latter
being what I would expect.
The posting form has: enctype="multipart/form-data"
Can anyone offer some advice on how I can reliably test for a valid CSV file?
(At least I have some security built-in, in so much as you have to use
Opera to upload files !!)
In Mozilla, you can go to Preferences -> Naviator -> Helper
Applications. Then click "New Type", fill in MIME type, description and
extension, and that should be it. And then ask everyone to do that :)
Or better don't rely on client supplied values. You can use
mime_content_type() to find out the real mime type.
--- End Message ---
--- Begin Message ---
Al wrote:
> I can't use a bad URL because the fopen fails.
Sorry, that was silly of me.
> I assumed from reading the manual that if I started stream_set_timeout()
> it
> would monitor the stream and do something when it reached the timeout,
> either
> truncate my data stream or show up as [timed_out] => true. It doesn't
> appear to
> do anything.
>
> I can set the timeout down to microseconds and/or read a 4mb remote file
> and
> nothing appears to happen. The 4mb file is read fully and [timed_out] =>
> never
> changes for small or large files, microseconds or 600 seconds.
>
> I did a function_exists() on stream_set_timeout() and it's fine and I have
> all
> errors on and nothing unusual shows up.
>
> php version is 4.3.10
But the timeout ONLY happens when the remote server *FAILS* to deliver the
data in the time-frame specified.
File size is irrelevant, if the connection is good and solid, and the
remote server is not busy/interrupted.
Setting it to microseconds, and trying to get something over a slow
connection would maybe (MAYBE) be a valid test.
Or, if you really think a large file will cause the time-out, then use a
LARGE file. 4Mb is not a large file. 400Mb is a large file. :-)
Or, if you control a development server, connect to your own server and
start a big download, and UNPLUG the ethernet cable from the "remote"
server half-way through download.
If it still doesn't crap out, then there's something wrong. Actually, it
would be very magical, wonderful, and nice if you could make it still work
with the cable unplugged :-)
My point is that you haven't tested anything if the data comes through all
right -- Everything "works" is not an indication of a problem.
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
Bambero wrote:
> Hello
>
> I have compiled my php with --with-xmlrpc option to use xmlrpc server.
> Everything works fine, but there is one problem.
>
> Array (indexed from 0):
> $array[0]
> $array[1]
> $array[2]
> is changed to xmlrpc 'array' type - thats ok.
>
> Array (with string indexes):
> $array['ad']
> $array['sd']
> $array['rd']
> is changed to xmlrpc 'struct' type - thats ok too.
>
> But array (indexed from 1):
> $array[1]
> $array[2]
> $array[3]
> is changed to xmlrpc 'array' type.
>
> Is it possible to change this type to xmlrpc 'struct' type ?
I'll bet that if you did:
$array['1'] = 'whatever';
it would turn into a struct.
The crucial difference being that your KEYS are strings in the ones that
get turned into struct.
I bet that you only need to set *ONE* array element key to a string if you
can't change all of them:
<?php
//Force string key so XML uses struct, not array:
$array['1'] = $array[1];
unset($array[1]);
?>
No promise on what ORDER the key/values will come out if you do that -- If
you care about order, you're gonna have to re-do the whole array, almost
for sure.
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
Lancer Emotion 16 wrote:
> <form name='form1' action='page.php' method='Post'>
> </form>
>
> <form name='form2' action='page.php method='Post''>
> </form>
>
> Now, in page.php is possible to do a switch of form name? Something like
> this :
>
> Switch ($_POST['form'] {
> 'form1' : ...
> 'form2' : ...
> }
>
> If this is possible,i dont know how to call it, can you help me please?
The NAME attribute on a FORM tag is not sent via HTTP by any browser.
W3C HTML 4.01 spec says it's only there "style sheets or scripts" but is
only there for compatibility and you should use id attribute -- which is
ALSO not sent by any browser I know of.
Perhaps the spec should read "client scripts" since clearly these are
useless for server scripts dealing with the submitted form, if you read
the form submission specification.
Assuming you can stay awake enough to read that sucker... :-)
To solve your problem, you'll need to have <INPUT TYPE="HIDDEN"
NAME="form" VALUE="form1"> on the first form and use form2 on the second
form.
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
On Tue, Feb 01, 2005 at 08:47:29PM +0000, Ben Edwards wrote:
> I have been implementing a system on a different ISP than I normally use
> and have got:-
>
> Fatal error: Call to undefined function: cal_days_in_month()
> in
> /home/hosted/www.menublackboard.com/public_html/dev/classes/validator.class.php
> on line 134
>
> I found a reference to this an the web and it seems PHP is not compiled
> with calender support.
>
> "recompile php with the "--enable-calendar" option."
>
> Cant see being able to get the to re-compile PHP so I guess I am going
> to have to disable the feature. I seem to remember a while ago seeing a
> function to test weather a function exists in PHP. That way I can have
> the relevant validation skipped if the function is missing (I will tell
> the client if they get decent hosting it will start working).
>
> So something like
>
> function_exists( cal_days_in_month() )
>
> Anyone know what the function is called.
>
> Ben
>
I do this:
if (!extension_loaded('calendar'))
{
/*
* cal_days_in_month($month, $year)
* Returns the number of days in a given month and year,
* taking into account leap years.
*
* $month: numeric month (integers 1-12)
* $year: numeric year (any integer)
*
* Prec: $month is an integer between 1 and 12, inclusive
* $year is an integer.
* Post: none
*/
function cal_days_in_month($month, $year)
{
return $month == 2 ? $year % 4 ? 28 : 29 : ($month % 7 % 2 ? 31 : 30);
}
}
--
Jim Kaufman
Linux Evangelist
public key 0x6D802619, CISSP# 65668
http://www.linuxforbusiness.net
---
The shortest distance between two points is through Hell.
--Brian Clark
--- End Message ---
--- Begin Message ---
Hi James,
http://uk.php.net/manual/en/function.function-exists.php, should help
you on your way.
hth
Jarratt
On Tue, 1 Feb 2005 18:57:12 -0600, James Kaufman
<[EMAIL PROTECTED]> wrote:
> On Tue, Feb 01, 2005 at 08:47:29PM +0000, Ben Edwards wrote:
> > I have been implementing a system on a different ISP than I normally use
> > and have got:-
> >
> > Fatal error: Call to undefined function: cal_days_in_month()
> > in
> > /home/hosted/www.menublackboard.com/public_html/dev/classes/validator.class.php
> > on line 134
> >
> > I found a reference to this an the web and it seems PHP is not compiled
> > with calender support.
> >
> > "recompile php with the "--enable-calendar" option."
> >
> > Cant see being able to get the to re-compile PHP so I guess I am going
> > to have to disable the feature. I seem to remember a while ago seeing a
> > function to test weather a function exists in PHP. That way I can have
> > the relevant validation skipped if the function is missing (I will tell
> > the client if they get decent hosting it will start working).
> >
> > So something like
> >
> > function_exists( cal_days_in_month() )
> >
> > Anyone know what the function is called.
> >
> > Ben
> >
>
> I do this:
>
> if (!extension_loaded('calendar'))
> {
> /*
> * cal_days_in_month($month, $year)
> * Returns the number of days in a given month and year,
> * taking into account leap years.
> *
> * $month: numeric month (integers 1-12)
> * $year: numeric year (any integer)
> *
> * Prec: $month is an integer between 1 and 12, inclusive
> * $year is an integer.
> * Post: none
> */
> function cal_days_in_month($month, $year)
> {
> return $month == 2 ? $year % 4 ? 28 : 29 : ($month % 7 % 2 ? 31 : 30);
> }
> }
>
> --
> Jim Kaufman
> Linux Evangelist
> public key 0x6D802619, CISSP# 65668
> http://www.linuxforbusiness.net
> ---
> The shortest distance between two points is through Hell.
> --Brian Clark
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
hello geeks,
Linux User Group, Hyderabad and Osmanina University College of
Enginnering in together are condcuting the follwing events.
And about the events:
Lug Festiva ( linux workshop)
Literati quest (paper presentation)
Promethean (project contest)
Bugs maze ( debugging contest)
Kloning (code duplicator)
Brookz law (this is a half an hour event)
Erudites world (panel discussion)
Tech Gyan ( expert talk)
Acuity Revival (Online Programming Contest )
IT Quiz
Gaming zone
I am enclosing a brochure with this mail, in
which we have the details of the events that we are
proposed to organize and more.
For more info visit
http://infinity2k5.cseouce.ac.in
The LUG Festiva is completly sponsered by LUG and we need speakers for
Lamp. so if any of u guys are willing to be part of that event pls get
back to me. we need speakers For Lamp allotted time is 1hr. so pls get
back to us if anybody is intrested. hoping to see positive response
from ur end.
regards
sasi
--- End Message ---
--- Begin Message ---
Does PEAR installed in most Linux hosting box?
--- End Message ---
--- Begin Message ---
Does PEAR installed in most Linux hosting box?
--- End Message ---
--- Begin Message ---
HI Richard,
thanks for the info. With regard to the setup it will be something more
or less like this:
I want to generate my own keypair. The private key I keep secure,
offline,
on the machine that does the admin (charging, refunds etc). The public
key is used on the server to encrypt card details the minute they
arrive
on the server (even using SSL, the data will arrive unencrypted
because the web server decrypts it).
Encrypted card details are written to file, and moved off the server
overnight by a cron job.
On the admin machine, offline, the details get decrypted when needed
to perform transactions, using the private key.
The admin box is on ADSL, but behind a firewall with no services or
ports
open to the internet. I.e it can initiate a connection to the server
on
the internet, but not the other way around.
Does this setup sound secure enough and a solution that can work?
What kind of encryption should I be using?
Point out any areas where you think I might be missing something or
going wrong.
Thanks in advance.
Angelo
>>> "Richard Lynch" <[EMAIL PROTECTED]> 01/31/05 8:37 PM >>>
Angelo Zanetti wrote:
> this might be slightly OT but I know that the list has quite a
> knowledgable crowd =) So here is my situation:
>
> I have a client who I have developed a site for in PHP it provides
> various models for shares forecasts, the way it works is that people
> register for free (with their credit card details-https) now if they
> are
> not satisfied after a month they must just unsubscribe. If they have
> not
> unsubscribed after the first month they become a customer and each
> month
> their credit card is charged the relevant amount depending on what
> they
> have subscribed for.
>
> Now our the complication is as follows: I know that storing client's
> credit card details online is a big NONO, so we would have to move
the
> credit card details offline when they register. Im not sure how to
go
> about this. Whether to save the details in text files somewhere else
> on
> the server or save to text files not on the server but another
> location.
>
> Can anyone recommend/advise the best way to do this, also what type
of
> encryption should I be using for the credit card info?
The SIMPLEST way to do this is to charge their credit card with a
recurring charge when they sign up, and then just THROW AWAY their
credit
card number.
Your credit card processing vendor then has to remember their credit
card
number, not you.
You'll get a one-time transaction identification from the credit card
server that you can use to manage their account -- You can then use
THAT
one-time transaction number to cancel their account, issue refunds,
etc.
without remembering their credit card number at all.
You MIGHT even be able to set this recurring charge to not start until
a
month later, so you're all set. Given the sheer number of sites and
services that have a free trial period, it's very very very likely
that
the credit card vendors are already all set up to handle this for you.
If not, you can almost for sure set the recurring charge, then reverse
out
the first month's transaction, leaving the rest intact, so they get
their
free month.
You do *NOT* want to store their credit card info *ANYWHERE* at all,
period, if you can avoid it.
For sure, you do *NOT* store it in a text file on that server, and
probably not even in a text file on some other server.
If you absolutely MUST store their credit card info, re-post again,
explaning WHY, and you'll get some advice.
Be warned that that advice will probably involve buying more computer
hardware, and hours and hours of setup, as well as a physically secure
location, and an independent audit by a security expert, and ...
Let's
just say "Lots of time and money"
Go read the credit card vendor's manual -- I'm willing to bet you can
have
a solution in hours that doesn't involve you storing credit card
numbers.
--
Like Music?
http://l-i-e.com/artists.htm
--------------------------------------------------------------------
Disclaimer
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is
intended for the attention and use only of the addressee.
Should you have received this e-mail in error, please delete
and destroy it and any attachments thereto immediately.
Under no circumstances will the Cape Peninsula University of
Technology or the sender of this e-mail be liable to any party for
any direct, indirect, special or other consequential damages for any
use of this e-mail.
For the detailed e-mail disclaimer please refer to
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911
--- End Message ---
--- Begin Message ---
Last two examples are fine as connection is obviously established, it is the
communication with server that is causig an error. Read http protocol
documentation.
You do not want such a degree of control over communication you can just use
file_get_contents($url);
where $url is
"http(s)://your.domain.net/dir/file..." - standard url
regards,
Bostjan
On Tuesday 01 February 2005 18:17, pete M wrote:
> am not having a lot of success with opening a socket to a secure domain
> (php 4.3.8 - apache - openSSL)
>
> $fp = fsockopen($url , 443 ,$errno, $errstr, 30);
>
> have tried the following $urls
>
> -----------------------
> $url = 'domain.net';
>
> Bad Request
> Your browser sent a request that this server could not understand.
>
> Reason: You're speaking plain HTTP to an SSL-enabled server port.
> Instead use the HTTPS scheme to access this URL, please.
>
> --------------------------------------
> $url = 'https://domain.net';
>
> Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name
> or service not known
>
> ------------------------------------------
> $url = 'ssl://domain.net';
>
> Bad Request
> Your browser sent a request that this server could not understand.
>
> Client sent malformed Host header
>
> -------------------------------------------
> $url = 'tls://domain.net';
>
> Bad Request
> Your browser sent a request that this server could not understand.
>
> Client sent malformed Host header
>
>
> Am I missing the obvious as I cannot thing of any other options ;-((
>
> tia
> pete
--- End Message ---
--- Begin Message ---
I want to parse a html file
for instance
<body>
<p>aaa jjjj mmmm dddd yyyy ssss</p>
<b>aaa hhh mmmm dddd yyyy ssss</b>
<p>aaa eee mmmm dddd yyyy ssss</p>
<i>aaa kkkk mmmm dddd yyyy ssss</i>
</body>
and I want to create a regular expresion wich is able to extract entire text
from enclosed tags WITHOUT a particular word
for example eee
final I want to obtain this result
aaa jjjj mmmm dddd yyyy ssss
aaa hhh mmmm dddd yyyy ssss
aaa kkkk mmmm dddd yyyy ssss
Any solution?
thank you
Silviu
--- End Message ---
--- Begin Message ---
Hi,
Use strip_tags() instead of regex.
http://www.php-center.de/en-html-manual/function.strip-tags.html
Greetings
Mirco
-----Urspr�ngliche Nachricht-----
Von: php [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 2. Februar 2005 09:25
An: [email protected]
Betreff: [PHP] regular expresion
I want to parse a html file
for instance
<body>
<p>aaa jjjj mmmm dddd yyyy ssss</p>
<b>aaa hhh mmmm dddd yyyy ssss</b>
<p>aaa eee mmmm dddd yyyy ssss</p>
<i>aaa kkkk mmmm dddd yyyy ssss</i>
</body>
and I want to create a regular expresion wich is able to extract entire text
from enclosed tags WITHOUT a particular word
for example eee
final I want to obtain this result
aaa jjjj mmmm dddd yyyy ssss
aaa hhh mmmm dddd yyyy ssss
aaa kkkk mmmm dddd yyyy ssss
Any solution?
thank you
Silviu
--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi dear members!!
i want a script that i can add system user through
php. For example i
have FreeBSD 5.3 for adding a user in freebsd i use
this command
pw useradd username -g groupname -d /home/username -m
now i want creating user through php what kind of
script will be
required
thanks and regards
Umar Draz
__________________________________
Do you Yahoo!?
Yahoo! Mail - Easier than ever with enhanced search. Learn more.
http://info.mail.yahoo.com/mail_250
--- End Message ---
--- Begin Message ---
Hi all,
I got a problem with uploading files which encounter the memory limit
when their size is not even close to the memory limit itself, let me
explain.
My server is as follows:
1. PHP 4.3.9
2. DB - Postgresql 7.4
3. Apache 1.3.26
Here is my code that i made for testing the problem (along the code i
echoed the function memory_get_usage() to know how much memory was
allocated already for the script):
$imagefile = $_FILES['imagefile']; // recieve the file
echo memory_get_usage().'<br />'; // 118592 memory bytes allocated
$data = pg_escape_bytea(`cat $imagefile[tmp_name]`);
echo memory_get_usage().'<br />'; // 5570280 memory bytes allocated
$data = "INSERT INTO test_files (bin_data, filename, filesize, filetype)
VALUES ('$data', '$imagefile[name]', '$imagefile[size]',
'$imagefile[type]')"; // creating the sql for the insert, i called the
received value also $data cause i dont want to keep the previous $data
(after all we want to save our precious memory no? :))
echo memory_get_usage().'<br />'; // 5570400 memory bytes allocated
{changed from b4 only alittle}
if ( !$res = pg_query ($this->conn, $data) ) // try to insert the sql
string
return 'error';
else
return 'gr8';
echo memory_get_usage().'<br />'; // 5570648 memory bytes allocated
{again changed only alittle}
Now as far as i see the script needed about 5.5MB of memory to upload a
file of 4.7MB but thats what so weird here... i receive the memory limit
error even if the php.ini "memory_limit" is set to 16MB! {twice of the
default of 8MB!} at 32MB it works fine... but thats way too much..
I suspect that the problem is connected to the pg_query function itself
but i didnt find what made it exactly...
Any ideas, knowledge or even just solutions ;) will be extremly helpful.
Thanks in advance,
Ben-Nes Yonatan
--- End Message ---