h1

Installing PECL shared extensions

July 30, 2009

[root@server ]# ls -l `which curl` `which curl-config`
lrwxrwxrwx 1 root root 21 Mar 7 10:59 /usr/bin/curl -> /opt/curlssl/bin/curl
lrwxrwxrwx 1 root root 28 Mar 7 10:55 /usr/bin/curl-config -> /opt/curlssl/bin/curl-config

[root@server ]# cd /root/ ; wget http://pecl.php.net/get/pecl_http-1.6.3.tgz
[root@server ]# tar -zxvf pecl_http-1.6.3.tgz
[root@server ]# cd pecl_http-1.6.3
[root@server ]# phpize
[root@server ]# ./configure –with-http-curl-requests=/opt/curlssl
[root@server ]# make
[root@server ]# make test
[root@server ]# make install
[root@server ]# php -i | grep “Configuration File”
Configuration File (php.ini) Path => /usr/local/lib
Loaded Configuration File => /usr/local/lib/php.ini

[root@server ]# vi /usr/local/lib/php.ini , and add

extension=http.so ( below extension_dir line in php.ini , make sure extension_dir alredy points to the folder having http.so lib )

** curl / curl-config may depend on your system setup. you can also use –prefix=/usr/local/pecl_http or anything you want)

h1

There could also be a problem with the server’s session.save_path

June 9, 2009


New joomla install would show following:

An error has occurred.:Cookies do not appear to be enabled on your browser client. You will not be able to install the application with this feature disabled. Alternatively, there could also be a problem with the server’s session.save_path. If this is the case, please consult your hosting provider if you don’t know how to check or fix this yourself.

and

existing admin login to  joomla installations were not authenticating.

Soln=====>

Compare the following in php.ini

Working configuration
#############################

[root@server  root]# grep session. /usr/local/lib/php.ini
session.save_handler = files
; variable in order to use PHP’s session functions.
;     session.save_path = “N;/path”
; where N is an integer.  Instead of storing all the session files in
; store the session data in those directories.  This is useful if you
; a more efficient layout for servers that handle lots of sessions.
;         You can use the script in the ext/session dir for that purpose.
;         use subdirectories for session storage
;session.save_path = /tmp
session.use_cookies = 1
; attacks which involve passing session ids in URLs; defaults to 0.
; session.use_only_cookies = 1
; Name of the session (used as cookie name).
session.name = PHPSESSID
; Initialize session on request startup.
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
; on every session initialization.
session.gc_probability = 1
session.gc_divisor     = 100
session.gc_maxlifetime = 1440
; NOTE: If you are using the subdirectory option for storing session files
;       (see session.save_path above), then garbage collection does *not*
;       setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes):
;          cd /path/to/sessions; find -cmin +24 | xargs rm
; to initialize a session variable in the global scope, albeit register_globals
session.bug_compat_42 = 1
session.bug_compat_warn = 1
; HTTP_REFERER has to contain this substring for the session to be
session.referer_check =
session.entropy_length = 0
; Specified here to create the session id.
session.entropy_file =
;session.entropy_length = 16
;session.entropy_file = /dev/urandom
session.cache_limiter = nocache
session.cache_expire = 180
; – User may send URL contains active session ID
; – URL that contains active session ID may be stored
; – User may access your site with the same session ID
session.use_trans_sid = 0
[root@server root]#

Things to check for
##########################

1) check that the above are set and check that:

2) /tmp has permissions 1777

3) /dev/urandom exists, if not create it with following commands:
mknod -m 644 /dev/urandom c 1 9
chown root:root /dev/random /dev/urandom

4) uncomment
;session.save_path = /tmp
in php.ini , if the sessions folder is not /tmp ( by default for cpanel server installation it is /tmp , however if php/apache is installed on a plain server, the sessions folder is usually /var/lib/php/sessions or something)

h1

Install Latest postgresql using yum from pgsqlrpms

September 29, 2008

##################################################

[root@server ~]# yum erase postgresql postgresql-server
[root@server ~]# wget http://yum.pgsqlrpms.org/reporpms/8.3/pgdg-centos-8.3-4.noarch.rpm
[root@server ~]# rpm -ivh pgdg-centos-8.3-4.noarch.rpm
[root@server ~]# yum install postgresql postgresql-server
[root@server ~]# chkconfig postgresql on
[root@server ~]# service postgresql initdb
[root@server ~]# chkconfig postgresql on && service postgresql start

[root@server ~]# /usr/bin/postgres –version
postgres (PostgreSQL) 8.3.4
[root@server ~]#

Set port and the interface to bind to

#########################################

vi /var/lib/pgsql/data/postgresql.conf

# – Connection Settings –

listen_addresses = ‘*’
port = 5432

h1

Manually delete records for any domain from plesk psa database

September 27, 2008

Manually delete records for any domain from psa database ( this is plesk windows with psa in mysql database, but should work on msaccess db too )

cd %plesk_dir%\mysql\bin && mysql.exe -u admin -P8306 psa -p

PASSWORD

use psa \G

