Tuesday, November 15, 2016

How to fix “fatal error: openssl/aes.h: No such file or directory”

Question: I am trying to compile a program on Linux, but the compilation fails with an error saying: "fatal error: openssl/aes.h: No such file or directory". How can I install the requested header file and solve this problem on [insert your Linux distro]?
fatal error: openssl/aes.h: No such file or directory
If you encounter this error during compilation, this is because of the following: The program you are trying to build is using OpenSSL, but necessary development files (libraries and header files) required to link with OpenSSL are missing on your Linux platform.
To fix this problem, you have to install OpenSSL development package, which is available in standard repositories of all modern Linux distributions.
To install OpenSSL development package on Debian, Ubuntu or their derivatives:
$ sudo apt-get install libssl-dev
To install OpenSSL development package on Fedora, CentOS or RHEL:
$ sudo yum install openssl-devel
After installing the package, try recompiling the program.

source: http://ask.xmodulo.com/fix-fatal-error-openssl.html 

Redhat / CentOS / Fedora Linux Install XCache for PHP 5

How do I install Xcache opcode cacher for PHP 5 under RHEL / CentOS version 5.0 server?

XCache is a open-source opcode cacher, which means that it accelerates the performance of PHP on servers. It optimizes performance by removing the compilation time of PHP scripts by caching the compiled state of PHP scripts into the shm (RAM) and uses the compiled version straight from the RAM. This will increase the rate of page generation time by up to 5 times as it also optimizes many other aspects of php scripts and reduce serverload.

Step # 1: Download xcahce source code

Use wget command to download latest stable release:
# cd /opt
# wget http://xcache.lighttpd.net/pub/Releases/1.2.1/xcache-1.2.1.tar.gz

Step # 2: Untar tar ball

Use tar command:
# tar -zxvf xcache-1.2.1.tar.gz
# cd xcache-1.2.1

Step # 2: Compile and install xcahce

Use phpize command to prepare xcache as a PHP extension for compiling:
# phpize
Configure, compile and install xcache:
# ./configure --enable-xcache
# make
# make install

Default xcache.so installation location

  • 64 bit PHP module installed at /usr/lib64/php/modules/xcache.so
  • 32 bit PHP module installed at /usr/lib/php/modules/xcache.so

Step # 3: Create xcache.ini file

Under RHEL / CentOS, you place php modules configuration at /etc/php.d/ directory:
# cd /etc/php.d/
Create xcache.ini file:
# vi xcache.ini
Append configuration directives:
[xcache-common]
; change me - 64 bit php => /usr/lib64/php/modules/xcache.so
; 32 bit php => /usr/lib/php/modules/xcache.so 
zend_extension = /usr/lib64/php/modules/xcache.so

[xcache.admin]
xcache.admin.auth = On
xcache.admin.user = "mOo"
; xcache.admin.pass = md5($your_password)
xcache.admin.pass = ""

[xcache]
xcache.shm_scheme =        "mmap"
xcache.size  =               32M
xcache.count =                 1
xcache.slots =                8K
xcache.ttl   =              3600
xcache.gc_interval =         300

; Same as aboves but for variable cache
; If you don't know for sure that you need this, you probably don't
xcache.var_size  =            0M
xcache.var_count =             1
xcache.var_slots =            8K
xcache.var_ttl   =             0
xcache.var_maxttl   =          0
xcache.var_gc_interval =     300

; N/A for /dev/zero
xcache.readonly_protection = Off

xcache.mmap_path =    "/dev/zero"

xcache.cacher =               On
xcache.stat   =               On
Save and close the file.
Alternatively, you can also copy default xcache.ini to /etc/php.d/
# cp xcache.ini /etc/php.d/
# vi /etc/php.d/xcache.ini
Restart your Apache web server:
# service httpd restart
If you are using Lighttpd web server, enter:
# service lighttpd restart

Step # 4: Make sure xcache is working

Type the following command for verification:
$ php -v
Output:
PHP 5.1.6 (cli) (built: Nov 20 2007 11:11:52) 
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
    with XCache v1.2.1, Copyright (c) 2005-2007, by mOo
You should see line “XCache v1.2.1, Copyright (c) 2005-2007, by mOo

Friday, October 7, 2016

"Network error: Software caused connection abort"



I had the same issue, which was caused by incorrectly generated SSH keys (during first boot). Check this by opening a terminal and going into the /etc/ssh directory. You will see a bunch of files, 6 of them looking like 'ssh_host_###_key'. If these are 0 bytes in size, you are affected by this as well. Follow these steps to fix the issue:

First, remove the old keys:
Code:
rm /etc/ssh/ssh_host_*_key*

Now generate new ones. The command will ask you to set a passphrase or press enter to continue. Do not set a passphrase!
Code:
ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
Code:
ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
Code:
ssh-keygen -t ecdsa -f /etc/ssh_host_ecdsa_key

Restart your SSH service (or reboot). You can now log in again.

Code:
service ssh restart
FIND

Monday, January 11, 2016

How to determine total number of open/active connections in ms sql server 2005

This shows the number of connections per each DB:
SELECT 
    DB_NAME(dbid) as DBName, 
    COUNT(dbid) as NumberOfConnections,
    loginame as LoginName
FROM
    sys.sysprocesses
WHERE 
    dbid > 0
GROUP BY 
    dbid, loginame
And this gives the total:
SELECT 
    COUNT(dbid) as TotalConnections
FROM
    sys.sysprocesses
WHERE 
    dbid > 0
If you need more detail, run:
sp_who2 'Active'
Note: The SQL Server account used needs the 'sysadmin' role (otherwise it will just show a single row and a count of 1 as the result)

Source from: http://stackoverflow.com/questions/216007/how-to-determine-total-number-of-open-active-connections-in-ms-sql-server-2005