Enable Zend OPcache in PHP

To enable Zend OPCache in PHP, edit php.ini add following to end of the file

Now you may need to adjust some settings, in php.ini uncomment following, change values as needed.

Verify it with

Restart web server. If you using php-fpm or fcgi, you need to restart the process.

phpinfo() will show

Zend OPcache in phpinfo

Install PHP 7.1 php-fpm from source

Lets install the requirements.

On CentOS, run

Before you can install, you need to check MySQL socket location. To do this, run following command in MySQL command prompt.

Find MySQL socket

Download and install PHP 7.1 from source

Copy the configuration files

Now you will be able to start php-fpm by running

By default php-fpm will run using tcp port 9000, it is better to change it to use unix socket, for this

Find

Replace with

php-fpm user

You need to configure the user account used to run php-fpm, if you don’t use proper account, you may get permission errors.

The account you use vary depending on OS, Web server. For example, nginx use account nginx. Apache on Ubuntu/Debian use www-data. Apache on CentOS use nobody.

Here is what i have on a server running Nginx web server

Systemd Service

To easily manage php-fpm, lets create a php-fpm.service file.

Before we do this, edit

Find

Add below

Find

Add below

Save and exit.

Now lets create file /usr/lib/systemd/system/php-fpm.service

Add following content

Enable php-fpm with

Now you will be able to use systemctl to start/stop/restart php-fpm

systemctl status php-fpm

Install Redis PHP Module from source

To install Redis PHP module from source, run

Once installed, edit your php.ini file, add following below extension_dir line

Verify redis is installed with php -m

Now restart web server

phpinfo() will show following

phpinfo redis

CentOS 7 Cannot find autoconf

When install redis php module, i get error

Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

This is fixed by installing autoconf package with yum.

Once autoconf installed, phpize command worked properly.

Manage XenServer from command line with xe

xe command is used to manage XenServer from command line

To list VM, run

Installing Redis PHP module CentOS 7

Lets search for available redis packages

In this server, we have PHP 7.0 installed. So we need to install packages for PHP 7.0

Here are the two packages for PHP 7.0

Install it with yum

Now you need to restart web server, generally restarting apache will do. In this cause PHP is running as php-fpm under nginx, so we need to restart php-fpm with

vShare Nginx Config

Here is Nginx Configuration for vShare youtube clone script

https://gist.github.com/serverok/1b300ff880db6aca59de0e42d86dadcb

https://www.vshare.in

Installing Redis On CentOS 7

To install Redis on CentOS, run

yum install redis

Start redis with

Set redis to start on boot

Verify redis is running with