Search This Blog

Wednesday, May 23, 2012

Service stuck in "starting" or "stopping" state.

Windows  Service stucking problem.

Many times, service stuck and we don't know what to do with this issue.
If your server is production and you can't reboot him right now, but you must start or stop the specific service - this post for you.


1. Open command prompt
Let's find your service and identify the PID.
If you already know the name of service, run next command:

sc queryex w32Time

and you will see PID number.
If you don't know name of the service, just run same command without name of the service.

sc queryex

you will see list of all services, just find what you need.

2. Let's kill the service.
Now you know PID of the service and let's kill him!

taskkill /f /pid 1132

That's all.

enJoY!

Tuesday, May 22, 2012

Windows Server 2008/2008 R2 Administrator's password reset.

How to reset administrator's password in windows server 2008?


Step 1
a) Insert DVD disk of Windows Server 2008
b) Boot from DVD disk
c) Navigate to "Repair your computer"

d) Choose first option ("Use recovery tools that can........")

e) Choose recovery tool:  "Command Prompt"

f) Enter commands like on screenshot below.

g) Click on "Restart"

Step 2
a) Click on utils button

b) Follow the screenshot below

c) Now you can login to server with Administrator withou any problems.

DON'T FORGET TO CHANGE UTILMAN.EXE BACK!!
Go to step 1. and open "Command Prompt"
Enter next commands to change back your utilman.exe
d:
cd windows/system32
move utilman.exe.bak utilman.exe

RESTART

eNj0Y!

Wednesday, May 16, 2012

mod_deflate configuration. Error playing .swf (flash)

Apache v2 module Deflate.

Today I stuck on something very strange.
Server whom I worked on it, run's WHM and on one of the websites, I saw follow issue:
Main page running .swf files, I mean flash. When I open the website in google chrome and internet explorer,  I see blank grey page while in FIREFOX it works fine.

               What is the problem here?

First I checked which modules installed on this server by httpd –l command.
Afterwards, I dug from network something interesting and I tried to resolve this issue. So better  Keep it for your self.
On this server installed mod_delflate.

Quote from WIKI:
"mod_deflate is an optional module for the Apache HTTP Server, Apache v2 only. Based on Deflate lossless data compression algorithm that uses a combination of the LZ77 algorithm and Huffman coding.This module provides the DEFLATE output filter that allows output from Apache HTTP server to be compressed before being sent to the client over the network.It also provides a filter for decompressing (inflating, uncompressing) a gzip compressed response body.The mod_deflate module does not have a lower bound for file size, so it attempts to compress files that are too small to benefit from compression. This results in files smaller than approximately 120 bytes becoming larger when processed by mod_deflate"
To resolve this problem, you need to edit  /usr/local/apache/conf/includes/post_virtualhost_global.conf
Add SWF extension to  "Don't compress images"
Here is my example:

<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
<IfModule mod_setenvif.c>
# Netscape 4.x has some problems…
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won’t work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don’t compress images
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png|swf)$ no-gzip dont-vary
</IfModule>
<IfModule mod_headers.c>
# Make sure proxies don’t deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>
</IfModule>

Exit from editor, save and restart httpd.
/etc/init.d/httpd restart
Refresh your website, it's should be ok.
eNj0y!

Tuesday, May 15, 2012

mySQL dump - Import/Export database

How to import sql dump file to mySQL database?

Connect to the server ssh and run following commands.
Import DB:

cd ~
mysql -u database_user -p yourdatabase_db < restore_db.sql
type your mysql password.
Check if all tables exist:
mysql -u database_user -p
type your mysql password again.
show databases;
connect yourdatabase_db
show tables;
Check if all tables exist.

Export DB:
cd ~
mysqldump -u database_user  -p yourdatabase_db > filename.sql
type your mysql password.
ls -l
check if filename.sql exist.




Installation of ConfigServer Security (csf) - cPanel

Installation and configuration of ConfigServer Security(csf & lfd) - for cPanel

csf installation:

1) Login to WHM and navigate to EasyApache.
2) For perfect installation and working of CSF and your websites, you will need to enable next modules and extensions before starting install it.

Must be enabled:

Ident
Imagemap
Mime Magic
Bz2
Curl
Curlwrappers
Exif
GD
Magic Quotes
Mbregex
Mbstring
Mcrypt
Mysql
PDO
TTF
Tidy
XSL
Zip

For finish installation choose "Save and build" and wait few minutes until you get complete message.
Next steps:
Connect to your server via ssh and run next commands to install csf:

cd ~
tar -xzf csf.tgz
cd csf
sh install.sh

That's all, csf is installed successfully . To configure csf and lfd go to /etc/csf/ directory and open with your favorite editor next files:
cd /etc/csf
vi csf.conf
White list: csf.allow
Black list:  csf.deny
To add a specific IP to black list edit csf.deny and add IP Address.
For example:
vi csf.deny
167.XXX.XX.XXX # (too many wrong authentication)
All logs of csf located in /var/logs/lfd.log
To start/stop/restart csf, run from command line /etc/init.d/csf start
Also you can configure it through WHM -> Plugins -> ConfigServer Security & Firewall.
eNj0y!




Wednesday, May 9, 2012

Import database error. phpMyAdmin.

"Got a packet bigger than 'max_allowed_packet' bytes"


To resolve this issue, you need to add or edit line in my.cnf file.

cd /etc
vi my.cnf
under [mysqld] add following:

max_allowed_packet=5M

Save and quit from your editor and restart mysql.
/etc/init.d/mysql restart
Try to import db again.

Tuesday, May 8, 2012

How to enable error printing in magento?


"There has been an error processing your request

Exception printing is disabled by default for security reasons.

Error log record number: XXXXXXXXXXXX"


Solution:

Via file manager:
First of all, go to your root directory.
public_html/errors
Copy local.xml.sample to local.xml

Via SSH:
cd /home/webUser/public_html/errors
cp local.xml.sample local.xml

Refresh your website.