If you are trying to develop some website on shared hosting using wordpress, there are high chances you will encounter following error sometime, Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 49152 bytes) in "/path/filename.php" on line "linenumber" This error is mainly due to PHP memory limitations, we get by default for the shared hosting servers. Solution : We need to increase the PHP memory limitations by changing the php.ini file. For this you will need an access to /public_html folder of your shared hosting.

Execution & Command Syntax

Terminalbash
make sure those two files contain the following lines
Terminalbash
sed vim editor on ubuntu, you can use any other editor on any other OS like windows as you are comfortable ] $ vim phpinfo

Technical Implementation Details

If you have an FTP access to /public_html folder in your hosting, Check if you have phpinfo.php and php.ini files in /public_html folder, if those are there then you will just need to make sure those two files contain the following lines. You can edit those files as mentioned in next step. If you don’t have phpinfo.php & php.ini files, we need to create those two files and upload to /public_html using FTP. Create phpinfo.php [ Note: we used vim editor on ubuntu, you can use any other editor on any other OS like windows as you are comfortable ] $ vim phpinfo.php <phpinfo()> Save the file with above changes. Create php.ini $ vim php.ini max_execution_time 600 memory_limit 128M post_max_size 32M upload_max_filesize 32M Save php.ini with above changes and upload both files to /public_html/ location in your server. and Try refreshing your browser where you have seen this error.

Gotchas and Common Issues

  • Permission Verification - confirm execution permissions and path variables before invoking system binaries.

  • Version Compatibility - check software version release notes for deprecated flags or syntax changes.

  • Log Monitoring - inspect system logs (journalctl or /var/log) to troubleshoot execution failures.

Following these steps ensures clean configuration, proper security boundaries, and reliable execution for php : allowed memory size of bytes exhausted : wordpress.