How to Dump / Export all MySQL Databases Individually Using php

Posted by on Oct 6, 2016 in Servers | 0 comments

Database backups are super important. They are also important when you have to do migrations. Some of the sites can just be deleted and don't need to be migrated so you need only a few databases exported. Almost all of my business & personal files are in Dropbox so they are backed up as soon as something changes which is nice and I don't have to think about it. When programming, though, the databases are not automatically backed up to the cloud. There's mysqldump tool but you can either export/dump one or all databases. You have to write a tool for  that.  I checked and there's lots of linux tools that allow you to export the databases which is nice but if you're running Windows they probably won't work. For those who don't want or can't use linux/bash here's a php version of a mysql database dump tool. It exports each database in own sql file. If gzip is present it will compress it. If there are errors they are logged in a database specific log file. You can download the php version of MySQL database dump here: >> https://github.com/orbisius/server-tools/raw/master/mysql_db_dumper.php If you want to contribute to the project feel free to fork it at >>...

Read More

How to Globally Block IP addresses in Apache

Posted by on Jun 13, 2016 in Servers | 0 comments

Spammers are everywhere. Even though it's a cat and mouse game it feels so good when we can block them :) This tutorial assumes that you have root access to the server. This example is tested on Ubuntu but should work for any apache installation. Steps Create a file called /etc/apache2/conf-available/00_block_ips.conf with the following contents. ErrorDocument 403 "The content is not available. If you think this is an error contact us via domain.com" # Global ip blocklist <Directory "/var/www/"> deny from 1.2.3.4 # some explanation </Directory> Enable the cofig file. a2enconf 00_block_ips We file starts with 00 so it's one of the first conf files to be loaded. You should see something like this. Enabling conf 00_block_ips. To activate the new configuration, you need to run: service apache2 reload Reload apache conf service apache2 reload Feel free to customize the text in the quotes after ErrorDocument 403 so people who were accidentally blocked can do something about it. If you want to temporarily disable the ip block do this a2disconf 00_block_ips service apache2...

Read More