Skip to content

Tag: php

file_get_contents => PHP Fatal error: Allowed memory exhausted

I have no experience when dealing with large files so I am not sure what to do about this. I have attempted to read several large files using file_get_contents ; the task is to clean and munge them using preg_replace(). My code runs fine on small files ; however, the large files (40 MB) trigger an Memory exha…

PHP strtotime() different results of monday this week

I have a problem getting the date of monday in the current week. When I’m running the above code on my local machine (PHP 5.3) it outputs correctly ‘2011-03-07’, but the same code on my server (PHP 5.2) outputs ‘2011-03-14’ (that’s monday next week). I’ve tried to run…

should i still sanitise input with mysqli?

I’m using mysqli prepared statements. Should I still sanitise the user input with some function like: Thanks. Answer No! No and no. If you are already using prepared statements, MySQL needs to see the value, not some escaped version of it. If you add mysql_real_escape_string to a string and make that th…

append query string to any form of URL

I ask user to input a URL in a text-box and need to append a query string to it. Possible values of URLs can be like: http://www.example.com http://www.example.com/a/ http://www.example.com/a/?q1=one http://www.example.com/a.html http://www.example.com/a.html?q1=one Now I need to add query string to it like &…

Why MySQLi prepared statements?

What are the advantages of using prepared statements with MySQLi? If the only purpose is to secure the query, isn’t it better to clean the query using something like mysqli_real_escape_string instead of writing so many lines of code for each query (like prepare, bind_param, execute, close, etc.)? Answer…

Maintenance mode strategy with SEO in mind [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about programming within the scope defined in the help center. Closed 10 days ago. Improve this question What are considered the best practices when putting your site in ma…

PHP installation on windows

I want to install php in my system.For this I have downloaded the php-5.3.5.tar.bz2 (zip file). Now from this installation help link http://www.php.net/manual/en/install.windows.installer.msi.php It is saying “Run the MSI installer and follow the instructions provided by the installation wizard. ”…