UnixServerAdmin

Server Administration & Management

How to enable .zip file import in PhpMyAdmin

If you have cPanel server and you are not able to import .zip file in PhpMyAdmin then just  make the below changes :

# vi /var/cpanel/easy/apache/profile/makecpphp.profile.yaml

Search for following line

Cpanel::Easy::PHP5::Zip: 0=0

Change it to

Cpanel::Easy::PHP5::Zip: 1

Save the file  and run the command :

# /scripts/makecpphp

That’s all  you are done.

May 23, 2011 Posted by | PHP | , , | 4 Comments

PhpMyAdmin Socket Error

If you are webmaster who using the web interface database management, you shall be familiar with PhpMyAdmin. Then you might get these error from your PhpMyAdmin when you logged into the PhpMyAdmin.

#2002 – The server is not responding (or the local MySQL server’s socket is not correctly configured)

To overcome this error, you could have 2 ways to solve the problem.

Method 1:

1. Check if your mysql.sock file missing from /tmp.

2. If it is really missing from /tmp, you may create a symbolic link from /var/lib/mysql/ to /tmp.

ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

3. You might ask why must do this, you may check the file from /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php and you need to check for the setting of cfg[‘Server’][‘socket’],  and you will see the setting set to /tmp/mysql.sock.

Method 2:

1. Edit the following file.

# vi /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php

2. Find $cfg[‘Servers’][$i][‘host’], change the value from localhost to 127.0.0.1

May 20, 2011 Posted by | cPanel, PHP | , , , | 3 Comments

How to create MySQL in cPanel

MySQL databases allow you to store lots of information in an easy to access manner. The databases themselves are not easily read by humans. MySQL databases are required by many web applications including some bulletin boards, content management systems, and others. To use a database, you’ll need to create it. Only MySQL Users (different than mail or other users) that have privileges to access a database can read from or write to that database.

There are two ways to create a MySQL database The easiest way to create a MySQL database is to use the “MySQL Database Wizard” built directly into the cPanel interface. The second way involves a few more steps, but does not require you to go through the wizard. Create a MySQL Database Using The Wizard by following Steps :-

1. When the page loads, enter the name of your new database in the “New Database” text box.
2. Next, click on the Create Database button.
3. You should see the following statement:
* “Added the database YOUR_DATABASE_NAME.”
4. Enter the username and password you want to use for this database in the “Username” and “Password” text boxes, respectively.
5. Next, click on the “Next Step” button.
6. You should see the following statement:
* “Added USERNAME with the password PASSWORD.”
7. When the page loads you will see a two-column table. The top of the table provides a checkbox option “ALL PRIVILEGES” allowing you to create the database with all privileges, otherwise you can check each of the items in the two columns that you want to allow for your new database. The options include:
* SELECT – Allows USERNAME to select data from a table in the database.
* INSERT – Allows USERNAME to insert data into a table in the database.
* UPDATE – Allows USERNAME to update data in a table in the database.
* DELETE – Allows USERNAME to delete data from a table in the database.
* INDEX – Allows USERNAME to create index on table column in the database. This can speed up a database.
* CREATE TEMPORARY TABLES – Allows USERNAME to create temporary tables in the database.
* CREATE – Allows USERNAME to create tables in the database.
* ALTER – Allows USERNAME to alter tables in the database.
* DROP – Allows USERNAME to drop tables in the database.
* LOCK TABLES – Allows USERNAME to lock tables in the database.
* REFERENCES – Allows USERNAME to create references to a table in the database.

NOTE: Typically you may want to check the “All Privileges” option unless you want specific control over the user you are creating for this database.

8. Assuming you have either checked the “All Privileges” option or a combination of the options in the two columns, continue the wizard by clicking on the Next Step button.
9. You should see the following statement:
* “User USERNAME was added to the database DATABASE.”,
10. When the page loads you will have three available options to choose:
* Add another database – Click this link if you want to add another mySQL database to your web hosting account.
* Add another user using the mySQL Database Area – Click this link if you want to add another user to the database you created in the steps above.
* Return to Home – Click this link if you want to return to the cPanel dashboard.

Create a MySQL Database Manually