delete from db_users where db_id=(SELECT id FROM data_bases where dom_id=(SELECT id FROM domains where name=’example.com’));
delete from data_bases where dom_id=(SELECT id FROM domains where name=’example.com’);
delete from mail where id=(SELECT id FROM domains where name=’example.com’);
delete from subdomains where id=(SELECT id FROM domains where name=’example.com’);
delete from dns_recs where id=(SELECT id FROM domains where name=’example.com’);
delete from domains where id=(SELECT id FROM domains where name=’example.com’);
delete from hosting where dom_id=(SELECT id FROM sys_users where home=’C:/inetpub/vhosts//example.com’);
delete from FROM sys_users where home=’C:/inetpub/vhosts//example.com’;
delete from dns_zone where displayName=’example.com’;

exit;

iisweb /delete “example.com”
echo y | del “C:\Inetpub/vhosts\example.com”
echo y | del “C:\Program Files\SWsoft\Plesk\Mail Servers\Mail Enable\Postoffices\example.com”
echo y | del “C:\Program Files\SWsoft\Plesk\Mail Servers\Mail Enable\config\Postoffices\example.com”

“C:\Program Files\SWsoft\Plesk\admin\bin\domain.exe” -r example.com
“C:\Program Files\SWsoft\Plesk\admin\bin\DNSMng.exe” restart

Besides you might need to delete post office manually from mailenable.msc -> postoffices and a few other things in GUI

h1

NMAP

September 23, 2008

echo ” ========== Installing NMAP network Scanner ================= ”
echo “…………………………………………………………………………………………………………………..”
echo “…………………………………………………………………………………………………………………..”

echo “Cleaning old nmap installation, if any ”

yum -y remove nmap
echo “…………………………………………………………………………………………………………………..”
echo “Install beings ”
yum -y install nmap

if [ -f /usr/bin/nmap ]
then

echo ” Nmap successfully installed”
sleep 2
echo ” Testing Nmap ”
echo ” ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++”
sleep 3
/usr/bin/nmap localhost -v
sleep 5
else
echo ” Nmap faield to install”
fi

echo ” =========== Install NMAP network Scanner process completed  ===============”
echo “…………………………………………………………………………………………………………………..”
echo “…………………………………………………………………………………………………………………..”
echo “…………………………………………………………………………………………………………………..”

h1

MySQL ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)

August 25, 2008

The other day I got this error on one of our servers. Fantastico module in cpanel was showing the error: Unable to connect to mysql database.  While mysql service was running fine, the root user was unable to login to mysql database. I initially tried to reset the mysql root password like https://rhcelinuxguide.wordpress.com/2008/08/08/reset-mysql-root-password/   but that did not help.  The real issue was permission on the folder /var/lib/mysql/mysql .  It is supposed to be 711 , while it was  751.  That fixed it.

==================================================================

root@server1 [~]# mysql
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
root@server1 [~]#

root@server1 [/var/lib/mysql/mysql]# ls -lhd /var/lib/mysql
drwxr-x–x 179 mysql mysql 12K Aug 25 01:44 /var/lib/mysql/

root@server1 [/var/lib/mysql/mysql]# chmod  711 /var/lib/mysql/mysql

root@server1 [/var/lib/mysql/mysql]# ls -lhd /var/lib/mysql/mysql
drwx–x–x 2 mysql mysql 4.0K Aug 25 01:32 /var/lib/mysql/mysql/

root@server1 [/var/lib/mysql/mysql]# service mysql restart
Shutting down MySQL..

[  OK  ]
Starting MySQL                                             [  OK  ]
root@server1 [/var/lib/mysql/mysql]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.51a-community MySQL Community Edition (GPL)Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer. 

mysql> quit
Bye
root@server1 [/var/lib/mysql/mysql]#

==================================================================
Worked for me !
If above steps does not work, you can try this:
root@server1 [~]# /etc/init.d/mysqld stop
root@server1 [~]# safe_mysqld –skip-grant-tables &
root@server1 [~]# mysql
root@server1 [~]# USE mysql
mysql>  UPDATE user SET password=password(“new root passwd”) WHERE user=”root”;
mysql> flush privileges;
mysql> exit 

root@server1 [~]# killall mysqld mysql

root@server1 [~]# /etc/init.d/mysqld start

You can check the root mysql password in /root/.my.cnf  ( assuming you have set it up)

Sample /root/.my.cnf
#######################

root@server1 [~]# cat /root/.my.cnf
[client]
user=”root”
pass=”V1<)4K5.8″
root@server1 [~]#

h1

htaccess 302 ( temporary ) and 301 ( primary) redirects

August 22, 2008

There are permanent are temporary redirect methods that can be applied to .htaccess.

A permanent redirect will notify the visitor’s browser to update any bookmarks that are linked to the page that is being redirected. Temporary redirects will not update the visitor’s bookmarks.

Temporary Redirect ( 302 redirect )
########################################
RewriteEngine on

RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule ^/?$ “http\:\/\/www\.domain\.com” [R=302,L]

###

Permanent Redirect ( 302 redirect )

##########################################

RewriteEngine on

RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule ^/?$ “http\:\/\/www\.domain\.com” [R=301,L]

###

The above example will redirect domain.com to http://www.domain.com in browser.

.