Install MySQL and curl extensions in Linux

Source: Internet
Author: User

After installing apache2 + PhP5, I want to install mysql5 again.
After installing mysql5 with the source code, I found that I wanted to add new extensions for PHP in Linux. Unlike in windows, I just needed to remove the semicolon comment ~
I found a lot of information on the Internet and finally got it done. Close up the diary to congratulate me.

To add an extension, follow these steps:
1, enter the PHP source code Directory: # cd/usr/chenshao/php-5.3.1/
2. Go to the MySQL extension source code directory to be added: # cd EXT/MySQL/
2. Call phpize in compiled PHP: #/usr/local/PhP5/bin/phpize

In this step, new problems may occur:

Here is the online solution .....

 

11 02 cannot find Autoconf. Please check your Autoconf installation and the $ php_autoconf environment variable. Then, rerun this script

 

 



When running/usr/local/webserver/PHP/bin/phpize, the following error occurs: Running ing for: PhP API version: 20041225 Zend module api no: 20060613 Zend extension api no: 220060519 cannot find Autoconf. please check your Autoconf installation and the $ php_autoconf environment variable. then, rerun this script. according to the network solution is: # cd/usr/src # wget http://ftp.gnu.org/gnu/m4/m4-1.4.9.tar.gz# tar-zvxf m4-1.4.9.tar.gz # cd m4-1.4.9 /#. /configure & make install # CD .. /# wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.62.tar.gz# tar-zvxf autoconf-2.62.tar.gz # cd autoconf-2.62 /#. /configure & make install cute Yum makes it easier for me to install the uninstalled package Yum install M4 Yum install Autoconf

 

 

3. Then, configure: #./configure -- With-PHP-Config =/usr/local/PhP5/bin/PHP-config -- With-mysql =/usr/local/MySQL
(/Usr/local/MySQL is the installation directory of MySQL)
4. Make & make install
5. After compilation, MySQL is automatically loaded. so to the default PHP extension directory (phpinfo can be viewed, my/usr/local/PhP5/lib/PHP/extensions/no-debug-zts-20090626), and then modify PHP. INI, remove the semicolon before extension = php_mysql.so.
Note that the generated module is namedMySQL. SoIn PHP. iniPhp_mysql.soThe names are inconsistent. You must change mysql. So to php_mysql.so. Remember to remember ~! You can use the target file of the source file of the MV command.

6. Add the extension module: curl:

For more information, see -------------------------

 

When installing some PHP source code, such as cmstop, the system needs to enable curl extension, which requires modifying the PHP configuration. In Windows, you only need to take three steps.

1. Install php_curl in Windows

1. Copy the three php_curl.dll files (possibly in the ext folder), libeay32.dll and ssleay32.dll files in the PHP installation folder to % WINDIR %/system32;
2. Open PHP. ini (which may be in the installation directory of the PHP environment, which is in the C: \ Windows directory by default) and remove the semicolon in the; Extension = php_curl.dll header;
3. Restart the PHP Service (Apache or IIS), such as Restarting IIS and running iisreset.

Ii. How to install curl extension in PHP in Linux

If PHP has been compiled in the system and new extensions need to be added later, one way is to re-compile PHP completely, and the other way is to compile the extension library separately, extension.

Scenario 1: install PHP and curl

First download the curl installation package (My PHP is 4.4.4, and the latest curl 7.16 cannot be used, and the latest curl 7.14 is only available for download. Pay attention to the version)

Then install curl

# Tar-zxf (enter the downloaded curl package name here) #./configure-Prefix =/usr/local/curl # Make; make install

When installing PHP, you only need to turn on the switch-with-curl =/usr/local/curl.

PHP requires that the curl Directory should have the include and Lib directories, and the include directory should have the easy. h and curl. H files, and the lib directory should have libcurl.. After compilation, the include file is available, but the lib directory may not. It was originally generated in the LIB/. libs directory, So copy to the lib directory.

Scenario 2: PhP has been installed. Now you need to add this extension.

Go to the source code directory for installing the original PHP file. (If you delete the file but still have the original compressed file, decompress it again)

Cd ext/curlphpize (reference/usr/local/PhP5/bin/phpize)
Run. /configure-with-curl = Dir (DIR can be left empty if no directory is specified during installation of your curl ). /configure -- With-PHP-Config =/usr/local/PhP5/bin/PHP-config -- With-curl =/usr/local/mysqlmake & make install and install mySQL extension is similar

The curl. So file is generated under phpdir/EXT/curl/moudles.
Copy the curl. So file to the extensions configuration directory and modify PHP. ini.

The above two methods are used to install PHP extension curl in Linux.

 

7. Restart Apache: # service httpd restart

NOTE: If Step 1 passes, but the error is reported in step 2, it is likely that the source code is faulty. I downloaded a new copy from php.net and then compiled it before it passes.


You also need to change the extension of PHP. ini to remove the preceding comment. In Linux, you need to change the ending DLL to so.


The final upload means I have done it. It's so happy. Scrot in Linux


 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.