1. When the page loads, enter the name of your new database in the “New Database” text box.
2. Next, click on the Create Database button.
3. You should see the following statement:
* “Added the database YOUR_DATABASE_NAME.”
4. Click on the Go Back link.
5. When the page loads, you will see a table with your newly created database containing the following information, split into five columns:
* Database – This entry will be the database name you created in Step 1 above.
* Size – This entry will be the size of the database you created in Step 1 above.
* Users – This entry will be the users in the database you created in Step 1 above. When you first create a new database manually, this column entry will be empty. Continue to Step 6 below to learn how to create and add a user to your new database.
* Actions – You have one choice:
o Delete Database – Click on this link to delete a database.
6. In the “New User” section, enter the username and password you want to use for this database in the “Username” and “Password” text boxes, respectively.
7. Next, click on the Create User button.
8. You should see the following statement:
* “Added USERNAME with the password PASSWORD.”
9. Click on the Go Back link.
10. Find the “Add User To Database” section. Select the user you created in Step 6 above from the “User” drop down menu. Then select the database you created in Step 1 above from the “Database” drop down menu.
11. Next, click on the Submit button.
12. When the page loads you will see a two-column table. The top of the table provides a checkbox option “ALL PRIVILEGES” allowing you to create the database with all privileges, otherwise you can check each of the items in the two columns that you want to allow for your new database. The options include:
* SELECT – Allows USERNAME to select data from a table in the database.
* INSERT – Allows USERNAME to insert data into a table in the database.
* UPDATE – Allows USERNAME to update data in a table in the database.
* DELETE – Allows USERNAME to delete data from a table in the database.
* INDEX – Allows USERNAME to create index on table column in the database. This can speed up a database.
* CREATE TEMPORARY TABLES – Allows USERNAME to create temporary tables in the database.
* CREATE – Allows USERNAME to create tables in the database.
* ALTER – Allows USERNAME to alter tables in the database.
* DROP – Allows USERNAME to drop tables in the database.
* LOCK TABLES – Allows USERNAME to lock tables in the database.
* REFERENCES – Allows USERNAME to create references to a table in the database.

NOTE: Typically you may want to check the “All Privileges” option unless you want specific control over the user you are creating for this database.

13. Assuming you have either checked the “All Privileges” option or a combination of the options in the two columns, continue the wizard by clicking on the Make Changes button.
14. You should see the following statement:
* “User USERNAME was added to the database DATABASE.”
15. Click on the Go Back link.
16. You should now see the user you created in Step 6 above in the “Users” column

February 25, 2011 Posted by | cPanel, MySQL | , , | 1 Comment

PHPMyAdmin – Existing configuration file (./config.inc.php) is not readable

Accessing PhpMyAdmin from cpanel I get error

PHPMyAdmin :: Existing configuration file (./config.inc.php) is not readable

1) SSH to server as root

2) check permission for file

# ls -ld /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php

It should be

-rw-r—– 1 root cpanelphpmyadmin 1749 Oct 11 23:06 /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php

3)If not then change ownership and file permission to above.

# chown root:cpanelphpmyadmin  /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php

# chmod 640 /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php

4) Thats it, you are all done.

February 10, 2011 Posted by | PHP | , | Leave a comment

Error on clicking PhpMyAdmin

Warning: session_start() [_function.session-start_(http://xxx.xxx.xxx:2082/3rdparty/phpMyAdmin/function.session-start) ]: SQLite: failed to open/create session database `/var/cpanel/userhomes/cpanelphpmyadmin/sessions/phpsess.sdb – unable to open database:

/var/cpanel/userhomes/cpanelphpmyadmin/sessions/phpsess.sdb in
/usr/local/cpanel/base/3rdparty/phpMyAdmin/libraries/session.inc.php on line 86

Fatal error: session_start() [function.session-start]: Failed to initialize storage module: sqlite (path:
/var/cpanel/userhomes/cpanelphpmyadmin/sessions/phpsess.sdb) in
/usr/local/cpanel/base/3rdparty/phpMyAdmin/libraries/session.inc.php on line 86

SOLUTION:

1) Login to shell of the server using root login details and open the file /usr/local/cpanel/3rdparty/etc/phpmyadmin/php.ini using vi or any other editor

2) Search for [Session] and change the following

FROM:
======
session.save_handler = sqlite
session.save_path =/var/cpanel/userhomes/cpanelphpmyadmin/sessions/phpsess.sdb

======

TO
======
session.save_handler = files
session.save_path = /tmp

======

3) Save and exit

4) Restart apache service.

# /scripts/restartsrv httpd

February 7, 2011 Posted by | PHP | , , | 2 Comments

How to change MySQL database collation from PhpMyAdmin in cPanel

Sometimes its require to change MySQL collation in the web hosting account to use foreign character encoding. There are many ways to change MySQL collation. Here are the following steps to change MySQL collation from PhpMyAdmin in cPanel:

1. Login to your cPanel and click on “PhpMyAdmin” icon.
2. Click on your database name and the go to “Operations” tab.
3. At the bottom of the page you will see the collation option. You can now select a collation from the drop down menu and click on the Go button.

Please note that the new collation will be set for new tables only. Old table will use the previous collation under which they were created. If we want to use new collation for already created tables, we will need to change collation for all tables.

January 16, 2011 Posted by | cPanel, MySQL | , , , | 6 Comments

PhpMyAdmin Error

Topic :- Can’t start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.

It appears that the /var/cpanel/userhomes/cpanelphpmyadmin/ directory has incorrect permissions on it

# cd /var/lib/php

check –> drwxrwx—  2 root apache 4096 Nov 14 02:41 session/

# chown -R cpanelphpmyadmin.cpanelphpmyadmin /var/cpanel/userhomes/cpanelphpmyadmin/

# vi /usr/local/cpanel/3rdparty/etc/phpmyadmin/php.ini

#/etc/init.d/httpd stop

#/etc/init.d/httpd start

January 12, 2011 Posted by | cPanel, PHP | , , | Leave a comment