Blogger Blog Design

Sorry for the poor design of my blog. I'm working on this. (I hope someone is kind enough to donate me a header) Lol. Kiddin.

Looks doesn't matter I guess but design is also somewhat important to visitors. I just posted this to let you all know.

Thanks for the visit!


It's been a while since my last post. I got so little time in updating my blog because of the tons of tasks assigned to me. Plus the Holy Week Vacation. Lol. Anyway, I am cooking something and I promise to post here what'll be the outcome and of course the how-to. ;)

The open_basedir function defines the locations or paths from which PHP is allowed to access files using functions like fopen() and gzopen(). If a file is outside of the paths defined by open_basdir, PHP will refuse to open it. You cannot use a symbolic link as a workaround, because the path that the symbolic link resolves to falls under the restrictions of the open_basedir function.

Here's a quick bit of apache config that can be placed in the conf/vhost.conf file of a Plesk site to turn off the open_basedir restrictions:

php_admin_flag engine on
php_admin_value open_basedir none

How to turn off PHP safe mode

All you have to do is to modify your php.ini. ( Config file for PHP)

Change the line safe_mode = on to safe_mode = off.

In windows for Plesk, the path is C:\\windows\php.ini.
In linux for Plesk, the path is /etc/php.ini.

You should restart the web server service in order for the changes to take effect.


On the Plesk 8.x versions, it provides an added functionality wherein you can edit the PHP Safe Mode option for single or multiple domains.

1. Login as administrator to the Plesk control panel.

2. Click on the Domains.

3. Check the domain you want to edit then choose Group Operations. This is located on the upper part of the Domains' page. This is also where you edit the other global changes for the domain/s.

4. Scroll down until you see the Hosting options.

5. Look for the line "PHP 'safe_mode' on", tick the radio button under the Disable column.

You can now safely assure that all of your applications that requires PHP Safe mode off will perfectly work.



I've created a new post on how this can be done on Cpanel. Here's the link.

Logging in to Plesk Automatically

If you don't want to type your username and password everytime you log in into the plesk control panel, here's a quick way to help you solve the problem:

Of course you need to supply in the correct details:

And one last thing.

Do not forget to bookmark the link!

How to add spam filtering in Plesk

Here's a quick command in enabling spamassasin for all Plesk users.

# mysql -u admin -p`cat /etc/psa/.psa.shadow` psamysql> update mail set spamfilter = 'true' where postbox = 'true';

# /usr/local/psa/admin/bin/mchk --with-spam

This applies to Plesk 8.

Creating wildcard subdomains in Plesk

