When building the LAMP environment, apache and php were installed manually by myself, and only the default extension library of php was installed. It was only when curl was used that I discovered that the curl extension library was not loaded.
I have to install it manually.
1. Switch to the php source code folder I downloaded.
cd php5.3.10
2. Enter curl’s extension library
cd ext/curl
3. Execute the command (my php is compiled and installed and placed in the /usr/local/php file)
/usr/loca/php/bin/phpize
4. Execute the command to configure curl
./configure --with-php-config=/usr/loca/php/bin/php-config
The --with-php-config option must be added. If not, an error message of php-config not found will be reported
5.make & make install
6. After completion, a curl.so file will be generated under /usr/local/php/lib/php/extensions/no-debu-non-zts-XXXXX
Copy the curl.so file to the /usr/loca/php/lib/php/extensions folder (you don’t have to copy it)
7. Add the instruction to enable the curl extension library in the php.ini configuration file
extension=/usr/local/php/lib/php/extensions/curl.so
8. Restart the apache service and the curl function can be used.