PHP

Drupal and upgrading PHP from v5 -> v7

I finally bit the bullet to upgrade PHP from v5.x to v7.2.x (v7.3.x is not yet supported by this version of Drupal). So, of course, it was a disaster, and nothing worked. I had to do a few things to get things up and running again.

First, it would not execute my .php scripts, rather, it would return them as text ... I ended up adding this to my httpd.conf:

<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>

Alright, so that helps! Now, of course, it's failing with a DSO error like

 [client 127.0.0.1:32794] PDOException: SQLSTATE[HY000] [2002] No such file or directory...

Not particularly useful, but my friend Brian France helped me track this down. Turns out, for some reason my PHP is not finding the mySQL domain socket, even though it's in the default directory. I modifed my php.ini accordingly:

pdo_mysql.default_socket = /var/lib/mysql/mysql.sock
mysql.default_socket = /var/lib/mysql/mysql.sock
mysqli.default_socket = /var/lib/mysql/mysql.sock

Voila! Now the last thing I had to tweak with my installation was opcache, I still don't understand why this is not enabled and configured with sensible defaults in PHP by default. But, in my php.ini, I added

zend_extension=/opt/php7/lib/php/extensions/no-debug-non-zts-20170718/opcache.so
[opcache]
opcache.enable=1
opcache.enable_cli=0
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000

 

Hacking: 

Subscribe to RSS - PHP