|
Import large MySQL database (phpMyAdmin limitation)
|
I have encountered this issue about a week ago, when i'm exporting my database through phpMyAdmin tool, the export works very well and the output file is up to 10 MB in size. The main issue comes when i would like to import it back using phpMyAdmin, but guess what happened, a timeout occured.
I will kindly break it down for you, there are 2 limitations surrounding phpMyAdmin from importing a very large MySQL database:
1. A time out is divided into a server timeout and browser timeout. This basically means when a script is being executed for too long that it has eventually passed the time limit either on the server and/or browser, the script will cease to run. Simply put, the larger your file is, the longer it takes to be executed, the bigger chance it fails.
You could actually bypass the browser timeout by modifying the about:config setting if you are on Firefox, unfortunately for server timeout, if you are on shared hosting like me, you are unlikely to get access to modify the server config.
2. File size limit on certain web hosting companies. Normally, i would say a 10 MB filesize limit is being implemented by most web hosting companies, if your MySQL filesize is more than that, then you're out of luck. Fortunately, my hosting company (BlueHost) is generous by allowing me to upload up to 50 MB filesize.
Captcha form to secure against spam bots
|
Do you ever have a blog / forum / personal site where there are instances where your comment forms are filled with unnecesary advertisements, not mentioning horrible languages. For your information, this isn't done by a person, in most cases it will be spam bots automatically generated by a program.
Captcha is well known to prevent or reduce the amount of spams being posted on your blog / forum / sites, most open source PHP CMS such as Drupal / Joomla / Wordpress obviously have a captcha module or even integrated captcha by their own, so don't worry about them. How about free forum such as PHPBB and Simple Machines, they do have it as well, but there are certain tweaks and modifications needed to ensure your captcha is not being bypassed.
From my own experience, the phpbb captcha by default isn't very stricted and easily bypassed, you have to visit their official website to gain a better and stricter captha system. For those of you developing your own site from a scratch, i would strongly recommend using 3rd party captcha system from:
http://www.phpcaptcha.org/try-securimage

Generate full path of web directory in PHP
|
I know this is a simple script that probably everyone already know, but I would like to keep it as a reminder for myself and everyone out there who doesn't know about it yet. For some reason, there are times when we need to know the full path of our web directory.
So, let's say you installed zen cart on your web root directory. Generally, you will have something like httpdocs/includes as one of your installation folder. If someone asks you, what's the full path of that folder ?
echo $_SERVER['DOCUMENT_ROOT'];
The script above once executed will print out the full path of your current directory location. That alone should do it.
Temporary folder in php not accessible
|
This was an unforgettable experience that i knew when i was developing a website that's hosted on a web server. If you're planning to use php mail function with attachment then you'll certainly upload those attachments temporarily to the web server before sending it to the recipient.
These attachments will be stored into the folder specified in 'upload_tmp_dir' directive in php.ini. So, unless you specified another value for the temporary folder, it always point to '/tmp/php_upload' by default.
Example:
When i wrote a code like this (for mail attachment):
$_FILES["yourfile"]["tmp_name"]
The error message comes up : fopen() [function.fopen]: open_basedir restriction in effect. File(/tmp/php_upload/phpk3qSgH) is not within the allowed path(s).

PHP
Import large MySQL database (phpMyAdmin limitation)

Recent comments