i am getting memory limit error while loading some of the pages of my website.
My issue is, i don't have rights to modify memory_limit in php.ini so is there any other way to override this settings ?
I am getting following error.
Fatal error: Allowed memory size of 94371840 bytes exhausted (tried to allocate 122880 bytes) in /xx/xx/xx/plugins/otbcCompanyPlugin/lib/model/om/BaseOtbcCompanyCompanyPeer.php on line 1567
i tried:
ini_set('memory_limit', '512M');
echo ini_get('memory_limit');exit; // prints 90M
And i tried following in .htaccess
<IfModule mod_php5.c>
php_value memory_limit 512m
</IfModule>
and
<IfModule mod_php.c>
php_value memory_limit 512m
</IfModule>
but didn't work.
you can check phpinfo().
so is there anything missed by me ?
I have encountered the same issue. But it's pretty easy:
cPanel > section Software/Services > Select PHP Version menu.
Click on Switch to PHP extensions and there you will see the option for raising the php memory limit as memory_limit.
In some hosts, you can configure the custom php.ini file from here too.
you can try to add your owen php.ini file in wich you specify :
memory_limit = 512M
to do so :
create a php.ini file in your root folder
add memory_limit = 512M
create .htaccess file and add this line :
SetEnv PHPRC /home/username/folder/php.ini
this will load your custom instructions in your php.ini
to make sure just run the
<?php phpinfo() ?>
Related
I kept getting this error on one of the site Im working on
Message Out of memory (allocated 2097152) (tried to allocate 20480 bytes)
and the thing is we already set the memory limit to 512MB, and seems weird that it says allocated 2097152 which is like only 2MB?
This site is running in wordpress with woocommerce, and the even woocommerce status says the memory limit is 512MB.
Can anybody explain whats going on?
Server is running on NGINX + PHP-FPM
Try set upload_max_filesize, post_max_size , max_file_uploads and memory_limit in php.ini and then restart your Apache server. If it did not work, try to set the mentioned parameters to right on top of your code.
Best way to increase memory limit in PHP or WordPress.
Via php.ini file
memory_limit 2048M
post_max_size 200M
upload_max_filesize 20M
max_file_uploads 20
Via PHP script
ini_set('memory_limit','2048M');
ini_set('post_max_size','200M');
ini_set('upload_max_filesize','20M');
ini_set('max_file_uploads','20');
Via wp_config.php file in WordPress
define('WP_MEMORY_LIMIT', '2048M');
Via htaccess
php_value memory_limit 256M
php_value post_max_size 200M
php_value upload_max_filesize 20M
php_value max_file_uploads 20
In wp-config file Update the memory limit according to your need
define('WP_MEMORY_LIMIT', '256m');
define('WP_MAX_MEMORY_LIMIT', '512m');
I try to upload file of 300 MB. but not uploaded and now display any error.
variables value in php.ini file is
post_max_size 800M
upload_max_filesize 750M
memory_limit 2048M
max_execution_time 17100
max_input_time 17100
if i try to print tmp name of file by echo $_FILES['data-file']['tmp_name']; die; Nothing display page redirecto to home. but for less then 128M it show /tmp/phpShle like that.
If you are on LAMP make sure you are editing right php.ini file. In LAMP you will find cli related php.ini and php-apache related php.ini. To make above scenarios of file upload possible, you will need to edit php-apache php.ini file which is in /etc/php5/apache2/ and also restart apache service.
If you are on WAMP, it has only one php.ini and WAMP is automatically restarting services after editing file. So it should work.
-Or-
You can write a .htaccess file in web home directory.
RewriteEngine on
php_value post_max_size 300M
php_value upload_max_filesize 300M
Please write this on .htaccess.
<IfModule mod_php5.c>
php_value post_max_size 256M
php_value upload_max_filesize 256M
php_value memory_limit 500M
</IfModule>
This might help you. Cheers :)
My proble is solved. I need to set these variable on modsec2.user.conf file
SecRequestBodyLimit 1073741824
SecRequestBodyNoFilesLimit 1073741824
This is a apache server file. and error was shown on Apache error log.
Initially my Magento ecommerce worked fine. After increasing the data on the server I was unable to access the site which gave out fatal error "Out of memory fatal error".
I changed the php.ini option memory_limit from 64M to 512M. It did not help.
Now to solve the above error follow the under given steps:
Step 1: Open your include/config.php file and add the following line:
ini_set('memory_limit', '512M');
In this way you will increase the memory limit for your script to 512MB. You should paste the above code in a file which is always invoked when the script is executed.
Step 2: Open the .htaccess file from the magento root directory and around line 35 replace the
php_value memory_limit 256M
with
php_value memory_limit 512M
Step 3: From the magento root directory rename the php.ini.sample file to php.ini
Step 4: Open the php.ini file and replace the
memory_limit = 64M
with
memory_limit = 512M
Step 5: Go to Admin -> System -> Cache Management and refresh all the cache.
That’s it.
i am using an html form with php to upload data to mysql.
the form is working properly when i am using it on my laptop (wamp) but when i uploaded the site on my dedicated server (ispconfig) get this error
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
i tried changing the values of the php.ini in
post_max_size 64M
upload_max_filesize 64M
max_input_time 3000
max_execution_time 3000
and the ones in the apache also in
memory_limit 96M
post_max_size 64M
upload_max_filesize 64M
but i still cant upload.
thank you for reading this.
You need to increase FcgidMaxRequestLen in httpd.conf file
use something like
FcgidMaxRequestLen 67108864
From FcgidMaxRequestLen Directive
Warning
Before 2.3.6, this defaulted to 1GB. Most users of earlier versions
should use this directive to set a more reasonable limit.
The accepted answer is correct. To be more specific, you need to add the code in httpd.conf file :
# Work around annoying fcgid limitations
<IfModule mod_fcgid.c>
# 20MB should be enough
MaxRequestLen 20000000
</IfModule>
You may check the full article here :
http://pivica.me/blog/500-internal-server-error-while-uploading-files-bigger-then-100kb-modfcgid-problem
Note that a syntax error in a php/ajax processing script could report as an "internal server error".
For example, I was using Ravishanker Kusuma's jQuery Upload File plugin and was getting this message.
Turns out it was just a missing ) in an (unused) function inside my code in the PHP processor file specified by the AJAX script. When a file was uploaded, this script would be called, the script would break inside the unused function, and this is the error it would report.
FWIW
None of the solutions above worked for me.
For CentOS users with Plesk Pannel follow the next steps
Change this value in the template
# grep -ir FcgidMaxRequestLen /usr/local/psa/admin/conf/templates/default/domain/domainVirtualHost.php
FcgidMaxRequestLen 16777216
# sed -i 's/FcgidMaxRequestLen 16777216/FcgidMaxRequestLen 1073741824/g' /usr/local/psa/admin/conf/templates/default/domain/domainVirtualHost.php
# grep -ir FcgidMaxRequestLen /usr/local/psa/admin/conf/templates/default/domain/domainVirtualHost.php
FcgidMaxRequestLen 1073741824
Rebuild the virtualhost configurations.
# /usr/local/psa/admin/bin/httpdmng --reconfigure-all
# /usr/local/psa/admin/bin/httpdmng --reconfigure-server
https://support.plesk.com/hc/en-us/articles/213955145-Unable-to-upload-large-files-via-PHP-HTTP-request-length-exceeds-MaxRequestLen
I'm having a problem getting more memory out of PHP.
This is the error message:
Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to allocate 82 bytes) in ...
Yet:
I've set memory_limit in the php.ini file to 32M:
memory_limit = 32M;
I've also tried to override it manually in the actual script:
ini_set('memory_limit', '32M');
And -- here's where I'm lost -- I've confirmed via phpinfo() that this php.ini file is the actual ini file used, and the memory_limit seems to be set correctly. The line on memory_limit gives this:
memory_limit 32M 32M
So it would seem that everything is configured properly, but I'm only getting 20971520 bytes (~20M).
Where else should I be looking to figure out where this limitation is being imposed?
EDIT: I'm running php under nginx/fastcgi, on Ubuntu 9.04 in a VPS. The php-cgi processes do seem to be a bit resource-hungry (RES=25m, VIRT=187m), but I have 10m of physical memory free and 500m of swap space free.
My first instinct is to guess that PHP is reading a different php.ini.
In Debian (and most likely Ubuntu), each version of PHP (cli, cgi, and apache) has its own copy of php.ini.
I just pored over the code I was running, and someone had hard-coded this into a config file:
ini_set('memory_limit', '20M');
Which was overriding everything else I was doing. Whew.
You could try setting it in the .htaccess file, that is what i had to do to get a site working on one server.
here are the settings i used:
php_value upload_max_filesize 50M
php_value post_max_size 60M
php_value memory_limit 128M