Category: "PHP"

Ibexa 4.6 on Rocky 9 - PHP packages

Apologies for the short post. I had trouble with GD - the issue was that I had php-gd instead of php82-gd

php82-8.2-5.el9.remi.x86_64
php82-php-8.2.21-1.el9.remi.x86_64
php82-php-cli-8.2.21-1.el9.remi.x86_64
php82-php-common-8.2.21-1.el9.remi.x86_64
php82-php-fpm-8.2.21-1.el9.remi.x86_64
php82-php-gd-8.2.21-1.el9.remi.x86_64
php82-php-intl-8.2.21-1.el9.remi.x86_64
php82-php-mbstring-8.2.21-1.el9.remi.x86_64
php82-php-mysqlnd-8.2.21-1.el9.remi.x86_64
php82-php-opcache-8.2.21-1.el9.remi.x86_64
php82-php-pdo-8.2.21-1.el9.remi.x86_64
php82-php-sodium-8.2.21-1.el9.remi.x86_64
php82-php-xml-8.2.21-1.el9.remi.x86_64
php82-runtime-8.2-5.el9.remi.x86_64

Error messages:

[2024-07-13T20:46:04.111489+00:00] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Validator\Exception\LogicException: "Corrupted images detection requires installed and enabled GD extension."
[2024-07-13T21:54:31.829868+00:00] request.CRITICAL: Gd driver not installed {"exception":"[object] (Imagine\\Exception\\NotSupportedException(code: 0): Gd driver not installed

Find the PHP session files that are older than 24 minutes

sudo find /var/lib/php/session -mmin +24 -type f -exec ls -l {} \;

Yes, that's the whole post

Apache 2.4 virtual host specific PHP-FPM error logs

If you are using PHP-FPM with Apache and you would like to separate the error logging by user, directory or virtual host, you can use the ProxyFCGISetEnvIf directive

In a server level Apache .conf file


<Directory /home/user/public_html>
ProxyFCGISetEnvIf "true" PHP_ADMIN_VALUE "error_log=/var/log/php-fpm/user/error.log"
</Directory>

In this case, the error log for user would be

/var/log/php-fpm/user/error.log

Set up the ACL (AMI 2 Linux)

setfacl -m u:user:x /var/log/php-fpm
setfacl -m u:user:rx /var/log/php-fpm/user
setfacl -d -m u:user:r /var/log/php-fpm/user

Test it with

sudo su user
more /var/log/php-fpm/user/error.log

Credit to:

Apache 2.4 virtual host specific PHP-FPM error logs
Comment from PHP.net (documentation)

https://www.php.net/manual/en/install.fpm.configuration.php#123335

AMI - upgrade PHP from 7.1 to 7.3

AMI - upgrade PHP from 7.1 to 7.3
PHP logo

Don't do this on a production system

I ran this on an Amazon Linux AMI - it's probably fine on CentOS, etc.

Get all the PHP 7.1 packages and make a file called php. You might have to change the .x86_64 to .i386/.i686

sudo yum list installed php71* | grep php | cut -f1 -d' ' | tr -d '.x86_64' | tr "\n" ' ' | sed "s/71/73/g" > php

Remove PHP 7.1 (remember I said not to do this on a production machine)

sudo yum remove php71*

Now edit your php file and add

sudo yum install at the beginning of the list of packages

It should look something like this

sudo yum install php73 php73-cli php73-common php73-gd php73-imap php73-intl php73-json php73-mbstring php73-mysqlnd php73-opcache php73-pdo php73-pecl-apcu php73-pecl-igbinary php73-pecl-memcached php73-pgsql php73-process php73-soap php73-ml

Run the php file with

source php

And, if you are using memcached, run this too

sudo yum install php7-pear php73-devel
sudo pecl7 install memcached
sudo pecl7 update-channels

Add this into php.ini somewhere ...

extension=memcached.so

Restart Apache

sudo apachectl restart

Bask in the glory

Upgrade PHP 5.5 to PHP 7.1 on CentOS 6.9 - Recklessly

I wasn't planning to upgrade PHP today, but in order to use Symfony 4.0, I had to.

First, I wanted to get all the PHP RPMs

sudo yum list installed php55u* | grep php | cut -f1 -d' ' | tr -d '.i686' | tr "\n" ' ' | sed "s/55/71/g" > php

Next, I removed all the PHP 5.5 RPMs:

sudo yum remove php55*

Then I edited the output file (php) and added a sudo yum install at the beginning of the file

So I could use

source php

There were a few more RPMs I needed, after roaming about the web for a bit, these were the commands that I ran

sudo yum install pear1u
sudo yum install php71u-json
sudo yum install libmemcached-devel
sudo pecl install memcached

The recklessly part of this is that I confess I did not check ... anything. My existing Symfony 3.3.10 application comes up and lets me log in. I haven't checked more than that.

Good luck!