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…)
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…)
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…)
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.)
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
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.
The steps and commands are all in Ubuntu (Linux) and should be almost same for Mac OS as well but haven’t tested it myself. And GIT server is GitHub itself. I am not going to give any theoretical definitions of anything here. Directly the commands are presented for different purposes. (more…)
Normally we need a client software to access MySQL server whether it is remote server or local. Most of the developers who use MySQL as back end database use phpmyadmin which is a web application. But when it comes to access the remote database, we use different client applications. MySQL Workbench is the official MySQL Client application/software which does pretty much good job for most of the cases. That’s why I think most of the developers choose this. In Windows I used to use SQLYog which is not yet free. (more…)
First of all, I would recommend login as root so that you don’t have to sudo every time you hit the command and give the root password.
$ su -
Now you should be logged in as root. Mine now is
I had updgraded my Ubuntu from 13.04 to 13.10 last week and everything went quite good. The only problems that I faced as developer are:
- Apache 2.4 was not working with default previous installation and configuration and I had to remove it (completely uninstall/purge and autoremove) and install it again.
- All the virtual host setting did not work. I did not go for opting to change the Include setting in apache2.conf instead I rewrote all the settings myself.
- Another annoying and very strange problem was that PHP and its libraries. First I had problems with installing apache module that connects to PHP. Secondly I had problems of missing mcrypt library which is required for couple of projects on my system. Particularly a project developed in Zend 1.11 and phpmyadmin did not work. I had the following error where I had written some methods for AES encryption with PHP’s mcrypt library.