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

Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

This new server with Ubuntu 16.04 LTS cames with PHP 7.0.

The backup that I have from my client has some old WordPress blogs…

Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

I need to downgrade PHP 7.0 to PHP 5.6, at least for now.

Before you procede with the tutorial on the following link, and if you are running a new Ubuntu 16 installation you might get upon the following error while following the tutorial.

[email protected]:/home/httpd/html# sudo add-apt-repository ppa:ondrej/php
sudo: add-apt-repository: command not found

To install add-apt-repository you will need to run the following command

sudo apt-get install software-properties-common

Now the solution  How can I downgrade from PHP 7 to PHP 5.6 on Ubuntu 16.04? [duplicate].


Apache / PHP – End of script output before headers


[Thu May 12 03:14:41.562083 2016] [core:error] [pid 25726] [client 68.71.XXX.XXX:44611] End of script output before headers: manage.php
[Thu May 12 03:14:41.697026 2016] [:error] [pid 26855] [client 84.91.XXX.XXX:60222] SoftException in Application.cpp:256: File “/home/rocker/public_html/system/manage.php” is writeable by group

I had to set the file to 755.

As seen on