How to enable GeoIP Apache API (mod_geoip)

January 27th, 2010

cd /usr/src
wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP-1.4.6.tar.gz
tar -xvzf GeoIP*
cd GeoIP*
./configure
make
make install

cd /usr/src
wget http://geolite.maxmind.com/download/geoip/api/mod_geoip2/mod_geoip2_1.2.5.tar.gz
tar -xvzf mod_geoip*
cd mod_geoip*
/usr/local/apache/bin/apxs -i -a -L/usr/src/GeoIP-1.4.6/libGeoIP -I/usr/src/GeoIP-1.4.6/lib/GeoIP -lGeoIP -c mod_geoip.c

Please note, you need to enable mod_geoip inside your httpd.conf with the following lines:

GeoIPEnable On
GeoIPDBFile /usr/local/share/GeoIP/GeoIP.dat

/usr/local/apache/bin/httpd: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory

December 19th, 2009

If you see following error during easyapache -

/usr/local/apache/bin/httpd: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory

Solution :

ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2

If this didn’t work then add following line in /etc/ld.so.conf file

/usr/local/lib/

and execute command

ldconfig

Now run easyapache.

How do I safely remove the /home/virtfs directory?

November 18th, 2009

The virtfs directory contains hard links to all the system binaries to help with security via jailshelled accounts.

If you remove the virtfs system without unmounting the directories under it, you will completely break the system.

The procedure you need to do is the following:

cd /home/virtfs
find . -regex ‘^.*[How do I safely remove the virtfs directory?^.]‘ -type d > t1
for i in $(cat t1); do umount $i; done

After this is ran, you can safely recursively remove the /home/virtfs directory.

Cannot change ownership to uid 501, gid 501: Disk quota exceeded

November 5th, 2009

If you see following error while updating Perl modules -

Cannot change ownership to uid 501, gid 501: Disk quota exceeded

Then go to WHM -> Basic cPanel/WHM Setup and change the Minimum UID to something like 30000

Warning: in_array() [function.in-array]: Wrong datatype for second argument – Fantastico

October 9th, 2009

In users cPanel after clicking the Fantastico icon. Left column is filled with:

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /tmp/cpanel_phpengine.1230646571.28207lX8XQnNUIp on line 1225

Solution :

1) Go into WHM as root, click on Tweak Settings, scroll down to the PHP section and make sure the IONCUBE PHP Loader is selected. Save changes if needed. Also make sure ioncube loader is installed on server.

2) Log into your server as root via SSH and execute the following command:
/scripts/makecpphp

No Input File Specified – With new Fantastico

September 12th, 2009

After installing Fantastico if you see this error on every Fantastico page:

No Input File Specified

Create the following directories if they do not exist:

Code:

mkdir /usr/local/cpanel/base/tmp
mkdir /usr/local/cpanel/3rdparty/tmp

Then chmod each one of them to 777:

Code:

chmod -R 1777 /usr/local/cpanel/base/tmp
chmod -R 1777 /usr/local/cpanel/3rdparty/tmp

chmod -R 1777 /tmp

If it doeesn’t fix then run the following script

/scripts/makecpphp

Above script will make new cpanel php.ini file, please note that this is not related to apache,  php.

www.domain.com shows Default Plesk page – Windows

September 9th, 2009

* First check the DNS zone file for domain.com in Plesk -> Domains -> domain.com -> DNS and entry for www.domain.com is set correctly

* Disabled/Enabled the option for www in Plesk -> Domains -> domain.com -> Rename Domain -> Uncheck -> Save and repeat it by selecting the option again

* Next reconfigured the virtual host by running following command in DOS prompt of your VPS.

* cd %plesk_bin%

* websrvmng.exe –remove-vhost –vhost-name=domain.com

* websrvmng.exe –reconfigure-vhost –vhost-name=domain.com

* Make sure that host header with ‘www’ prefix is presented in the list of identities.IIS > Web Sites > domain.com > Right Click Properties > Web Site tab > Advanced ;if it’s missing then add it.

Plesk – Error Message When Logging In

August 26th, 2009

Product versions this article applies to:

* Plesk 7.6 for Windows

SYMPTOMS:

When you attempt to log in to Plesk Panel you get a message:
——————-

The file filename.php is part of Plesk distribution. It cannot be run outside of Plesk environment.

——————-
CAUSE:

A *.php file can not be decrypted by Plesk engine. A *.php file can not be decrypted if:

1. Plesk key installed is not valid. It means that you could install key for Plesk for Linux not for Windows or something else.
2. Plesk php environment is corrupt.

RESOLUTION:

To fix the first case you need to do the following:

1. Close your browser. Or just make sure that your browser does not show cached web pages.

2. Stop Plesk Control Panel Service.

3. Remove all files from within %plesk_dir%PrivateTemp

