This article introduces two methods of opening the PHP GD library under Windows. The GD library is not enabled by default in PHP. If you want it to support image processing functions, you must enable it manually. Friends in need are advised to refer to the methods provided in this article.
Method 1:
When we don’t know where the GD library is at the beginning, we can search it on the computer , type php.ini in the search bar like I did, and then the computer will search for all php.ini files to facilitate our search.
At this time, you can choose according to your own php version. The php I use is 7.3, so I opened the php.ini file with notepad. You can Search for gd inside, find the location of the purple shading line of code, and remove the semicolon before or after this line of code. In this way, we have successfully opened the GD library.
Method 2:
Mine is phpstudy_pro, so I will use phpstudy_pro to demonstrate. Open phpstudy_pro and click on the website on the left. At this time, we click on management to select php extension. You can see that gd2 is checked here, which indicates that the gd library has been opened. If not, we need to click gd2 to open the GD library.
We just know that turning it on is not enough, we also need to verify it to prevent our GD library from not being turned on.
First, create a php file, write the following code and save it:
<?php phpinfo(); ?>
Then open the file you just created, pull down, and you will see the following interface, which will indicate that the GD library has been opened .
Recommended: "PHP Video Tutorial"
The above is the detailed content of Detailed explanation of the two methods of opening the gd library in PHP. For more information, please follow other related articles on the PHP Chinese website!