How proper enable extension=imagick.so on Google Cloud - php

I have a VM with Wordpress (click to deploy) on Google Cloud and need extension "ImageMagick".
According to this article:
https://cloud.google.com/appengine/docs/standard/php7/runtime#php-7.4-beta
Dynamically loadable extensions
The following extensions are dynamically loadable by configuring php.ini:
Memcached, gRPC, protobuf, MongoDB, ImageMagick, OpenCensus, PHPRedis
Add the line: "extension=imagick.so" on /etc/php/7.4/apache2/php.ini
and: sudo service apache2 restart
But stay dont working...
This my php -m :
tdias#universidade-bordado-vm:/etc/php/7.4/apache2$ php -m
[PHP Modules]
calendar
Core
ctype
curl
date
dom
exif
FFI
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zlib
[Zend Modules]
Zend OPcache

The problem is, Google Cloud require you install before add extesion on php-ini, just run:
sudo apt-get install php-imagick
After you can enable on phph.ini
"extension=imagick.so"
Last, just restar apache:
sudo service apache2 restart

Related

oci8.so is missing in php modules in Linux Centos 8

I'm having a problem to install oracle instant client in my linux server. Its already 5 days i'm stuck with it. I followed the tutorial but still didn't work.
https://medium.com/#azharnian/cara-install-oci8-php-7-di-centos7-851abbb5d15
https://gist.github.com/Yukibashiri/cebaeaccbe531665a5704b1b34a3498e
https://docs.oracle.com/en/database/oracle/oracle-database/19/lnoci/instant-client.html#GUID-96F664E7-AD1D-4FE4-BCE2-6D9687016A51
I've successfully install apache, php and mariaDB in server. I have no problem running my php and laravel in the server.
But my current problem when I install oracle instant client, i notice that oci8.so in /usr/lib64/php/modules is missing. When I run command pear download pecl/oci8 Error as below.
PHP Warning: PHP Startup: Unable to load dynamic library 'oci8.so' (tried: /usr/lib64/php/modules/oci8.so (/usr/lib64/php/modules/oci8.so: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/oci8.so.so (/usr/lib64/php/modules/oci8.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
intl
json
ldap
libxml
mbstring
mcrypt
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib
[Zend Modules]
Zend OPcache
How can I installed oci8.so in my php modules ? How can I check my OCI status.
Appreciate if someone can help me to solve this issue. Many thanks.
https://linux.uits.uconn.edu/2020/03/06/php-and-oci8-installation-for-rhel8/
This link is a step by step on how to install oci8
dnf install oracle-instantclient18.5-basic-18.5.0.0.0-3.x86_64.rpm oracle-instantclient18.5-devel-18.5.0.0.0-3.x86_64.rpm oracle-instantclient18.5-sqlplus-18.5.0.0.0-3.x86_64.rpm
dnf install libnsl
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
dnf install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm
Install PHP and OCI8:
dnf module list php
dnf module enable php:remi-7.4 -y
(if you get the following message: “The operation would result in switching of module 'php' stream '7.2' to stream 'remi-7.4’”)
dnf module reset php (enter “y”)
dnf module enable php:remi-7.4 -y
dnf install -y php php-cli php-common php-fpm php-pear gcc curl-devel php-devel zlib-devel pcre-devel php-pecl-http systemtap-sdt-devel
export PHP_DTRACE=yes
setenforce 0
echo "instantclient,/usr/lib/oracle/18.5/client64/lib" | pecl install oci8-2.2.0.tgz
echo extension=oci8.so >> /etc/php.ini
echo extension=oci8 > /etc/php.d/20-oci8.ini
systemctl restart php-fpm
systemctl restart httpd

Using required CURL extension to install Valet

I am trying to install Valet on my laravel 6 project. So when I run composer global require cretueusebiu/valet-windows to install it, I get the following error:
requires ext-curl * -> the requested PHP extension curl is missing from your system.
However, extension=curl is enable in my php.ini file and also I run following command to check whether it is enable or nor:
<?php phpinfo() ?>
There also I can see the curl support is enable. What should I do to use Valet now? I am using Windows 10 and according to this answer, there is curl.exe but it does nothing with my expected answer.
and when I run php -m I get the following:
[PHP Modules]
bcmath
calendar
Core
ctype
date
dom
fileinfo
filter
hash
iconv
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql
PDO_ODBC
pdo_pgsql
pdo_sqlite
Phar
readline
Reflection
session
SimpleXML
sockets
SPL
standard
tidy
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
zip
zlib
[Zend Modules]
So there is no curl available. What do I do to get it?
ext-curl might not be enabled.
Try to enable:
$ sudo phpenmod curl
OR, install:
$ sudo apt install php[7.2,7.3]-curl
Repalce [7.2,7.3] from your installed PHP's version
You can use your OS package manager. Here I've used Aptitude for Debian

PHP 7.2 and modules 'dom', 'mbstring', and 'simplexml'

I installed PHP 7.2 on my server and everything works fine except these three issues:
I face these problems:
The PHP extension dom is not loaded. Please contact your server
administrator or visit http://php.net/manual/en/dom.installation.php
for installation.
PHP extension mbstring is not loaded. Please contact your server
administrator or visit
http://php.net/manual/en/mbstring.installation.php for installation.
PHP extension simplexml is not loaded. Please contact your server
administrator or visit
http://php.net/manual/en/simplexml.installation.php for installation.
...
Now when I type php -m,
[root#localhost php.d]# php -m
[PHP Modules]
bz2
calendar
Core
ctype
curl
date
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
ldap
libxml
mcrypt
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
readline
Reflection
session
sockets
SPL
sqlite3
standard
tokenizer
zlib
[Zend Modules]
[root#localhost php.d]#
It shows that there isn't any mbstring, dom or simplexml modules.
I've tried everything that I can find on google, but I can't seem to install those three modules.
php -v returns this:
PHP 7.2.7 (cli) (built: Jun 20 2018 08:21:26) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
What's wrong?
Try installing the missing modules as:
sudo yum install php7.2-dom
sudo yum install php7.2-mbstring
sudo yum install php7.2-simplexml
Don't forget to restart server after installation.
This may be weird, but once you install these (below commands) depending on your version (mine is 7.3 at the time of post), the modules get enabled somehow.
apt-get install php7.3
apt-get install php7.3-common
apt-get install php7.3-cli
service apache2 restart
php -m

Docker Image installing php modules

I created a Dockerfile like below
FROM ubuntu:14.04
RUN apt-get update -y && apt-get install -y software-properties-common language-pack-en-base
RUN LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
RUN apt-get -y update && apt-get install -y \
php7.0 \
php7.0-pgsql \
php-pear \
php7.0-curl \
php7.0-sqlite3 \
php7.0-xml \
php7.0-bcmath \
php7.0-zip \
php7.0-mbstring \
php-xdebug \
php-ast
WORKDIR /var/www/html/code
When i run docker-compose build container_name
And docker-compose run --rm container_name php -m
It seems like not all the php modules were installed during the build of the container. As the result shows below.
[PHP Modules]
ast
calendar
Core
ctype
date
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
openssl
pcntl
pcre
PDO
Phar
posix
readline
Reflection
session
shmop
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xdebug
Zend OPcache
zlib
[Zend Modules]
Xdebug
Zend OPcache
I did not get the php modules that i exepected to see like pdo_pgsql, xml, xmlreader and etc.
I would use the official PHP image from Dockerhub. It has a utility script built in for installing and enabling PHP extensions. A revised Dockerfile for your needs could be something like this:
FROM php:7
RUN docker-php-ext-install <YOUR-EXTENSIONS>
WORKDIR /var/www/html/code
where YOUR-EXTENSIONS is possible values from this list:
Possible values for ext-name:
bcmath bz2 calendar ctype curl dba dom enchant exif fileinfo filter ftp
gd gettext gmp hash iconv imap interbase intl json ldap mbstring mcrypt
mysqli oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci
pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell readline recode
reflection session shmop simplexml snmp soap sockets spl standard
sysvmsg sysvsem sysvshm tidy tokenizer wddx xml xmlreader xmlrpc
xmlwriter xsl zip
There are other tags for other versions on the image on Dockerhub - Check the docs there
Hope this helps
Dylan
Instead of...
docker-compose run --rm container_name php -m
...type:
docker-compose run --rm container_name php7.0 -m
OR
In the Dockerfile, just before ...
WORKDIR /var/www/html/code
...add:
RUN update-alternatives --set php /usr/bin/php7.0

The json extension is missing. Please check your PHP configuration

I install PHP5.6.0 on Ubuntu 13.10 x64 from this
https://launchpad.net/~ondrej/+archive/php5-5.6a
then I installed phpmyadmin when I am trying to lunch phpmyadmin I got this message
The json extension is missing. Please check your PHP configuration.
my PHP modules:
bcmath
bz2
calendar
Core
ctype
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
libxml
mbstring
mcrypt
mhash
mysql
mysqli
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib
[Zend Modules]
Zend OPcache
then when i use this command to install php-json
sudo apt-get install php5-json
I got this
The following packages have unmet dependencies:
php5-json : Depends: phpapi-20121212
E: Unable to correct problems, you have held broken packages.
How can I fix this problem?
It looks like you are install PHP5 from a custom repo. I would remove PHP and remove that repo.
sudo apt-add-repository --remove ppa:ondrej/php5-5.6
sudo apt-get update
now install php
sudo apt-get install php5-common php5-json
Below solution worked for me-
cd /etc/php5/mods-available
vi json.ini
In this file make below changes
priority=20
extension=json.so
Incase if json.ini file is not there, create the file with contents as
priority=20
extension=json.so
The problem seems to me to be because of Ubuntu's default permissions for the php.ini files. It only allows Root to read/execute the directories holding the in files.
You can easily verify this by observing that when you execute:
sudo php -m
You see all installed and enabled modules listed correctly.
The solution to this I have found on ubuntu distros is to:
sudo chmod a+rx /etc/php5/cli/
sudo chmod a+rx /etc/php5/cli/php.ini
sudo chmod a+rx /etc/php5/cli/conf.d/
Then you can easily verify by running:
php -m
It worked for me after loading the installed modules json and mcrypt.
$ sudo php5enmod json && sudo php5enmod mcrypt $ sudo service apache2 restart
Go to http://yourserver/phpmyadmin and take a look to check if it works.

Categories