Category Archives: PHP

PHP 5.6 on CentOS 7

This is how I managed to have PHP 5.6 on a fresh CentOS 7.

yum install epel-release
rpm -Uvh
yum clean
yum update


yum install php56w php56w-opcache php56w-mcrypt php56w-pdo php56w-mysql php56w-mbstring php56w-gd php56w-dom



yum install ImageMagick php56w-imagick


Restart httpd

service httpd restart

PHP – It is not safe to rely on the system’s timezone settings.

Edit php.ini, mine, on CentOS 7 is located at /etc/php.ini.
Lets add the following line.

date.timezone = America/New_York

For other timezone take a look at

and then restart httpd

service httpd restart

If you don’t have access to the php.ini, here is another way to do it.
On our app/php…


as seen on


Warning: Unknown: open(/var/lib/php/session/ O_RDWR) failed: Permission denied (13)

I was getting the following error on a *fresh* CentOS…

Warning: Unknown: open(/var/lib/php/session/sess_isu2r2bqudeosqvpoo8a67oj02, O_RDWR) failed: Permission denied (13) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in Unknown on line 0

This will do the work…

chown -R nginx:nobody /var/lib/php/session && chmod -R 770 /var/lib/php/session

php-fpm – upstream: “fastcgi://”


2016/11/22 10:01:01 [error] 18314#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client:XX.XX.X.XXX, server:, request: "GET / HTTP/1.1", upstream: "fastcgi://", host: ""

Lets edit /etc/php-fpm.d/www.conf and uncomment the line of and comment listen = /var/run/php-fpm/php-fpm.sock.

; Note: This value is mandatory.
listen =
#listen = /var/run/php-fpm/php-fpm.sock

And restart PHP-FPM & nginx

/bin/systemctl restart  php-fpm.service
/bin/systemctl restart  nginx.service