Thursday 18 April 2013

Export and import MySQL databases using phpMyAdmin


You can use phpMyAdmin to import and export your database, as long as it is relatively small (10MB or less). If your database is larger than 10MB, Please skip to Method 2 - command line.

First, log into phpMyAdmin :
Once you're logged into phpMyAdmin, follow the steps outlined below :

Export

In phpMyAdmin, select your database from the list on the left :



 Click on Export from the top set of tabs.


Click the radio button for "Custom" to view all available options. Select the tables from the list that you would like to back up. If you want to back up the entire database, click Select All.  




By default, your database name will be used to name the exported database file. You can change this by entering your desired file name in the File name template box. You can also select a compression option (such as "gzipped") if you want to compress the backup before downloading it from the server. 

  
Make sure radio button for "structure and data" is selected from the "Dump Table" option list. This should be the default setting.

In the Structure section, check the box for "Add DROP TABLE / DROP VIEW / PROCEDURE / FUNCTION / EVENT statement" if you want this export to be able to replace existing tables of the same name. If you want to merge this backup with another database, do not select this.

 
Click the Go button to save the file to your local computer. 

Import

Make sure the database you need has already been created. If it has not, please first create the database

CAUTION:
If you import a backup file to a database that already has content, it will replace the existing content.

In phpMyAdmin, select your database from the list on the left.


Click on "Import" from the top set of tabs. 


Click on the "Choose File" button.

Browse to your local SQL file and click "Open." If it is a zipped file, be sure to unzip the file first.
Click the "Go" button towards the bottom of the page. Wait while your database imports. Depending on the size, this can take a few minutes.


You should get a message like this:

"Import has been successfully finished, X queries executed."


Wednesday 17 April 2013

Recursive Php.ini in Ngnix servers


The PHP settings defined in your php.ini file are not recursive. What this means is that they do not modify settings in any child folders (which are subdirectories of the current directory).

Still confused, here's an example.

Let's say you have a php.ini file in your public_html folder. That php.ini file has the PHP memory_limit set to 256M. Only scripts that run directly in your public_html folder will have the memory_limit set to 256M. If you have a folder named public_html/employees, that "employees" folder will not be affected by the public_html/php.ini file, it would only be affected by a php.ini file located in its own folder, public_html/employees

If you have many folders, creating a php.ini file for each folder would be quite tedious. What you can do is update your .htaccess to tell the server that the public_html/php.ini file should apply not only to public_html, but to any folders within that folder (such as public_html/employees or public_html/about-us).

Updating your suPHP_ConfigPath value in your .htaccess file :

Making your php.ini file affect all child folders as well is referred to as making the file "recursive". To make your public_html/php.ini file recursive, edit (or create the file if it doesn't exist) your public_html/.htaccess file and add the following code :

suPHP_ConfigPath /home/username/public_html

This line you entered is specifying the directory where the php.ini is located that you want to make recursive. Be sure to replace username with your cPanel username.

This change is immediate, so you should see the update right away.

After saving the changes, be sure to create a phpinfo page in one of your subdirectories and test the results. When looking at your phpinfo page, the "Loaded Configuration File" should reflect the php.ini file that you wanted to make recursive.

Installing OpenJDK in Ubuntu


Run the Command :

apt-get install openjdk-7-jdk

Inorder to verify the installation of java in Linux :

$ which java

   or

$ java -version
java version "1.7.0_09"
OpenJDK Runtime Environment (IcedTea7 2.3.3) (7u9-2.3.3-0ubuntu1~12.10.1)
OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)
mkyong@yong-ubuntu:/usr/lib/jvm/java-7-openjdk-amd64/bin$





Wednesday 3 April 2013

vzquota : (warning) Incorrect quota shutdown for id VEID, recalculating disk usage



If you are getting following messages while starting your VE then quota for particular VPS was not shutdown properly.

==============================================
vzquota : (warning) Incorrect quota shutdown for id VEID, recalculating disk usage
vzquota : (error) quota check : lstat `ssl_scache.dir': Input/output error
==============================================

vzquota off <VEID>
vzctl start <VEID> 

And then again start quota for that VPS :

vzquota on <VEID> 

Please make sure to replace <VEID> with actual VPS ID you are facing problem with.

Your problem will be fixed

Cpanel FIX: Error from domain wrapper: domain.com is owned by another user


I got this error when I was trying to add subdomains to one of my cPanel accounts. This happens when cPanel doesn’t remove the subdomain correctly and then it thinks it’s still there so when you try to add it back on you get an error. Here’s how to fix it :

1. Remove domain.com from /var/cpanel/users/cpanel-username

2. Run /scripts/updateuserdomains as root user on the server because you changed the above file   manually, this will create adjusted cache files

3. Remove /var/named/domain.com.db if the file exists (it doesn’t always)

4. Remove the virtualhost for domain.com on /usr/local/apache/conf/httpd.conf

5. Remove domain.com from /etc/named.conf

Now you can add the domain back on in cPanel with no problems.