|
-
Jul 28th, 2005, 10:04 AM
#1
Thread Starter
Addicted Member
Fatal Error with allocated memory size :-S
Hi all, i am adding the ability to attach images to posts on my forum but i'm getting the error:
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 129 bytes) in /home/virtual/site13/fst/var/www/html/ForumNewReply.php on line 88
All i'm doing is passing the attached images filenames to ForumNewReply.php and displaying them.
This is the code where the error is happening:
Code:
$_SESSION['currentfiles'] = $_SESSION['currentfiles']."c~c~c".$iname;
$exploded = explode("c~c~c", $_SESSION['currentfiles']);
$inarray = count($exploded)-1;
for ($i=0; $i=$exploded[$inarray]; $i+=1) {
$attachedfiles .= "<li>".$exploded[$i]."</li>";
}
Can i not have any suggestions to increase php.ini memory_limit as the page is used very regularly. I've tried increasing it a bit but i dont see why just displaying an array full of filenames should cause an error :-S
Thanks, BIOSTALL
-
Jul 28th, 2005, 02:00 PM
#2
Re: Fatal Error with allocated memory size :-S
If you are using your memory limit of 8MB then you need to seriously consider the size of the variables your script is allocating.
Do you create and large database cursors? Store large files in strings or have several million variables?
-
Jul 29th, 2005, 12:10 PM
#3
Thread Starter
Addicted Member
Re: Fatal Error with allocated memory size :-S
Actually.. stuff that... i found out what i was doing wrong.. What i have now is this:
Code:
if ($_GET['imagename']!="") {
$iname = $_GET['imagename'];
if (!isset($_SESSION['currentfiles'])) {
$_SESSION['currentfiles'] = $iname;
$attachedfiles = $iname;
}else{
$iname=",".$iname;
$_SESSION['currentfiles'] += $iname;
$exploded = explode(",", $_SESSION['currentfiles']);
$inarray = count($exploded);
for ($i=0; $i<count($exploded); $i++) {
$attachedfiles .= "<li>".$exploded[$i]."</li>";
}
}
echo "$iname<br>";
echo $_SESSION['currentfiles']."<br>";
echo "$exploded<br>";
echo "$inarray<br>";
unset($inarray, $exploded);
$attachmessage = "<b>Images currently attached:</b><br><br> <i>".$attachedfiles."</i><br>";
}
As you can see i'm echoing the variables and this is what its giving me:
$iname - ,picture.gif
$_SESSION['currentfiles'] - 96846981
$exploded - Array
$inarray - 1
As you can see, when i echo my session variable, its giving me a long integer and i can't figure out why... when i echo the session variable it should be two or more filenames seperated by a comma.
Anyone help please??
Many Thanks, BIOSTALL
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|