0perator Posted July 10, 2008 Share Posted July 10, 2008 Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 8192 bytes) in /home/hakman/public_html/index.php on line 1 what???? on line one is <?php please help. Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted July 10, 2008 Share Posted July 10, 2008 Get a better host. You are running out of memory. Quote Link to comment Share on other sites More sharing options...
0perator Posted July 10, 2008 Author Share Posted July 10, 2008 its my home computer, i got plenty... and i have at least 20gb free space... Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted July 10, 2008 Share Posted July 10, 2008 You are running out of Memory upgrade your computer. If you want to check this info press CTRL+SHIFT+ESC and goto Performance Tab tell us what it says under Physical Memory ... all values. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted July 10, 2008 Share Posted July 10, 2008 16MB is the default memory_limit setting in current versions of php. You need to set this to a higher value either in php.ini, a .htaccess file, or in your script (using an ini_set() statement.) Quote Link to comment Share on other sites More sharing options...
0perator Posted July 10, 2008 Author Share Posted July 10, 2008 ctrl+shift+esc does nothing i have 1gb of RAM btw. Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted July 10, 2008 Share Posted July 10, 2008 The error message told you that already.... 16777216/1024(megabytes)/1024(gigabytes) = 16 gb Which is a lot higher than 16 mb. But the problem is not within the php it is his hardware he doesn't have enough Randomly Accessed Memory(RAM) to run everything on his home computer plus the server applications. Thus he gets an error stating that he cannot allocate 8 mb of ram. Then do CTRL + ALT + DEL its the task manager. *CTRL + SHIFT + ESC is a shortcut for Vista users. Quote Link to comment Share on other sites More sharing options...
0perator Posted July 10, 2008 Author Share Posted July 10, 2008 but all of my other php applications work fine... just this one is not.. Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted July 10, 2008 Share Posted July 10, 2008 What are you trying to do in this script? Ken Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted July 10, 2008 Share Posted July 10, 2008 You might want to read what the error message states - "16777216 bytes" Quote Link to comment Share on other sites More sharing options...
0perator Posted July 10, 2008 Author Share Posted July 10, 2008 aha, i am using linux, hence the /home/hakman in system monitor it says i have 540mb free of 1024 and 900mb free of 1024 in swap space Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted July 10, 2008 Share Posted July 10, 2008 From the php manual - memory_limit integer This sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts for eating up all available memory on a server. Note that to have no memory limit, set this directive to -1. Prior to PHP 5.2.1, in order to use this directive it had to be enabled at compile time by using -enable-memory-limit in the configure line. This was also required to define the functions memory_get_usage() and memory_get_peak_usage(). When an integer is used, the value is measured in bytes. You may also use shorthand notation as described in this FAQ. Please read my posts in this thread. Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted July 10, 2008 Share Posted July 10, 2008 Your script must be huge then because using 540 MB of ram then still needing 6 MB is ridiculous. Make sure you don't have a loop that is trying to continue to infinity. @PFMaBiSmAd: If you read my second post it explains that "Allowed memory size of 16777216 bytes exhausted" means that the allowed memory is already set to 16 GigaBytes I think he doesn't have a problem with the internal setting. Quote Link to comment Share on other sites More sharing options...
0perator Posted July 10, 2008 Author Share Posted July 10, 2008 this is my code <?php $allowed = array('index.php'); $page = $_GET['page']; if(!empty($page)) { $page .= '.php'; if(in_array($page, $allowed)) { include($page); } } else { include($allowed[0]); } ?> <html> <head> <title> .:hakman:. </title> </head> <body> <body bgcolor="black"> <font color="green"> <center> text here la la la </font> </body> </html> i have tried it on another subdomain of mine and it works, just wana know how to get it to work on the one i am meant to be using. Quote Link to comment Share on other sites More sharing options...
discomatt Posted July 10, 2008 Share Posted July 10, 2008 There's either something wrong with index.php or your server, cause that looks fine. Quote Link to comment Share on other sites More sharing options...
0perator Posted July 10, 2008 Author Share Posted July 10, 2008 yer i know, everything else i try to run on my server is fine, everything works.. just this 1 script, if i move it to test.rvaf.co.uk/hakman.php it works fine! this is totally confusing Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted July 10, 2008 Share Posted July 10, 2008 16777216 bytes is 16,777,216 bytes. That is 16 million, 777 thousand, 216 bytes. This is not exactly higher math ??? Quote Link to comment Share on other sites More sharing options...
0perator Posted July 10, 2008 Author Share Posted July 10, 2008 i dont really understand what the 16gb has to do with anything though its trying to allocate about 8kb it has 500mb to use... Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted July 10, 2008 Share Posted July 10, 2008 What's in "index.php"? What's the name of the script that you're running? Hopefully, it's not "index.php", because if it is, you're trying to include the same file over and over again until you run out of memory. Ken Quote Link to comment Share on other sites More sharing options...
0perator Posted July 10, 2008 Author Share Posted July 10, 2008 yes it is index.php and it is in the "allowed" array so it wont do it over and over Quote Link to comment Share on other sites More sharing options...
DarkWater Posted July 10, 2008 Share Posted July 10, 2008 If $page isn't set, it just includes index.php, which again includes index.php, etc. That's why it's failing. Quote Link to comment Share on other sites More sharing options...
0perator Posted July 10, 2008 Author Share Posted July 10, 2008 you guise are absolute geniuses'ses i <3 all of you especially dark water Quote Link to comment Share on other sites More sharing options...
Guest Xanza Posted July 10, 2008 Share Posted July 10, 2008 16MB is the default memory_limit setting in current versions of php. You need to set this to a higher value either in php.ini, a .htaccess file, or in your script (using an ini_set() statement.) You'll need to manually edit your php.ini file on your Linux version of PHP, or Apache, which ever you're using. You're installation is stopping you, nothing else. <?php phpinfo(); ?> Run that on your server, and look under the configuration of the PHP Core and find: "memory_limit", yours is set to 16MB, mine for example is 128MB (just to be safe). You should probably set yours to about 50MB or even less. Quote Link to comment Share on other sites More sharing options...
DarkWater Posted July 10, 2008 Share Posted July 10, 2008 Please mark this topic as solved. Quote Link to comment Share on other sites More sharing options...
Guest Xanza Posted July 10, 2008 Share Posted July 10, 2008 haha, wow... I guess I should of looked at the script. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.