Today, when using a php product, Allowed memory size of 8388608 bytes exhausted (tried to allocate 46080 bytes) in .... the prompt message is checked because the user memory is not taken into account. Let's take a look at how to solve this problem.
The memory_limit parameter in php. ini is caused by insufficient settings, which causes the problem. Let's take a look at several solutions.
Method 1: implement with a program
Add the following command line to your php code:
The Code is as follows: |
Copy code |
Ini_set ('memory _ limit ', '128m '); |
This requires that your server is not allowed to be modified. Generally, virtual space cannot be operated.
Method 2: Use. htaccess, which is highly feasible.
Add in your. htaccess
The Code is as follows: |
Copy code |
Php_value memory_limit 128 M; |
You can change m to any value you want to set.
Method 3: directly modify the php. ini file for a friend with server management permissions.
Find "memory_limit". If not, you can add this parameter at the end of the file. The following are some configuration examples:
The Code is as follows: |
Copy code |
Memory_limit = 128 M; |
You can change m to any value you want to set.
Restart apache.
In this way, when I run the product again, the Allowed memory size of 8388608 bytes exhausted (tried to allocate 46080 bytes) in will not appear ,.