First step in creating wildcard subdomains in Plesk is you should have a CNAME or A record for * which points to (for a CNAME), or the domain’s IP (for an A record.

Then you will need to configure Apache with the following line in the domain's vhost.conf:

ServerAlias *

If the vhost.conf didn’t exist before, you will need to run:

# /usr/local/psa/admin/bin/websrvmng -av

You will need to reload the httpd service so that the changes you did will take effect.

Use this command:

# /etc/init.d/httpd reload

Unable to bind: address already used

You are here because you have seen the following message in either /var/log/qmail/qmail-smtpd/current or /var/log/qmail/qmail-pop3d/current.

tcpserver: fatal: unable to bind: address already used

If you see this error message, the problem is that another program has bound to the address to which you are trying to bind. Stop the revelant service with using the svc command. Verify the service is down with the svstat command. The below example will use the qmail-smtpd service.

# svc -d /service/qmail-smtpd
# svstat /service/qmail-smtpd

The service should show as down. Next run the following command to verify another program has bound to the port using the netstat and grep commands. The below example continues with the qmail-smtpd service as will the rest. If you are experiencing this problem with qmail-pop3d, substitute 110 in place of 25. If the command returns something, then another program is bound to that port.

# netstat -an grep 25

After determining something is indeed bound to the address, determine what program is with the lsof command.

# lsof -n -i:25

The output of lsof will tell you what program is running on that port. You need to stop that program and remove it and its related start scripts. Once this is completed, you can restart the service by using the svc command.

# svc -u /service/qmail-smtpd

Now verify that the service has started correctly with the svstat and tail commands.

# svstat /service/qmail-smtpd
# tail /var/log/qmail/qmail-smtpd/current

The svstat command should show the service running for more than one second. The tail command should also show that the service has started correctly and the address already in use message has disappeared.

Preventing this error:

The two most common causes of this error are:

1. Not stopping any pre-existing mail server software. If you are installing qmail on a machine which already has sendmail, postfix, exim, or some other mail server installed (possibly installed by default with your OS distribution) you need to make sure that this other program is not only stopped, but is not configured to run automatically when the system boots.

For RedHat, Fedora, CentOS, Whitebox, and other RedHat-like systems, you can use the chkconfig command to make sure these other services will not start automatically when the system boots. You may need a command like this:

# chkconfig --level 2345 sendmail off

For debian linux, there is a similar command called update-rc.d. A similar command would look something like this (and if somebody knows debian better than I do, please correct me here...)

# update-rc.d -r -f sendmail

2. Running two services on the same port without specifying separate IP addresses. Note that running one service with a specific IP address and another service with (or just 0) as the IP address is the same thing- the service running with will try and attach to every IP address on the machine, and if anything is already attached to even one of those IPs, it will fail. Likewise, if there is a service running on and another service tries to start which uses the same port a single IP, it will fail. There is no way to "share" a port on any single IP address- if you need to share a single port between two services, those services MUST be listening on different IP addresses, and neither of them can use

Retrieved from ""

One client's contact form that is using the PHP mail function suddenly stopped working. I thought it was a misconfiguration on sendmail:

[mail function]
; For Win32 only.
SMTP = localhost

; For Win32 only.
sendmail_from =

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = /usr/sbin/sendmail -t -i

You are using qmail!

Bummer! Looking back into my notes,I found out that qmail supports sendmail binaries so it doesn't matter whether PHP specifies the old path to sendmail.

And prior to that day, we reinstalled Qmail.(Server got hit by a spammer) So maybe we messed up a bit with the symlinks.


Link the sendmail binary with qmail-sendmail using this command:

ln -s /var/qmail/bin/qmail-sendmail /usr/sbin/sendmail

That solved the problem. Hope this post helps you too.

Mysql Cheatsheet/Quick Facts

What is mysql?

MySQL is an Open Source Database Management created by MySQL AB, a commercial company owned by the MYSQL Developers.

Check out this great mysql cheatsheet. I know the basics of MySQL but I still need some practice. This surely will be a big help to all MySQL noobs.


SELECT * FROM table1, table2, ...
SELECT field1, field2, ... FROM table1, table2, ...
SELECT ... FROM ... WHERE condition
SELECT ... FROM ... WHERE condition GROUPBY field
SELECT ... FROM ... WHERE condition GROUPBY field HAVING condition2
SELECT ... FROM ... WHERE condition ORDER BY field1, field2
SELECT ... FROM ... WHERE condition ORDER BY field1, field2 DESC
SELECT ... FROM ... WHERE condition LIMIT 10
SELECT DISTINCT field1, field2 FROM ...
SELECT ... FROM t1 JOIN t2 ON t1.id1 = t2.id2 WHERE condition
SELECT ... FROM t1 LEFT JOIN t2 ON t1.id1 = t2.id2 WHERE condition
SELECT ... FROM t1 JOIN (t2 JOIN t3 ON ...) ON ...


field1 = value1
field1 <> value1
field1 LIKE 'value _ %'
field1 IS NULL
field1 IS NOT NULL
field1 IS IN (value1, value2)
field1 IS NOT IN (value1, value2)
condition1 AND condition2
condition1 OR condition2

Data Manipulation

INSERT INTO table1 (field1, field2, ...) VALUES (value1, value2, ...)
DELETE FROM table1 / TRUNCATE table1
DELETE FROM table1 WHERE condition
-- join:
DELETE FROM table1, table2 FROM table1, table2 WHERE table1.id1 = table2.id2 AND condition
UPDATE table1 SET field1=new_value1 WHERE condition
-- join:
UPDATE table1, table2 SET field1=new_value1, field2=new_value2, ... WHERE table1.id1 = table2.id2 AND condition


KILL process_number

Create / Delete database


Create/Delete/Modify table

CREATE TABLE table (field1 type1, field2 type2, ...)
CREATE TABLE table (field1 type1, field2 type2, ..., INDEX (field))
CREATE TABLE table (field1 type1, field2 type2, ..., PRIMARY KEY (field1))
CREATE TABLE table (field1 type1, field2 type2, ..., PRIMARY KEY (field1, field2))
CREATE TABLE table1 (fk_field1 type1, field2 type2, ...,
FOREIGN KEY (fk_field1) REFERENCES table2 (t2_fieldA))
CREATE TABLE table1 (fk_field1 type1, fk_field2 type2, ...,
FOREIGN KEY (fk_field1, fk_field2) REFERENCES table2 (t2_fieldA, t2_fieldB))
DROP TABLE table1, table2, ...
ALTER TABLE table MODIFY field1 type1
ALTER TABLE table MODIFY field1 type1 NOT NULL ...
ALTER TABLE table CHANGE old_name_field1 new_name_field1 type1
ALTER TABLE table CHANGE old_name_field1 new_name_field1 type1 NOT NULL ...
ALTER TABLE table ADD new_name_field1 type1
ALTER TABLE table ADD new_name_field1 type1 FIRST
ALTER TABLE table ADD new_name_field1 type1 AFTER another_field
ALTER TABLE table DROP field1
ALTER TABLE table ADD INDEX (field);
-- Change field order:
ALTER TABLE table MODIFY field1 type1 FIRST
ALTER TABLE table MODIFY field1 type1 AFTER another_field
ALTER TABLE table CHANGE old_name_field1 new_name_field1 type1 FIRST
ALTER TABLE table CHANGE old_name_field1 new_name_field1 type1 AFTER another_field
ALTER TABLE old_name RENAME new_name;


CREATE TABLE table (..., PRIMARY KEY (field1, field2))
CREATE TABLE table (..., FOREIGN KEY (field1, field2) REFERENCES table2 (t2_field1, t2_field2))


GRANT ALL PRIVILEGES ON base.* TO 'user'@'localhost' IDENTIFIED BY 'password';
GRANT SELECT, INSERT, DELETE ON base.* TO 'user'@'localhost' IDENTIFIED BY 'password';
REVOKE ALL PRIVILEGES ON base.* FROM 'user'@'host'; -- one permission only
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user'@'host'; -- all permissions
SET PASSWORD FOR 'user'@'host' = PASSWORD('new_pass')
DROP USER 'user'@'host'

Main Data Types

TINYINT (1o: -217+128) SMALLINT (2o: +-65 000)
MEDIUMINT (3o: +-16 000 000) INT (4o: +- 2 000 000 000)
BIGINT (8o: +-9.10^18)
Precise interval: -(2^(8*N-1)) -> (2^8*N)-1
/!\ INT(2) = "2 digits displayed" -- NOT "number with 2 digits max"
/!\ 8,3 -> 12345,678 -- NOT 12345678,123!
TIMESTAMP (like DATETIME, but 1970->2038, compatible with Unix)
VARCHAR (single-line; explicit size) TEXT (multi-lines; max size=65535) BLOB (binary; max size=65535)
Variants for TEXT&BLOB: TINY (max=255) MEDIUM (max=~16000) LONG (max=4Go)
ENUM ('value1', 'value2', ...) -- (default NULL, or '' if NOT NULL)

Forgot root password?

$ /etc/init.d/mysql stop
$ mysqld_safe --skip-grant-tables
$ mysql # on another terminal
mysql> UPDATE mysql.user SET password=PASSWORD('nouveau') WHERE user='root';
## Kill mysqld_safe from the terminal, using Control + \
$ /etc/init.d/mysql start

Repair tables after unclean shutdown

mysqlcheck --all-databases
mysqlcheck --all-databases --fast


From SWSOFT's Knowledgebase, here's a step by step information in enabling firewall in a Virtuozzo for Linux VE. (Virtual Environment)

First of all you should define which iptables modules are available for VEs.

Edit /etc/sysconfig/iptables-config and /etc/sysconfig/vz on the hardware node. Add modules you need into IPTABLES_MODULES= and IPTABLES= lines correspondingly. Please note that all iptables modules in /etc/sysconfig/vz file in IPTABLES parameter should be listed in one single line, no linebreaks are allowed in this parameter.

For example, typical firewall configuration requires the following modules:

ipt_REJECT ipt_tos ipt_TOS ipt_LOG ip_conntrack ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length ipt_state iptable_nat ip_nat_ftp

The changes will be applied after you load all required modules and restart Virtuozzo service (all VEs will be restarted):

# service vz stop
# service iptables restart
# service vz start

Modules you defined will be available for all VEs. However, you can also define a list of iptables modules for each VE using --iptables option of vzctl utility, e.g.:

# vzctl set 101 --iptables ipt_REJECT --iptables ipt_tos --iptables ipt_TOS --iptables ipt_LOG --iptables ip_conntrack --iptables ipt_limit --iptables ipt_multiport --iptables iptable_filter --iptables iptable_mangle --iptables ipt_TCPMSS --iptables ipt_tcpmss --iptables ipt_ttl --iptables ipt_length --iptables ipt_state --iptables iptable_nat --iptables ip_nat_ftp --save

You will probably need to increase the barrier of numiptent parameter in /proc/user_beancounters using vzctl utility. This parameter limits amount of iptables rules which VE owner is allowed to create. For example, this is how you allow to enter 400 iptables rules on VE 101:

# vzctl set 101 --numiptent 400 --save

If you get this error when restarting httpd on plesk linux servers:

"Address already in use: make sock: could not bind to address no listening sockets available."

Actually the error says it all.

First, try to look for the processes that is listening to port 80 or 443. You can do this:

1. netstat -lnp grep ''
2. lsof grep *:www
3. lsof -i:443
4. fuser -v 443/tcp
5. netstat -tulpen grep :443

After pointing out which uses the port, send a kill signal:

#kill -9 PID

Replace "PID" with the actual PID.

Hope that helps.

Plesk provides a feature to select/deselect PHP support for each domain. Sometimes, the check box to enable/disable PHP support is grayed out, so the user won’t be able to use that feature. This happens if PHP is not installed or the installed PHP is not recognized by Plesk components. In most cases this happens if you have installed PHP manually (not using the rpm comes with Plesk).

You can see the installed PHP components in the following way:

Using Plesk control panel, click on Plesk–>server–>component info, you can see if the installed PHP is detected by the Plesk. The same details of installed (detected) components can be seen using mysql.

#mysql -u admin -p’cat /etc/psa/.psa.shadow’
mysql> use psa;mysql> select * from Components;

If you see the value of php as not_installed, you probably have to edit the database to detect the currently installed PHP version. Follow the steps below to do this.

Find out the current PHP version:

#php -v

Then, edit the psa components table

#mysql -u admin -p’cat /etc/psa/.psa.shadow’
mysql> use psa;mysql> update Components set version=”4.4.6″ where name=”php” limit 1; mysql>\q

Restart plesk:
#/etc/init.d/psa stopall
#/etc/init.d/psa start


root ]# cat /etc/psa/.psa-shadow

