In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "how to compile and install php gd". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
The method of compiling and installing php gd: 1, install zlib;2, install freetype;3, install libpng;4, install libjpeg;5, and install gd extension through "make & & make install".
This article operating environment: linux5.9.8 system, PHP7.1 version, DELL G3 computer
How to compile and install php gd?
Php compilation and installation of gd extension
Gd library is often needed for php development, but there are several situations where gd is not installed by default in the deployment environment, so I make a summary here for a rainy day.
The php installed through package management installation, such as yum,apt-get, can run the corresponding command directly, so I will not repeat it here.
This article mainly records the compilation of gd extensions and their required dependencies in linux environment.
The gd extension mainly depends on the four libraries zlib,freetype,libpng,libjpeg, so let's compile these four libraries first
1. Install zlib
Download the latest version from the zlib project home page
After decompression, enter the source code directory for configuration, compilation and installation
Wget http://www.zlib.net/zlib-1.2.11.tar.gztar-zxvf zlib-1.2.11.tar.gzcd zlib-1.2.11./configure-- prefix=/user/local/zlibmake & & make install
Mac computer will report the above error after shutting down sip sudo mount-uw / use
Sudo make & & sudo make install
two。 Install freetype
Download the stable version of the source code from the freetype project home page
Decompress and enter the source directory
Wget https://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.gztar-zxvf freetype-2.9.tar.gzcd freetype-2.9./configure-- prefix=/user/local/freetypemake & & make install
3. Install libpng
Download the source code from the libpng project home page
Decompress and enter the source directory
Wget https://nchc.dl.sourceforge.net/project/libpng/libpng16/1.6.37/libpng-1.6.37.tar.xztar-zxvf libpng-1.6.37.tar.xzcd libpng-1.6.37./configure-- prefix=/user/local/libpngmake & & make install
4. Install libjpeg
Download the source code from the libjpeg project home page
Decompress and enter the source directory
Tar-zxvf jpegsrc.v9d.tar.gzcd jpeg-9d./configure-- prefix=/user/local/libjpeg-- enable-sharedmake & & make install
5. Install the gd extension. Enter gd in the ext folder under the source code of php.
Cd gdphpize./configure-with-php-config=/usr/bin/php-config-with-jpeg-dir=/user/local/libjpeg-with-png-dir=/user/local/libpng-with-freetype-dir=/user/local/freetype-with-zlib-dir=/user/local/zlibmake & & make install
Where-- with-php-config is a configuration tool generated after installing php, which is mainly used for extended compilation configuration.
Other parameters point to the location where the previous installation is dependent
If there is no error, the compiler will prompt that the generated gd.so has been copied to the php extension directory, we just need to add a line to the php.ini
Extension=gd.so
Restart the server takes effect
This is the end of "how to compile and install php gd". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.