Home Backend Development PHP Problem What should I do if php does not support jpeg?

What should I do if php does not support jpeg?

Sep 28, 2020 am 09:49 AM
jpeg php

Solution to the problem that php does not support jpeg: first download "jpegsrc.v8b.tar.gz" from the official website; then compile the jpeg module and compile the gd module; finally, change "gd. Just add the so" module.

What should I do if php does not support jpeg?

Recommended: "PHP Video Tutorial"

The GD library of php in liunx does not support jpeg by default

Use compiled and installed php, but when uploading jpg files, an error is reported:

Call to undefined function imagecreatefromjpeg()
Copy after login

It turns out that the gd library does not support jpg by default. You can add jpg support to the gd library. When compiling and installing php, do not include the gd library first. After the installation is complete, compile the gd library separately.

Compile the jpeg module. This needs to be downloaded from the official website.

[root@linux-node1 ~]# wget http://www.ijg.org/files/jpegsrc.v8b.tar.gz
[root@linux-node1 ~]# tar -xf jpegsrc.v8b.tar.gz
[root@linux-node1 ~]# cd jpeg-8b
[root@linux-node1 jpeg-8b]# ./configure –prefix=/usr/local/jpeg –enable-shared –enable-static
[root@linux-node1 jpeg-8b]# make && make install
Copy after login

Compile the gd module. This is in the php source code package.

[root@linux-node1 gd]# pwd
/usr/local/src/php-5.6.30/ext/gd
[root@linux-node1 gd]# /usr/local/php/bin/phpize
[root@linux-node1 gd]# ./configure –with-php-config=/usr/local/php/bin/php-config\
–with-jpeg-dir=/usr/local/jpeg\
–with-freetype-dir
[root@linux-node1 gd]# make && make install
Copy after login

Finally, add gd in php.ini Just add the .so module

Note:

If the above cannot solve the problem, please install the following package

[root@linux-node1 ~]# yum install libjpeg-devel freetype-devel libpng-devel
Copy after login

The above is the detailed content of What should I do if php does not support jpeg?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

CakePHP Date and Time

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

CakePHP File upload

CakePHP Routing CakePHP Routing Sep 10, 2024 pm 05:25 PM

CakePHP Routing

CakePHP Project Configuration CakePHP Project Configuration Sep 10, 2024 pm 05:25 PM

CakePHP Project Configuration

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

Discuss CakePHP

CakePHP Quick Guide CakePHP Quick Guide Sep 10, 2024 pm 05:27 PM

CakePHP Quick Guide

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

How To Set Up Visual Studio Code (VS Code) for PHP Development

See all articles