Search code examples
phpjavascriptjqueryajaxsqlcmd

Does the use of AJAX increase memory usage of PHP?


I think the answer to this question is no but I do not have anymore leads of the problem I am trying to figure out.

I initially had a single script that did some database queries via SQLCMD. I have now decided to initiate this script via AJAX and wait for the response. But I get a fatal error of:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 445 bytes) in C:\process_txt.php on line 109

The only new thing that I have changed in my script is this ajax request and nothing else to be honest which is why I have asked this question.

I use JQuery AJAX request and I don't think I am using polling. Here is an example AJAX GET request that I make use of:

function process_txt(checkbox){

            waiting = 1;

            var folder_path = $('#folder_path').val();

            var file_name = $('#'+ checkbox + '_val').val();

            $.get("process_txt.php", { path:  folder_path, file: file_name},

            function(data){

                           alert(data);             

            });

}

Thanks to anyone that can try to shed some light on this matter and not the problem I am having, just this question! :)


Solution

  • AJAX vs a regular call will make no difference to the server. As far as PHP is concerned, nothing will have changed - the request is just a request, regardless of how it was initiated from the client.

    I'd look for the source of your memory leak elsewhere - perhaps the processor can get in an infinite loop if certain parameters are specified?