Tuesday, October 23, 2012

PHP 5.3 on CentOS/RHEL 5.8 via Yum

I have compiled the latest PHP version, 5.3.18, and put it in the Webtatic repository for easy installation. It is compiled for CentOS 5 i386 and x86_64, and the source RPMS are provided in the repo, if anyone wants to compile it for another OS or architecture.
Update 2012-03-04 – Webtatic now has released PHP 5.4.0 for CentOS/RHEL 6
Update 2010-03-03 – I’ve added both apc 3.1.3p1 beta (php-pecl-apc in yum) and eAccelerator 0.9.6 (php-eaccelerator in yum) RPMs to the repository, they are compiled for (and work on) php 5.3.x
Update 2009-09-01 – Added a note about deprecated errors, and how to silence them. Also I have included a tip that might help those of you struggling to install.
Update 2009-07-03 – I updated the version to PHP 5.3, which was released a few days before. This includes many new features such as closures, namespaces, and packaged scripts in phar files, which I’ll blog about soon. Check out PHP changelog for more details.

I have also included the same php extensions I mentioned in my other article, php-mcrypt, php-mhash (in PHP 5.2), php-mssql and php-tidy
To install, first you must install the yum repository information:

rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm

Now you can install php by doing:
yum --enablerepo=webtatic install php

Or update an existing installation of php, which will also update all of the other php modules installed:
yum --enablerepo=webtatic update php


Package Provides
php mod_php
php-cli php-cgi, php-pcntl, php-readline
php-common php-api, php-bz2, php-calendar, php-ctype, php-curl, php-date, php-exif, php-fileinfo, php-ftp, php-gettext, php-gmp, php-hash, php-iconv, php-json, php-libxml, php-openssl, php-pcre, php-pecl-Fileinfo, php-pecl-phar, php-pecl-zip, php-reflection, php-session, php-shmop, php-simplexml, php-sockets, php-spl, php-tokenizer, php-zend-abi, php-zip, php-zlib
php-embedded php-embedded-devel
php-mssql php-pdo_dblib
php-mysql php-mysqli, php-pdo_mysql, php_database
php-odbc php-pdo_odbc, php_database
php-pgsql php-pdo_pgsql, php_database
php-process php-posix, php-sysvmsg, php-sysvsem, php-sysvshm
php-xml php-dom, php-domxml, php-wddx, php-xsl

“Depsolving” problems

If you get depsolving problems when updating, you may have currently installed some extensions that have been removed, e.g. php-mhash, php-ncurses.
You will need to remove them before upgrading.

yum remove php-mhash php-ncurses

Timezone Errors

If you have not set the default timezone for dates, you will get PHP warnings and in some cases fatal errors (e.g. when using the DateTime object). PHP will by default use the system’s timezone if not a fatal error, however either in your application or the php.ini, you should set the setting date.timezone. It’s more ideally set in the application, which should be aware of it’s own timezone setting.

Deprecated Errors

Once you are running the new version, you may get “deprecated” errors in your error logs. This isn’t bad, it just means to tell you that some of the functions you are using are no longer prefered, and may be removed in a future major release. An example of this is the ereg functions. Preg functions are prefered over these, as they are much faster and more powerful, and in all cases do at least the same thing.
If upgrading the functions are not an option, and you would like to hide the deprecated errors from your error log, for example on a production server, just edit your /etc/php.ini file, find the line:
error_reporting  =  E_ALL

and replace to:
error_reporting  =  E_ALL & ~E_DEPRECATED

PHP 5.2.17

I have previously been maintaining PHP 5.2.* releases, but since it is now end-of-line, there are no security fixes for known critical security issues. I wouldn’t recommend using these anymore because of this, however they are still in the repository for existing users relying on them.

Thursday, October 4, 2012

Remote shutdown and reboot computer window

1. Login kết nối với computer trước
2. mở command line dùng lệnh

shutdown /m \\ /r /f

Logofff windows từ xa

C:\Users\Desktop\PSTools>qwinsta /server:
 SESSIONNAME       USERNAME                 ID  STATE   TYPE        DEVICE
 console                                     0  Conn    wdcon
 rdp-tcp                                 65536  Listen  rdpwd
 rdp-tcp#3         tt4_trafic                1  Active  rdpwd
 rdp-tcp#4         Administrator             2  Active  rdpwd

C:\Users\Desktop\PSTools>logoff 2 /server:

C:\Users\Desktop\PSTools>qwinsta /server:
 SESSIONNAME       USERNAME                 ID  STATE   TYPE        DEVICE
 console                                     0  Conn    wdcon
 rdp-tcp                                 65536  Listen  rdpwd
 rdp-tcp#3         tt4_trafic                1  Active  rdpwd

Hướng dẫn dùng service PsExec thực hiện command line từ xa 

C:\Users\Desktop\PSTools>PsExec.exe \\ -u domain\username -p
password1 cmd

PsExec v2.11 - Execute processes remotely
Copyright (C) 2001-2014 Mark Russinovich
Sysinternals - www.sysinternals.com

Microsoft Windows [Version 5.2.3790]
(C) Copyright 1985-2003 Microsoft Corp.

cmd exited on with error code 0.

C:\Users\Desktop\PSTools>PsExec.exe \\ -u domain\username -p
ipconfig /all

Ethernet adapter Network Bridge:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : MAC Bridge Miniport
   Physical Address. . . . . . . . . : 02-18-8B-E5-DA-5A
   DHCP Enabled. . . . . . . . . . . : No
   IP Address. . . . . . . . . . . . :
   Subnet Mask . . . . . . . . . . . :
   Default Gateway . . . . . . . . . :
   DNS Servers . . . . . . . . . . . :
ipconfig exited on with error code 0.

Add swap solaris 10 using ZFS

When pca wanted to install 144500-19, patchadd aborted with:
Running patchadd
Validating patches...
Loading patches installed on the system...
Loading patches requested to install.
Checking patches that you specified for installation.

Unable to install patch. Not enough space in /var/run to copy overlay objects.
 401MB needed, 220MB available.

Failed (exit code 1)
Well, this Sun Enterprise 250 only has 768 MB memory, not too much in these days. Let's add some virtual memory then: 
# mkfile 1g /var/tmp/swap.tmp
# swap -a /var/tmp/swap.tmp
/var/tmp/swap.tmp: Invalid operation for this filesystem type
Oh, right - we're on ZFS already. Let's try again:
# rm /var/tmp/swap.tmp
# zfs create -V 1gb rpool/tmpswap
# swap -a /dev/zvol/dsk/rpool/tmpswap 
# df -h /var/run 
Filesystem             size   used  avail capacity  Mounted on
swap                   1.4G   107M   1.3G     8%    /var/run
Now we should be good to go :-)

Oh, and regarding those "overlay objects in /var/run" mentioned above: once patchadd(1M) is running, take a look:
# df -h | grep -c /var/run