From the command line type:

“C:\Program Files\SWsoft\Plesk\admin\bin\plesksrvclient.exe” -get
Note: The path “C:\Program Files\SWsoft\” may change according to its installation directory.

One of the most important things in system administration is password management. But what if you forgot the Plesk admin password? Here's a quick how to:


root ]# cat /etc/psa/.psa-shadow


From the command line type:

“C:\Program Files\SWsoft\Plesk\admin\bin\plesksrvclient.exe” -get

Note: The path “C:\Program Files\SWsoft\” may change according to its installation directory.

Login for webstats on Plesk

Login for webstats on Plesk

Open domain’s httpd.include (HTTPD_VHOSTS_D/domain/conf/httpd.include) file and search for something like:

"AuthType BasicAuthName “Domain statistics”AuthUserFile /var/www/vhosts/domain/pd/d..httpdocs@plesk-statrequire valid-user"

The above entry tells that access to web-stats page (/var/www/vhosts/domain/statistics) is restricted to valid-users specified within ‘AuthUserFile’.
So, create an encrypted password using htpasswd and append its output to ‘AuthUserFile’.
$ htpasswd -nb username userpass
>> /var/www/vhosts/domainName/pd/d..httpdocs@plesk-stat

Note: Don’t forget to use ‘>>’. Using one symbol (>) will erase existing entries.

