Friday 30 March 2012

How to install php-5.2.17 on CentOS-6.2 and configure Zend optimizer-3.3

To install php-5.2.17 on CentOS-6.2 and configure Zend optimizer.
Follow the procedure carefully.
ssh user@sever
password:


Cd /usr/src
wget http://
php-5.2.17-1.el6.art.x86_64.rpm
php-bcmath-5.2.17-1.el6.art.x86_64.rpm
php-cli-5.2.17-1.el6.art.x86_64.rpm
php-common-5.2.17-1.el6.art.x86_64.rpm
php-dba-5.2.17-1.el6.art.x86_64.rpm
php-devel-5.2.17-1.el6.art.x86_64.rpm
php-embedded-5.2.17-1.el6.art.x86_64.rpm
php-gd-5.2.17-1.el6.art.x86_64.rpm
php-imap-5.2.17-1.el6.art.x86_64.rpm
php-ldap-5.2.17-1.el6.art.x86_64.rpm
php-mbstring-5.2.17-1.el6.art.x86_64.rpm
php-mcrypt-5.2.17-1.el6.art.x86_64.rpm
php-mhash-5.2.17-1.el6.art.x86_64.rpm
php-mssql-5.2.17-1.el6.art.x86_64.rpm
php-mysql-5.2.17-1.el6.art.x86_64.rpm
php-pdo-5.2.17-1.el6.art.x86_64.rpm
php-soap-5.2.17-1.el6.art.x86_64.rpm

................................................
rpm -ivh --nodeps php-5.2.17-1.el6.art.x86_64.rpm
php-bcmath-5.2.17-1.el6.art.x86_64.rpm
php-cli-5.2.17-1.el6.art.x86_64.rpm
php-common-5.2.17-1.el6.art.x86_64.rpm
php-dba-5.2.17-1.el6.art.x86_64.rpm
php-devel-5.2.17-1.el6.art.x86_64.rpm
php-embedded-5.2.17-1.el6.art.x86_64.rpm
php-gd-5.2.17-1.el6.art.x86_64.rpm
php-imap-5.2.17-1.el6.art.x86_64.rpm
php-ldap-5.2.17-1.el6.art.x86_64.rpm
php-mbstring-5.2.17-1.el6.art.x86_64.rpm
php-mcrypt-5.2.17-1.el6.art.x86_64.rpm
php-mhash-5.2.17-1.el6.art.x86_64.rpm
php-mssql-5.2.17-1.el6.art.x86_64.rpm
php-mysql-5.2.17-1.el6.art.x86_64.rpm
php-pdo-5.2.17-1.el6.art.x86_64.rpm
php-soap-5.2.17-1.el6.art.x86_64.rpm
....................................................
/etc/init.d/httpd restart
stoping httpd ok
starting httpd ok

....................................................
cat /etc/yum.conf|grep php
exclude=php*
....................................................

Zendoptimizer
....................................................
wget http://www.zend.com/products/guard/downloads
zindoptimizer 3.3(php-2.5.x linux)
tar -zxvf zedoptimizer-3.3-tar.gz
1. Extract the Zend Optimizer package.

2. Locate the ZendOptimizer.so (Unix) or ZendOptimizer.dll (Windows) file in the directory which
corresponds to your version of PHP (4.3.x, 4.4.x, 5.0.x, 5.1.x, 5.2.x).

2. Add the following line to your php.ini file:
Linux and Mac OS X: zend_extension=
Windows: zend_extension_ts=
Windows non-thread safe: zend_extension=
(*) The Windows non-thread safe binary is only used with Zend Core 2.0.

3. Restart your Web server.

vim /etc/php.ini
zend_extension=

4.php -v

reboot the server.

enjoy

Wednesday 14 March 2012

Recover MySQL root Password

Recover MySQL root Password


You can recover MySQL database server password with following five easy steps.


Step # 1: Stop the MySQL server process.

Step # 2: Start the MySQL (mysqld) server/daemon process with the --skip-grant-tables option so that it will not prompt for password.

Step # 3: Connect to mysql server as the root user.

Step # 4: Setup new mysql root account password i.e. reset mysql password.

Step # 5: Exit and restart the MySQL server.

Here are commands you need to type for each step (login as the root user):

Step # 1 : Stop mysql service

# /etc/init.d/mysql stop

Output:

Stopping MySQL database server: mysqld.
Step # 2: Start to MySQL server w/o password:

# mysqld_safe --skip-grant-tables &

Output:

[1] 5988
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[6025]: started
Step # 3: Connect to mysql server using mysql client:

# mysql -u root

Output:

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
Step # 4: Setup new MySQL root user password

mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit

Step # 5: Stop MySQL Server:

# /etc/init.d/mysql stop

Output:

Stopping MySQL database server: mysqld
STOPPING server from pid file /var/run/mysqld/mysqld.pid
mysqld_safe[6186]: ended
[1]+ Done mysqld_safe --skip-grant-tables
Step # 6: Start MySQL server and test it

# /etc/init.d/mysql start
# mysql -u root -p

Wednesday 7 March 2012

Apache: Could not bind address to port (make_sock)

Apache: Could not bind address to port (make_sock)
If you’re upgrading server software, or changing your port config, you may accidentally Funk your Wagnalls. You’ll know the error when you try to restart apache.

1:ps -e | grep httpd
21415 ? 00:00:00 httpd
21417 ? 00:00:00 httpd
21418 ? 00:00:00 httpd
21419 ? 00:00:00 httpd
21420 ? 00:00:00 httpd
21421 ? 00:00:00 httpd
21422 ? 00:00:00 httpd
21423 ? 00:00:00 httpd
21424 ? 00:00:00 httpd
21425 ? 00:00:00 httpd


[root@it ~]# kill 21415
[root@it ~]# kill 21415
-bash: kill: (21415) - No such process
[root@it ~]# ps -e | grep httpd
[root@it ~]# service httpd restart
Stopping httpd: [FAILED]
Starting httpd: [ OK ]



2:- ~: sudo /etc/init.d/apache2 start
* Starting web server apache2
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:8080
no listening sockets available, shutting down
Unable to open logs
...fail!

Apache is attempting to listen on port 8080, but cannot because it’s already in use. There are a few reasons why this might be happening.

Port configuration problem
If you have have duplicate Listen entries, Apache will yell at you. Make sure that your apache.conf & ports.conf don’t both include this directive. If it’s only being listed once (see the example ports.conf below), then make sure you didn’t accidentally duplicate your ports.conf somewhere apache would notice.

Listen 8080

#
# Listen 443
#

Another service could be using the port
When I ran into this error, it was because another instance of apache was already running. This next example uses netstat, grep, and kill to root out & fix the problem.

# try to start apache, receive error

~: sudo /etc/init.d/apache2 start
* Starting web server apache2
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:8080
no listening sockets available, shutting down
Unable to open logs
...fail!

# see what's using the port (note that I'm searching for :80, I could also use :8080)

~: sudo netstat -tulpn| grep :80

tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 29004/apache2
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 28964/nginx

# I see that apache2 is using 8080! Kill it!

~: killall -9 apache2

# Let's try again, with success

~: sudo /etc/init.d/apache2 start
* Starting web server apache2
...done.

Remember to dig in and evaluate server problems instead of just rebooting. I rebooted four times before I decided that I must have screwed something up.