|
|
Click Here To Get Amazing Facebook Profile Covers,Status Messages
Different ways for changing php memeory limit
Every PHP script which runs on your web server consumes some memory(RAM).If memory limit set by your hosting provider or you is not sufficent for a prticular script to run then it throws a fatal error sort of
Fatal error: Allowed memory size of X bytes exhausted (tried to allocate Y bytes) in /test.php on line Z
or it shows simply a blank screen.
There are number of ways to edit the memory limit which can be consumed by a php script.
Simplest way is using php.ini,configuration file for php.So locate php.ini.Cant locate exact file which is being used? use phpinfo() function and see its location.now edit your php.ini file, find memory_limit parameter and set it as per your requirement.like
memory_limit = 64M ; Maximum amount of memory a script may consume (64MB)
Restart Apache to make changes effective.
But what if you dont have access to php.ini, in shared hosting it happens.So you dont even know how much memory limit is set by your Hosting provider Write a simple php script and use phpinfo(); to see this in resource limit section.
Edit your .htaccess file residing in root of your domain or vhost and insert a line
php_value memory_limit 64M
using this you can change memory limit for scripts residing in particular directory by changing or placing .htaccess in that
particulr folder.No restart is needed for changes in .htaccess.
Even if you want to set memory limit for a particular script use follwing statement
ini_set('memory_limit', '96M');
in your script.
But it is always advised to set limit as per requirement. dont set it arbitrary because poorly coded scripts may cause
problems. If You dont want any memory limit set it to -1 in php.ini but at your risk.
- Article Category:
Similar entries
- client side and server side scripting -comparison
- configuration file for asp.net web application web.config
- No process is on the otherend of the pipe Microsoft SQL Server Error: 233
- Difference between Form submission methods GET and POST
- How to install IIS (Internet Information Server) on Windows XP
- How to resolve Parser Error Message: An error occurred loading a configuration file in ASP.NET
- Configuration error- authentication mode = "Windows" in web.config of ASP.NET
- Howto add connection string in web.config of asp.net
- System error 67 has occurred. The network name cannot be found
- difference between repeater and datagrid asp.net