Now, you should be able to login using username & userpass.

Source: mohammednv

If you receive the following error during attempting to login into Horde Webmail:

"A fatal error has occurred DB Error: connect failed Details have been logged for the administrator. "

Please make sure that the following line exists in the directory /etc/my.conf:


Also check that Mysql service is running and that the /var/lib/mysql/mysql.sock socket exists. Make sure that the Horde user is able to connect to the Horde database with a password from etc/psa/.webmail.shadow using the command:

# mysql -uhorde -p`cat /etc/psa/.webmail.shadow` -D horde

If /etc/psa/.webmail.shadow is missing, put some password into this file and change the password for the Horde user in the MySQL database using the query listed below. If you get the error, make sure that the only one Horde MySQL user exists in the user table in MySQL database and try to change its password with a MySQL query like:

# mysql -uadmin -p`cat /etc/psa/.psa.shadow` -D mysqlmysql> update user set password=password(”THE_PASSWORD_FROM_WEBMAIL.SHADOW”) where user=”horde”;mysql> FLUSH PRIVILEGES;

Look into the psa-horde log (by default: /var/log/psa-horde). If you see something like:

Nov 02 12:55:06 HORDE [emergency] [horde] DB Error: connect failed: [nativecode=Access denied for user: ‘root@localhost’ (Using password: NO)] ** Array [on line 1329 of “/usr/share/psa-horde/lib/Horde/DataTree/sql.php”]

