Install GD on PHP 5.6 - php

My web app is running on PHP 5.6.4 and Nginx on Ubuntu Ubuntu 16.04.1.
I am getting the following error in my browser:
FPDF error: GD extension is required for GIF support
I have recently reinstalled the server locally, so I am presuming GD library needs to be installed. So I ran the following commands:
sudo apt-get install php5.6-gd
sudo service php5.6-fpm restart
sudo service nginx restart
But I am still getting the same error message, can anyone advise what I should do please?

Related

Can't make php-CURL run on Centos server using php 7.2.5

I have CentOS server version 7.7 with nginx and PHP 7.2.5 installed
I have installed curl with
sudo yum install curl
and I got this
Package curl-7.29.0-54.el7.x86_64 already installed and latest version
I have installed php curl using
sudo yum install php-curl
Package php-common-7.2.24-1.el7.remi.x86_64 already installed
I restart nginx server using
sudo systemctl restart nginx.service
but still I can't see curl running on server, any ideas?
Please try this code:
sudo yum install php7.2-curl
It is possible, you have few php version installed on your server, and you try to install php-curl (for example to php5.6). It this case you don't use this version.
Also you need restart php-fpm, because nginx restarting doesn't restart php-fpm
sudo systemctl restart php-fpm
I found the problem, I have 2 versions one compiled and another one installed on the system
I have downloaded an updated version of PHP and compile it with curl support to replace the current one.

problem with GD image extension on Amazon Linux 2

I've recently created LAMP servers on EC2 instances using Amazon Linux AMI.
using
sudo yum install -y php70-gd
I installed the GD extension.
This all worked fine and i could upload and manipulate images using PHP.
Now I've created a LAMP server using Amazon Linux 2 using the tutorial here :https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-lamp-amazon-linux-2.html
My problem is that I can't get the GD extension to work.
i tried using
sudo yum install -y gd
and this seemed to install an older version of GD.
I tried
sudo yum install php-gd
and this seems to install the latest version of the extension.
But the gd extension still doesn't seem to work.
when I enter
yum info gd
In the console it shows :
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Installed Packages
Name : php-gd
Arch : x86_64
Version : 7.2.5
Release : 3.amzn2.0.2
Size : 769 k
Repo : installed
From repo : amzn2extra-lamp-mariadb10.2-php7.2
Summary : A module for PHP applications for using the gd graphics library
URL : http://www.php.net/
License : PHP and BSD
Description : The php-gd package contains a dynamic shared object that will add
: support for using the gd graphics library to PHP.
when I try an image resize script I get an error.
I've tried this test script :
$testGD = get_extension_funcs("gd"); // Grab function list
if (!$testGD){ echo "GD not installed."; exit; }
echo"<pre>".print_r($testGD,true)."</pre>";
and this gives me the result
GD not installed.
so obviously something is not right.
Can anyone help?
thanks
Amazon Linux 2 uses Apache with PHP-FPM instead of mod_php. So you need to restart the php-fpm process to reload PHP with the new extension.
sudo systemctl restart php-fpm
I'm running php 7.2.14 on Amazon Linux 2 and this worked for me:
$ sudo yum update -y
$ sudo yum install -y php-gd
$ sudo reboot
And solved...
Turns out restarting apache with
sudo systemctl restart httpd
wasn't enough to load the newly installed component...
what i needed to do was
sudo reboot
and everything works...
Why did't i try that 24 hours ago!
my PHP version was - PHP 7.2.18
$ php -v
I had to install -y php72-gd
$ sudo yum update -y
$ sudo yum install -y php72-gd
$ sudo reboot
$ sudo yum install -y php-gd
$ sudo systemctl restart php-fpm
No need to reboot
I was getting error Required extension GD is not loaded while using Claviska Simple Image Library in my project on AWS with Php 7.0
So I needed to update the GD php library:
sudo yum install -y php70-gd
and then restart httpd service to load the updated php.
sudo /etc/init.d/httpd restart
Worked for me!
You may have done nothing wrong and might not need to reboot either. Sometimes, the extensions are not directly mapped in the php.ini file. As such, you may need to map the newly added extensions (or which are not mapped already) in the php.ini file. In your case, add
extension=gd.so
In general,
extension=<my_extension_name>.so

class "DOMDocument" not found in a Drupal 8 site

I've found an error on a page in my Drupal 8 site; it always show this message error when I visit it:
Error: Class 'DOMDocument' not found in /var/www/vhosts/mysite/core/lib/Drupal/Component/Utility/Html.php on line 286
I'm using Centos 6 and I runned this commands:
yum install php71w-xml
sudo service httpd restart
I verified in php.ini: extensions php are enabled dom, xml, xmlreader, xmlwrite
But not worked for me.
Can you give me a solution? I'm Drupal 8, php 7.1, apache2.2
I had the same issue on Ubuntu with php 7.x and fixed it doing the following.
sudo apt-get install php-xml
Once done, restart your web server
Source: https://laracasts.com/discuss/channels/servers/how-do-i-install-the-dom-extension-for-php7
You Need to Install XML Extension
$ sudo apt-get update
$ sudo apt-get install php5.6-xml //for PHP 5.6
and then restart the apache
$ sudo service apache2 restart
in case using NGINX
nginx -s reload

Installing imagick on CentOS 7 with XAMPP and PHP 7

I have a local machine with Ubuntu, Apache 2.4 and PHP 7.0
I could install imagick easily using apt-get, but I can't seem to be able to do it on CentOS with XAMPP.
I tried many things including:
yum install php70w-pecl-imagick-devel.x86_64
pecl install imagick
Copying the imagick.so file to the modules directory
Adding extension=imagick.so to /opt/lampp/etc/php.ini and restarting
But the module simply isn't being loaded!
I keep on getting Class 'Imagick' not found in Laravel
Try with CMD or SSH or PuTTY
Once you have enabled the EPEL repository, install ImageMagick with dnf command.
dnf install -y ImageMagick ImageMagick-devel
PHP Imagick is a native PHP extension to create and modify bitmap images using the ImageMagick API.
dnf install -y php php-devel php-pear make
Now, install PHP Imagick with pecl command.
pecl install imagick
Please provide the prefix of Imagemagick installation [autodetect] :
just press Enter; do not type a prefix (that is, allow autodetect).
Add the extension into the php.ini file.
echo "extension=imagick.so" > /etc/php.d/20-imagick.ini
Restart the Apache web service to take an effect of newly installed PHP extension.
systemctl restart httpd
List the complied modules to see if PHP Imagick is installed and available.
php -m

Install PHP OPCACHE on Amazon Linux EC2

I am trying to install PHP OPCACHE on my Amazon Linux EC2 instance but I am getting some errors related to conflict. The version of PHP running on my EC2 is PHP Version 5.3.29. More details can be seen here Info
I am trying to install it via SSH using Putty. I am using the following command,
sudo yum install -y php54-pecl-apc
OR
sudo yum install php55-opcache
I still get the error. Error
How can I install OPCACHE? Am I doing any other mistake?

Categories