How to Prevent Your PHP Script Running Out of Memory

There is good chance you are familiar with this error.

What’s the cause of this error. How you prevent your PHP script running out of memory. Let’s talk about it. In any programming language memory is cleared up by the garbage collector. And garbage collector does this work perfectly. For clearing up the memory, you need to tell the garbage collector that the following allocated memory is ready to free. In PHP this can be done by calling unset().

How to Prevent Allowed memory size Exhausted in PHP

If you are working on PHP, then definitely you are familiar with Fatal Error Allowed memory size exhausted. This error occurs when your PHP script exceeds the default memory allocated for execution. Due to which your scripts stop working and shows the error message that allowed memory size exhausted.

To know the default memory allocated for execution, you can check the memory limit in your php.ini file.

Understanding SQL Injection in PHP & Ways to Prevent it

sql_injectionWhat is SQL injection and how to prevent them in your web application

In top ten PHP Security Vulnerabilities list, SQL injection hits the number one position.  In SQL Injection, an attacker executes or pass malicious SQL statements through which they can either steal your data or completely destroy it. This data is passed through the browser to your web application. It occurs mainly if your input data is not validated properly.

To understand, how unvalidated data can cause such a big problem, let’s understand this through example.

Suppose, You have written a code for login module. In login module, A user enters a username and password. Based on username and password your script allows a user to log in.