Make sure that sql.safe_mode is disabled in php.ini, such as:


Restart Apache after changes in php.ini have been made.

Source: mohammednv

Changing Plesk Outgoing Mail Port

The title says it all. Here's a simple how to from
a great wordpress blogger.

Here are the steps in changingthe outgoing mail port for Plesk.

1. Create a copy of smtp_psa by entering:

# cp /etc/xinetd.d/smtp_psa /etc/xinetd.d/smtp_nonstandard

2. Add these lines to the copy you just made.

#vi /etc/xinetd.d/smtp_nonstandard
type = "UNLISTEDport = 2525" <>and change the service name to match the name of the file.

3. Restart xinetd.

# /etc/init.d/xinetd restart

You should now be able to send mails through port 2525. You can also use any available port you want.


When trying to login to Plesk as an admin user, a popup says “Access Denied”.


Enter the following commands:

mysql -u admin -p`cat /etc/psa/.psa.shadow`use psa;

delete from lockout where login = ‘admin’;

NOTE: Plesk has an built-in security feature with account logins (basically only 3 login attempts are allowed). That is, if you get your password or username wrong 3 times, the server will lock you out.

If you are getting an error that says “File cannot be found” or if you are receiving a 404 error when you try to go to, this is due to the fact that default mapping application extensions do not include php support.

To solve this, do the following:

1. Go to “Start” - > “Administrative Tools” -> “Internet Information Services (IIS) Manager”.

2. Expand the server (local computer).

3. Expand “Web Sites”.

4. Right-click on “webmail(default)” and click “Properties”.

5. Go to the “Home Directory” tab.

6. Click on the “Configuration” button towards the bottom.

7. In the list box that appears, if the extensions php, php3, and phtml do not exist, you have found your problem.

8. Click “Add”.

9. Type the location of the file php.exe in the “Executable” field. For example: C:\Program Files\SWsoft\Plesk\Php\php.exe.

