Function to convert UNIX timestamp to GMT timestamp

Here, I’m sharing two functions to convert the UNIX timestamp to GMT timestamp and vice versa using PHP predefined functions.


Read More

Connecting mysql server via terminal

We all know that there is GUI available to connect MYSQL server (phpmyadmin). Most of the developers are not aware about connecting MYSQL server via terminal. Here we are going to explain how to connect a MYSQL server (both local & remote) via terminal.


After enter the above command, press ENTER. Then the Terminal will prompt to enter the password to connect. If you given valid credentials, then the terminal will display the shell pointer as mysql>

Once the connection established you can manipulate the database using SQL commands.

Read More

Allow cross domain XMLHttpRequest


we can look on allowing cross domain XMLHttpRequests. To achieve this on the responding server, we need to set the header Access-Control-Allow-Origin as *.


Read More

Allow remote connections to mysql server

Here, we are going to discuss about allowing remote connections to our local MYSQL server. To do this just edit the MYSQL server configuration file my.cnf which you can found in /etc/mysql/my.cnf (Ubuntu 12.04). Check for the configuration variable called bind-address. Just comment that line by using # and then restart the MYSQL server. These steps you can do via Terminal. See below for more details:

i) Open your terminal

ii) Type sudo gedit  /etc/mysql/my.cnf and hit the ENTER

iii) Comment the bind-address line as discussed above

iv) Restart MYSQL server by typing the command sudo /etc/init.d/mysql restart. Hit the ENTER.

Once you have completed the above steps, check the remote connection to the MYSQL server.

Read More

Command to remove all contents from current directory

Here, we can see the command to remove all files and directories from current directory in Linux via Terminal. It is a simple command, but only thing is, we have to ensure that the user have rights to remove the files and directories.

First open Terminal and  focus to the directory in which you want to remove the contents using the command cd. Once you have gone to that directory use the following command to delete the entire content inside that directory;


Read More