symfony 1.4 log rotation

Execute following command on your project root folder:

php symfony log:rotate frontend prod --period=1 --history=5

In above command,

period 1 means:

frontend_prod.log contains 1 day log data and very next day backup of same file will be saved under log/history folder and also empty it.

history 5 means:

Under log/history folder, backup of 5 days will be stored only.

Fix: FastCGI sent in stderr: "Primary script unknown"

One reason: 
Check configuration "user" and "group" in  php-fpm.conf 
Default they are set by "nobody".
If  you start PHP-FPM with another user before (such as: phpUser), then you stop and start again with root privileges.
--> Child process will be run with user "nobody" --> They cannot access some folder that "phpUser" created before.

Fix: Make sure you run PHP-FPM with a single user.

Create a yum repository using the server install DVD

One of the requirements is to have the DVD image mounted either by physical media or by ISO image.
In order to mount the DVD, insert the DVD into the server and it should auto-mount into the /media directory. 

In order to mount an ISO image we will need to run the following command as root, substituting the path name of your ISO image for the field "myISO.iso":
mkdir /media/myISO 
mount -o loop myISO.iso /media/myISO
In order to install and configure the http daemon we will first need to configure the machine that will host the repository for all other machines to use the DVD image locally. Create the file/etc/yum.repos.d/local.repo and input the following:
[local]
name=Local Repository
baseurl=file:///media/myISO/Server/
gpgcheck=0
enabled=0

Now we will install the Apache service daemon with the following command which will also temporarily enable the local repository for dependency resolution:

yum -y install httpd --enablerepo=local

PHP’s Zend Opcache Config & Web Viewer

PHP 5.5. has zend opcache support in core. Since APC is not updated from long time, we made a switch to new Zend Opcache. Below is our config and web-based stats viewer.

PHP’s Zend Opcache Config

In your php.ini or /etc/php5/fpm/conf.d/05-opcache.ini 
zend_extension=opcache.so
opcache.memory_consumption=512
opcache.max_accelerated_files=50000

;following can be commented for production server
opcache.revalidate_freq=0
opcache.consistency_checks=1

OCFS2 cluster – quick setup guide



OCFS2 is a POSIX-compliant shared-disk cluster file system for Linux capable of providing both high performance and high availability. Cluster-aware applications can make use of parallel I/O for higher performance. OCFS2 is mostly used to host Oracle Real application clusters (RAC) database on Linux clusters.

The below steps shows how to create ocfs2 filesystem on top a multipath’d SAN lun and mount it on Linux clusters.

1. Identify the nodes that will be part of your cluster.

2. Export/Zone the LUNs on the SAN end and check whether they are accessible on all the hosts of the cluster. (fdisk -l or multipath -ll)

3. If you need multipathing, configure multipath and the multipathing policy based on your requirement. For Linux multipath setup, refer Redhat’s multipath guide.

4. Create OCFS2 configuration file (/etc/ocfs2/cluster.conf) on all the cluster nodes.

How to Take Ownership of a File, Folder Using Command-line in Window 7 and Vista

Taking ownership of a file

Click Start, click All Programs, click Accessories, right-clickCommand Prompt, and then click Run as Administrator.
Type the following command and press ENTER:  TAKEOWN /F<filename>
(Replace the text <filename> with the full path of the actual file.)
If the operation was successful, you should see the following message:
“SUCCESS: The file (or folder): “filename” now owned by user “Computer Name\User name“.”
Then to assign the Administrators group Full Control Permissions for the file, you may use the ICACLS command.
Use this syntax:  ICACLS <filename> /grant administrators:F

Cài đặt thêm extension openssl vào PHP

Tải bản PHP tương ứng với bản đang chạy về server, giải nén
cd {php_dir (vừa giải nén)}/ext/openssl 
Chạy phpize (lưu ý phải chạy đúng với phiên bản php đang chạy trong trường hợp cài nhiều bản php trên server) Ví dụ:  sudo /u01/app/httpd2/php/bin/phpize
./configure –with-php-config=/u01/app/httpd2/php/bin/php-config
make
make install
Lưu ý: 
- Có thể file {php_dir (vừa giải nén)}/ext/openssl/config.m4  không tồn tại hoặc bị sai tên –> tìm file khác hoặc đổi lại tên là được.