10. Type: .php in the “extension” field.

11. Leave everything else as default checked. Click “OK”.

12. Repeat this setup using the same executable and adding the extensions: .php3 and .phtml

Webmail should be up and running now.

Source: mohammednv

To enable MAPS SPAM protection in Plesk, begin by selecting the server you wish to manage, then “Mail”, then “MAPS Zone”. The 5 major SPAM protection lists are listed below with a general description.

Users can define which lists they would like to use:

1. Spamhaus block list (SBL) A free real-time DNS-based database of IP addresses of verified SPAMmers, SPAM gangs and SPAM services.

2. Arbitrary black hole list (ABL) Aggressive black list that may stop mail from popular mail servers (,

3. Domain Name System Real-time Black List (DNSRBL) List of IP addresses of machines that are either direct SPAM sources or Dial-up (dynamic address) pools which would never be a source of non-SPAM messages.

4. VOX DNSBL List of servers that send out SPAM, compiled by and it’s partners.

5. RFC Ignorant (Whois) List of IP’s that do not comply with RFC’s.

In the newer versions of Plesk, such as Plesk 8.1, they have renamed the “MAPS Zone” option to “Enable support for Trend Micro RBL+ Service.” If you want to enter multiple lists, separate the lists by semicolon. For example: “” or “;”.

Thanks to mohammednv.

If you see empty page in Plesk control panel instead of a page with content, it means that an error occurred. By default Plesk does not show PHP errors for security reasons. To enable PHP error reporting, you can edit $PRODUCT_ROOT_D/admin/conf/php.ini and set display_errors = On, then restart Plesk. This should resolve the issue and help you locate the error.



When send an email, you get this error:

“Your message did not reach some or all of the intended recipients. 553 sorry, that domain isn’t in my list of allowed rcpthosts.”


1. Log in as administrator to the Plesk control panel.
2. In the Server Administration (click “Server” in the menu)then choose the “Mail” icon.
3. Select the tab “Maximum letter size and relay mode parameters”.
4. Check the box “POP 3 lock time”.
5. Click “Set”.
6. Restart “PSA”.


Alternatively, you can check out Swsoft's knowledgebase entry regarding this matter:
Source: mohammednv

I'd like to start sharing you really useful problems and fixes from a linux wordpress blogger. Here's one:


While logging into Plesk control panel, you may get the following error:
“Access for administrator from address xx.xx.xx.xx is restricted in accordance with IP Access restriction policy currently applied.”


This means Plesk IP access policy was configured in such a way that Plesk cannot be accessed from the current IP. To enable Plesk CP access one needs to login to Plesk Control Panel locally and change IP access policy.

It can be done the following way:

Server > Acess (under the section Administrator information) > Remove necessary IP address/subnet/network

If localhost is also blocked, the Plesk database records regarding access policy need to be corrected.

To retrieve the current policy and restricted/allowed IPs the following commands can be used:

#mysql -uadmin -p`cat /etc/psa/.psa.shadow` -P8306 psa
mysql> select * from cp_access;mysql> select * from misc where param=’access_policy’;
To clear the access policy settings remove all the records from the “cp_access” table and set policy to “allow”:
mysql> delete * from cp_access;mysql> update misc set val=”allow” where param=’access_policy’;

Test and you should be able to login now.

Source: mohammednv


Cannot access or ping a Virtuozzo VPS. Status in the Virtual Management console shows that the VPS is up and running.


After minutes of figuring out why the VE stopped responding, we finally pointed out the culprit. For some reason, the Windows Firewall Service is started automatically! One rule for a Windows VPS is that the firewall should not be running. I know it sounds too risky for the servers not to have a firewall started. But we gotta follow the "VE rules".

Here's how we did it:

Since we cannot access the virtual machine, we used the VZMC to do the needed changes.

1. Login to VZMC.

2. Look for the VPS options. ( Virtual Private Server)

3. Right click the problematic server then hit Manage Virtual Server.

4. Scroll down until you see the Services option.

5. Look for the Windows Firewall service then disable it.

That's it. You know have a working VE again.