Notice: session_start() [function.session-start]: ps_files_cleanup_dir: opendir(/var/lib/php5) failed: Permission denied

by on July 18, 2013
in Php Error

Notice: session_start() [function.session-start]: ps_files_cleanup_dir: opendir(/var/lib/php5) failed: Permission denied

This mean PHP trying to purge session data files from the file system (/var/lib/php5) without having the access to find what files to delete.

Fixing the problem:
Change the group owner of the directory to www-data (or apache) and give the group read access with chmod g+r.
Then set session.gc_probability = 0 in your php.ini.

The garbage collection is set up to be done by cron jobs on some systems (i.e. Debian/Ubuntu). Some php.ini executables like php-cli also try to do garbage collection and that results in the error you got.
Read more…

How to fix PHP compile errors

by on April 17, 2013
in Apache, Php, Servers

Some library errors when compile Php 5 on CentOS

checking for BZip2 support… yes
checking for BZip2 in default path… not found
configure: error: Please reinstall the BZip2 distribution

yum install bzip2-devel

checking for cURL support… yes
checking if we should use cURL for url streams… no
checking for cURL in default path… not found
configure: error: Please reinstall the libcurl distribution -
easy.h should be in /include/curl/

yum install curl-devel

Read more…

Check Linux HDD using smartmontools

by on December 13, 2012
in Servers

The step by step command example below show the process of using SMART disk monitoring tool that provide us with the information of overall hard disk health status.

To install smartmontools:

yum install smartmontools

Enabling SMART Monitoring Tools on HDD (turn on SMART):
Read more…

Network Stats with Iptables

by on November 25, 2012
in Servers

Most of the time we use iptables to set up a firewall on a machine, but iptables is also able to do network statistics reporting. the -v (–verbose) option makes the list command (-L) show the packet and byte counters. Network stats are available on a per rule basis. Here’s an example on the INPUT chain:

[root@server]# /sbin/iptables -n -v -L INPUT
Chain INPUT (policy DROP 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
2589 3295K ACCEPT all -- * * state RELATED,ESTABLISHED
62 3720 ACCEPT all -- lo *
57 2896 ACCEPT tcp -- * * tcp dpt:8443
46 2460 ACCEPT tcp -- * * tcp dpt:80
0 0 ACCEPT tcp -- * * tcp dpt:21
0 0 ACCEPT tcp -- * * tcp dpt:22
0 0 ACCEPT tcp -- * * tcp dpt:587
0 0 ACCEPT tcp -- * * tcp dpt:25
0 0 ACCEPT tcp -- * * tcp dpt:465
0 0 ACCEPT tcp -- * * tcp dpt:106
26 1835 ACCEPT udp -- * * udp dpt:53
0 0 ACCEPT icmp -- * * icmp type 8 code 0

Read more…

How to detect a DDoS attack? Find out with netstat!

by on November 24, 2012
in Security, Servers

Your server running very slow could be many things from wrong configs, scripts and fail hardware – but sometimes it could be because someone is flooding your server with traffic known as DoS ( Denial of Service ) or DDoS ( Distributed Denial of Service ) it could also be that your server itself is part of a botnet and is being used to attack other networks, in this case its always a good idea to run scans with software such as ClamAV and RootKit Hunter as a precaution or even higher a professional to check it out for you if your not confident enough to do it on your own.

Furthermore whenever a client connects to a server via network, a connection is established and opened on the system. On a busy high load server, the number of connections connected to the server can be run into large amount till hundreds if not thousands. Find out and get a list of connections on the server by each node, client or IP address is useful for system scaling planning, and in most cases, detect and determine whether a web server is under DoS or DDoS attack

Take a look at these handy netstat commands below that will surely help you determine wether your under attack or are part of an attack.

Display all active Internet connections to the server and only established connections are included.

netstat -na

Show active Internet connections to the server on port 80 and sort the results. Useful in detecting a single flood by allowing you to recognize many connections coming from one IP.

netstat -an | grep :80 | sort
Read more…

Installing iftop on CentOS to monitor network traffic

by on November 24, 2012
in Security, Servers

To install iftop on the CENTOS Server login to the server and use the following commands:

Be sure you have the latest version by looking at

wget # for CentOs 32bit
# for CentOs 64bit
rpm -if iftop-0.17-1.el6.rf.i686.rpm


The default iftop command displays the bandwidth usage of the first ethernet device.
Read more…

MySQL Import Command

by on January 10, 2012
in Mysql

How do I import data stored in a “.sql” file (created by mysqldump command) under UNIX or Linux operating systems?

The syntax is as follows to import the data created by mysqldump command:

mysql -u{DB-USER-NAME} -p{DB-PASSWORD} {DB-NAME} < {db.file.sql}
mysql -h{MySQL-SERVER-HOST-NAME} -u{DB-USER-NAME} -p{DB-PASSWORD} {DB-NAME} < {db.file.sql}

In this example import a file called sales.sql for salesdb1 user and sales db, enter:
$ mysql -u123tweak -p123password 123tweak < 123tweak.sql
Read more…

CentOS / Red Hat IPv6 Network Configuration

by on April 22, 2011
in Linux, Servers

Setting up IPv6 on CentOS, and for that matter RHEL and Fedora Linux, is quite straight forward. You need to edit just two files:

1. /etc/sysconfig/network-scripts/ifcfg-
2. /etc/sysconfig/network

  1. Configure the IP address. For example, for interface eth0, edit /etc/sysconfig/network-scripts/ifcfg-eth0 and make the necessary changes as below.DEVICE=eth0
    IPV6ADDR=<ipv6 address>
  2. Read more…

Reset MySQL root Password

by on April 22, 2011
in Mysql

To reset MySQL root user’s password, follow the following steps.

  1. Terminate all running instances of MySQL server. You can do that either via the RC script (/etc/init.d/<script_name> stop or /user/local/etc/rc.d/<script_name> stop for FreeBSD) or using the tools like kill and pkill. To use kill or pkill, you will have to use ps or pgrep to find out the process names or process ID (PID).

    Using the RC script to do a proper shutdown is safer than using kill or pkill.

  2. Start the MySQL server in safe modemysqld_safe --skip-grant-tables --user=mysql
  3. On another terminal, login to the MySQL server as the root usermysql -u root
    Read more…

Turn on MySQL query cache to speed up query performance?

by on April 20, 2011
in Mysql

Many times developers looking for ways to speed up query, in mysql we can enable query cache to speed up query performance. Whenever query cache is enable, it will cache the query in memory and boost query performance.

As we know, speed is always the most important element in developing a website especially for those high traffic database driven website. You can try to turn on query cache to speed up query.

To speed up query, enable the MySQL query cache, before that you need to set few variables in mysql configuration file (usually is /etc/my.cnf or my.ini)

- 1st, set query_cache_type to 1. (There are 3 possible settings: 0 (disable / off), 1 (enable / on) and 2 (on demand).

query-cache-type = 1
Read more…

Next Page »