In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the knowledge of "how to add extension library for PHP under Linux". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!
1. Add FTP extension
1. Find the original source package and extract it
Php-5.2.13
Go to ftp extension directory/root/lnmp/php-5.3.0/ext/ftp
2. Call phpize program to generate compilation configuration file
The copy code is as follows:
root@dns ftp]# /usr/local/php5/bin/phpize
configuring for:
php api version: 20041225
zend module api no: 20060613
zend extension api no: 220060519
3. Compile the extension library and execute the configure and make commands below, respectively.
#./ configure --with-php-config=/usr/local/php5/bin/php-config
#configure After this step is executed, execute the make command. If configure does not pass, find the cause of the error.
#make
#After make is successfully executed, the generated extension library file is in the modules subdirectory of the current directory,
The copy code is as follows:
[root@ansen ftp]# ls modules/
ftp.la ftp.so
4. Edit the php.ini document, create a directory of extension_dir, and copy the compiled extension file to extension
Set extension_dir = "./ "Replace with
The copy code is as follows:
extension_dir = "/usr/local/php5/lib/php/extension"
The copy code is as follows:
[root@ansen modules]#cp ftp.so /usr/local/php5/lib/php/extension
5. Set the extension library to be added at the Add Extension Library location in php.ini.
Add extension=ftp.so at 989
6. Restart apache to get ftp support
Second, add zlib extension
The copy code is as follows:
[root@ansen zlib]# pwd
/root/lnmp/php-5.3.0/ext/zlib
[root@ansen zlib]#mv config0.m4 config.m4
[root@ansen zlib]#/usr/local/php5/bin/phpize
[root@ansen zlib]#./ configure --with-php-config=/usr/local/php5/bin/php-config
[root@ansen zlib]#make
[root@ansen zlib]# cp modules/zlib.so /usr/local/php5/lib/php/extension/
[root@ansen zlib]#vi /usr/local/php5/lib/php.ini
Add extension=zlib.so
8, restart Apache can be
ps: Other extensions can be installed by referring to the above two extension methods
Complementary short version:
When compiling php at the beginning, I forgot to add it now with phpize installation extension library
Find the source directory for the currently running version of php, such as php-5.2.12. Go to curl extension library directory
#cd /home/changyou/php-5.2.12/ext/curl
(Call phpize program to generate compiled configuration file)
#/usr/local/web/php/bin/phpize
(Compile the extension library and execute the configure and make commands below, respectively)
#./ configure -with-php-config=/usr/local/web/php/bin/php-config
(After configuring this step, execute the make command. If configure does not pass, look for the cause of the error)
#make
After make is successfully executed, the generated extension library file is in the modules subdirectory of the current directory
For example, my directory here is: /home/changyou/php-5.2.12/ext/curl/modules/curl. so
Then configure php.ini file and copy the compiled extension library file to php extension directory
#cp /home/changyou/php-5.2.12/ext/curl/modules/curl.so /usr/local/web/php/lib/php/extension/
Finally modify php.ini to add configuration
extension_dir = "/usr/local/web/php/lib/php/extension/"
extension=curl.so
"How to add PHP extension library under Linux" content is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!
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.