MySQL Socket Error in phpMyAdmin

While accessing phpMyAdmin, you may get the following error.

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

This is due to the missing socket file in the location /tmp.

The socket path which is specified in the phpMyAdmin configuration file is /tmp/mysql.sock.

Continue reading…

Logical Volume Manager (LVM)

LVM is a method of allocating hard drive space into logical volumes that can be easily resized instead of partitions.

With LVM, a hard drive or set of hard drives is allocated to one or more physical volumes. A physical volume cannot span over more than one drive.

The physical volumes are combined into logical volume groups, with the exception of the /boot/ partition. The /boot/ partition cannot be on a logical volume group because the boot loader cannot read it. If the root (/) partition is on a logical volume, create a separate /boot/ partition which is not a part of a volume group.

Continue reading…

How to recover lost root password

Things happen. You loose password, forget passwords etc.. You can recover your root password if you have access to the server directly. Its slightly different for different distributions. So we will look at teh Debiandistributionexample.
The steps for reseting root password on Debian machine through single user
mode is shown below.

1. Reboot the server and enter GRUB screen (The screen which shows the
boot options)
2. Once the GRUB screen is displayed, use the arrow keys to select the
boot entry showing kernel entry.
3. Press the key “e” to edit the entry
4. At the end of the kernel line add the word “1” or “single” (without the
double quotes)
5. After adding the entry press ESC key to go back to the grub screen
6. press the key “b” to boot this kernel in single user mode
7. You will be now logged in to the shell as root user
8. In the shell type: passwd root
9. It will prompt you for your new password and will ask you to confirm it.
10. Now root password has been reset, you can now reboot your server using
the command “reboot”

Now keep it so that you don’t make this ahabit. Good luck with your root password.

If you require help, contact SupportPRO Server Admin

Server not running properly? Get A FREE Server Checkup By Expert Server Admins - $125 Value

Brief intro about mod_userdir | open_basedir

mod_userdir

It is an Apache module that allows you to create a separate website for each user on a server. These sites can all be accessed by going to,

http://servername.com/~username

Eg:- http://example.com/~user/

The module is installed on most Apache setups by default, but isnt necessarily always enabled. Most mass-hosted cPanel servers make extensive use of it for a variety of reasons.

Apaches mod_userdir allows users to view their sites by entering a tilde(~) and their username as the URL on a specific host. For example http://test.cpanel.net/~test will bring up the user Tests domain

How To Enable

1. To access the Server Setup Menu, click on Server Setup, on the main screen of your WebHost Manager interface. Then, click on Tweak Security.

2. Click on Configure in the mod_userdir Tweak section.

3. Click on the Checkbox next to Enable mod_userdir Protection to enable mod_userdir Protection.

4. Click on a checkbox next to a domains name to allow them to access their domain using ~username, if necessary.

5. Enter the name of any user you wish to be able access the domain using ~username, other than the domains owner, in the blank field next to the domains name, if necessary.

6. Click on Save.

Disadvantage

The disadvantage of this feature is that any bandwidth usage used by the site will be put on the domain it is accessed under .

Mod_userdir protection prevents access to a domain through domain.com/~user. You may however want to disable it on specific virtual hosts (generally shared SSL hosts).

open_basedir

Enable open_basedir

Set open_basedir to only allow access to required portions of the filesystem, like your web sites documents and any shared libraries.

You can set open_basedir in the php.ini file:

; Set open_basedir to the

open_basedir = /var/www/foo.bar/:/usr/local/php/

The setting can also be applied in apaches httpd.conf file, or an .htaccess file:

# Set open_basedir to a safe location

php_value open_basedir /var/www/foo.bar/:/usr/local/php

WHM

Steps :

1. To access the PHP open_basedir Tweak feature, click on Security, on the main screen of your WebHost Manager interface.

2. Then click on Security Center.

3. Then click on PHP open_basedir Tweak.

4. Click on Configure in the PHPs open_basedir section.

5. Click on the check box next to Enable PHP open_basedir Protection to enable Enable PHP open_basedir Protection.

6. Click on a check box next to a domain name to allow them to open files outside of their home directory with PHP, if necessary.

7. Click on Save.
Plesk : If you’re using Plesk hosting control panel, you may need to manually edit Apache configuration file of vhost.conf and vhost_ssl.conf, and add in or edit the following php_admin_value open_basedir lines to the following:

<Directory /full/path/to/the/directory/httpdocs>

php_admin_value open_basedir none

</Directory>

<Directory /full/path/to/the/directory/httpdocs>

php_admin_value open_basedir /full/path/to/dir:/full/path/to/directory/httpdocs:/tmp

</Directory>
Note: For SSL hosts in the vhost_ssl.conf file, the Directory path will end with httpsdocs instead of httpdocs

Disable Manually

Open up the httpd.conf file, and search for the lines that starts with the following characters:

php_admin_value open_basedir ..

Replace the whole line under the virtual host for the domain user account

php_admin_value open_basedir none.

Add Additional Directories
You can also opt to allow your PHP scripts to access additional directory instead without disabling the protection.For example, to add /new_directory to the allow list.

php_admin_value open_basedir /home/user_account/:/usr/lib/php:/usr/local/lib/php:/tmp

php_admin_value open_basedir /home/user_account/:/usr/lib/php:/usr/local/lib/php:/tmp:/new_directory

Restart the Apache after finished editing

Article Authored by Ajith KK

Author, Ajith KK, is a Systems Engineer with SupportPRO. Ajith specializes in L1 and L2 Linux/Windows administration. SupportPRO offers 24X7 technical support services to Web hosting companies and service providers.

If you require help, contact SupportPRO Server Admin

Server not running properly? Get A FREE Server Checkup By Expert Server Admins - $125 Value