Skip to main content

MySQL Master-Slave Replication on the Same Machine

MySQL replication is a process that enables data from one MySQL database server (the master) to be copied automatically to one or more MySQL database servers (the slaves). It is usually used to spread read access on multiple servers for scalability, although it can also be used for other purposes such as for failover, or analyzing data on the slave in order not to overload the master. (more…)

PHP Best Practices and Tips

This resource contains a collection of the best PHP practices and PHP tips provided by our Toptal network members. As such, this page will be updated on a regular basis to include additional information and cover emerging PHP techniques. This is a community driven project, so you are encouraged to contribute as well, and we are counting on your feedback. (more…)

SQL Database Performance Tuning for Developers

Database tuning can be an incredibly difficult task, particularly when working with large-scale data where even the most minor change can have a dramatic (positive or negative) impact on performance.

In mid-sized and large companies, most SQL database tuning will be handled by a Database Administrator (DBA). But believe me, there are plenty of developers out there who have to perform DBA-like tasks. Further, in many of the companies I’ve seen that do have DBAs, they often struggle to work well with developers—the positions simply require different modes of problem solving, which can lead to disagreement among coworkers. (more…)

Installation PHP5-FPM with Apache 2 in Ubuntu 14.04/10, 15.04/10


PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites.

These features include:

  • Adaptive process spawning (NEW!)
  • Basic statistics (ala Apache’s mod_status) (NEW!)
  • Advanced process management with graceful stop/start
  • Ability to start workers with different uid/gid/chroot/environment and different php.ini (replaces safe_mode)
  • Stdout & stderr logging
  • Emergency restart in case of accidental opcode cache destruction
  • Accelerated upload support
  • Support for a “slowlog”
  • Enhancements to FastCGI, such as fastcgi_finish_request() – a special function to finish request & flush all data while continuing to do something time-consuming (video converting, stats processing, etc.)


MySQL Command line login with inline password & Executing SQL Statements

Login with inline password in command line

Normally we don’t need to use inline password to login or we don’t do that. But sometimes it is a must when you need to login from a bash script or when we need to execute some SQL Statements from bash script or run them in a cron. If you check MySQL manual they have just included the simple command :

mysql --host=localhost --user=myname --password=mypass mydb


mysql -h localhost -u myname -pmypass mydb


Using Zend Server’s PHP for Command line (CLI) in Ubuntu 14.10

By default when you install Zend Server, it does not allow to use PHP directly from command line though the configured PHP applications work with web server (Apache or nginx). Try:

$ php -v

It will ask you to install PHP separately.


Though you can install another PHP and use it for all command line scripts but there is a quick work around to use Zend Server’s PHP itself.