4. Reset current Plesk to default PLSK.00000000.0000. You can do it using defpkey.reg attached to this article.

5. Start Plesk Control Panel Service.

6. Re-upload valid Plesk key straight via Plesk Panel. You can upload PLSK.XXXXXXXX.XXXX.exe key.

To fix the second case you need to do the following:

Switch Plesk web server to another.

If IIS is used as Plesk web server switch it to Apache:

%plesk_bin%\reconfigurator.exe –switch-plesk-web-server –new-provider=apache

If Apache is used as Plesk web server switch it to IIS:

%plesk_bin%\reconfigurator.exe –switch-plesk-web-server –new-provider=iis

Check how you Panel works. If it shows the same message it means that PHP files were changed. In this case you need to ran Plesk Repair.

Plesk – Access Denied To cmd.exe

August 26th, 2009

When logging into Plesk you receive the following errror:

DefPackageMng() constructor failed: defpackagemng failed: Access is denied. (Error code 5) at CreateProcess ‘C:\WINDOWS\system32\cmd.exe /c “”C:\Program Files\SWsoft\Plesk\admin\bin\defpackagemng.exe” –get”‘
at execUtil C:\Program Files\SWsoft\Plesk\admin\bin\defpackagemng.exe –get on C:\Program Files\SWsoft\Plesk\admin(PleskSrvClient::execUtil line 420)
at execute console command –get(vconsoleapp::start line 128)
at execute “C:\Program Files\SWsoft\Plesk\/admin/bin/defpackagemng” –get(vconsoleapp::run line 138)
———————- Debug Info ——————————-
0: C:\Program Files\SWsoft\Plesk\admin\plib\class.DefPackageMng.php:14 psaerror(string “DefPackageMng() constructor failed: defpackagemng failed: Access is denied. (Error code 5) at CreateProcess ‘C:\WINDOWS\system32\cmd.exe /c “”C:\Program Files\SWsoft\Plesk\admin\bin\defpackagemng.exe” –get”‘
at execUtil C:\Program Files\SWsoft\Plesk\admin\bin\defpackagemng.exe –get on C:\Program Files\SWsoft\Plesk\admin(PleskSrvClient::execUtil line 420)
at execute console command –get(vconsoleapp::start line 128)
at execute “C:\Program Files\SWsoft\Plesk\/admin/bin/defpackagemng” –get(vconsoleapp::run line 138)”)
1: C:\Program Files\SWsoft\Plesk\admin\plib\class.Components.php:171 defpackagemngmaker()
2: C:\Program Files\SWsoft\Plesk\admin\plib\class.Components.php:97 components->getcomponetslist(boolean true)
3: C:\Program Files\SWsoft\Plesk\admin\htdocs\login_up.php3:610 components->componentupdate()

It appears the reason of the problem was in denied rights to C:WINDOWSsystem32cmd.exe file to SYSTEM account. You can give it FULL CONTROLL to SYSTEM account to that file and after that was able to log into Plesk.

Go into the permissions screen for this file and select ‘Full Access’ for the ‘System’ User. Once this is done, plesk should work correctly.

But the situation is not clear. We don’t know was it done manually or viruses did that. Windows Update could have also caused the above issue as well. You can test your system for viruses using the following utility:

http://download.drweb.com/drweb+cureit/

The above could have possibly been caused by the following virsues:

BackDoor.SHELLBOT
Backdoor.HacDef.100
Backdoor.WinShell.50
Trojan.Aphex.71

Plesk Windows – Reseting the MySql Password

August 26th, 2009

Once you have logged into the server you via Remote Desktop you will need to take the following steps:

1. Go to ‘Start >> Run’ and type in ’services.msc’.

2. Now you will need to look for ‘MySql Server’ In the Services window.

3. Right click on ‘MySql Server’ and go to ‘Properties’.

4. Once you have copied the location of the ‘my.ini’ file like the following example you will need to go to ‘Start >> Run’ and then enter in the location of the ‘my.ini’ file.

C:\Program Files\SWsoft\Plesk\Databases\MySQL\Data\my.ini

5. Under the ‘[mysqld]‘ section in the ‘my.ini’ file you will need to add the following line:

skip-grant-tables

6. Restart ‘MySql Server’.

7. Then you will need to login to MySql:

cd C:\Program Files\SWsoft\Plesk\MySQL\bin

C:\Program Files\SWsoft\Plesk\MySQL\bin>mysql -u admin
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7 to server version: 4.1.18-nt

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> use mysql;
mysql> UPDATE mysql.user SET Password=PASSWORD(’newpwd’) WHERE User=’root’;
mysql> FLUSH PRIVILEGES;
mysql> quit;

8. Then you will need to remove ’skip-grant-tables’ from the my.ini file and restart ‘MySql’ after resaving the my.ini file.