Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Safe mode workaround?

Status
Not open for further replies.

Dweezel

Technical User
Feb 12, 2004
428
GB
When I try and upload any file bigger than about 1mb I get the following error message:

Code:
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 8192 bytes) in /blah/blah/public_html/imageup/uploader.php on line 97

I did a phpinfo() check and all of the settings for max file size and timeouts are easily big enough to deal with this, so I sent a support ticket to my web host and this was the response:

Hello the server you are on has had to have safe_mode activated, we tried to
warn all users on effected servers, please check that your e-mail address is
configured correctly within your control panel.

Due to insecure PHP scripts allowing malicious code to be uploaded to the server
we have had to take this temporary precuation, methods to prevent these scripts
being exploited without safe_mode being enabled are currently underway and are
in an advanced state of testing. We expect to deploy our new security measures
my Monday 21st Febuary. Having safe_mode enabled in the mean time allows us to
ensure a stable and secure hosting enviroment and network for all of our clients
including yourself. We are sorry for any problems this may have caused, in the
mean time contacting your PHP developers may have a work around for php
safe_mode being enabled as this is becoming more and more common in a virtual
hosting enviroment.

Do you think that's correct and that the error I was getting is due to safe mode being enabled? And if so does anyone now any of these work arounds that are mentioned in the reply above?
 
memory_limit = 8M; Maximum amount of memory a script may consume (8MB)


You can find this option in the php.ini file!
This is what causing the error.
When you are writing a script you are not allow to pass this limit in the output of the script.

I have similar problems when I was trying to display a HUGE list of companies from the Database.
In that case the result I was getting was more than 8MB.

What are you trying to do with the fileupload?
Normaly this would not cause any error. Its 1mb.
And the error it comes back has nothing to do with the file limit settings!?

I believe this will help.

 
Thanks for replying fireburner69. I'm setting up an online gallery for my cousin. The images are being uploaded and then resized server-side using PHP.
The error message confused me a lot. I can see that it's saying that the maximum memory of 8MB has been exhausted, but the files I'm trying to upload are all around 1MB. Very confusing.

In the phpinfo() maximum size is indeed set to 8MB. maximum execution time to 30, and post max size to 55MB. The explanation from the webhost that it was due to safe mode being on didn't seem right to me either, as the error message, as you say is saying that it's due to memory limits being exceeded.

Could it have anything to do with the maximum execution time being set to 30? I'm assuming that means 30seconds. I'm getting the error messages almost exactly 30seconds after I press the submit button, and as I only have a 256kbit upline, there's no way that I could exceed 8MB of temporary memory space in 30 seconds anyway.

But then why would the error message say that it's because the memory has been exhausted?

Deeply confused :(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top