While we are at it…
Can we please start installing the extensions using the provided mechanism rather than manually creating multiple text files?
all the OEM guides say to add 2 links for each extension/module in the apache2/conf.d and cli/conf.d folders under either etc/php5 or etc/php/7.0 depending on which version of php you are using. eg
sudo sh -c 'echo "extension=redis.so" > /etc/php/7.0/apache2/conf.d/20-redis.ini'
sudo sh -c 'echo "extension=redis.so" > /etc/php/7.0/cli/conf.d/20-redis.ini'
This is not in keeping with the intended methods, there should be only one text file written to the mods-available directory eg
echo 'extension=redis.so' > /etc/php/7.0/mods-available/redis.ini
and then the extension can be enabled with phpenmod redis
or disabled with phpdismod redis
eg
pb66@test2:~$ sudo phpenmod redis
pb66@test2:~$ ls -la /etc/php/7.0/*/conf.d/*redis.ini
lrwxrwxrwx 1 root root 37 Oct 27 12:54 /etc/php/7.0/apache2/conf.d/20-redis.ini -> /etc/php/7.0/mods-available/redis.ini
lrwxrwxrwx 1 root root 37 Oct 27 12:54 /etc/php/7.0/cli/conf.d/20-redis.ini -> /etc/php/7.0/mods-available/redis.ini
and
pb66@test2:~$ sudo phpdismod redis
pb66@test2:~$ ls -la /etc/php/7.0/*/conf.d/*redis.ini
ls: cannot access '/etc/php/7.0/*/conf.d/*redis.ini': No such file or directory
So instead of (for example)
for php5
sudo sh -c 'echo "extension=redis.so" > /etc/php5/apache2/conf.d/20-redis.ini'
sudo sh -c 'echo "extension=redis.so" > /etc/php5/cli/conf.d/20-redis.ini'
or for php 7.0
sudo sh -c 'echo "extension=redis.so" > /etc/php/7.0/apache2/conf.d/20-redis.ini'
sudo sh -c 'echo "extension=redis.so" > /etc/php/7.0/cli/conf.d/20-redis.ini'
we would have
for php5
sudo sh -c 'echo "extension=redis.so" > /etc/php5/mods-available/redis.ini'
sudo php5enmod redis
or for php 7.0
sudo sh -c 'echo "extension=redis.so" > /etc/php/7.0/mods-available/redis.ini'
sudo phpenmod redis
or better still, since using echo for this purpose is frowned upon in many circles (since it behaves differently in various shell’s) and initiating another shell within a shell is messy (sudo sh -c
) we should probably be using
for php5
printf "extension=redis.so" | sudo tee /etc/php5/mods-available/redis.ini 1>&2
sudo php5enmod redis
or for php 7.0
printf "extension=redis.so" | sudo tee /etc/php/7.0/mods-available/redis.ini 1>&2
sudo phpenmod redis
I have been using these methods for a long time now without any issue.