Compile and install PHP in ubuntu.

Source: Internet
Author: User
PHP compilation and installation in ubuntu-let's talk about how to obtain the php source code and solve the pressure.

The compilation parameters are:

. /Configure -- prefix =/opt/php -- with-bz2 -- with-mcrypt -- with-mhash -- with-openssl -- with-pdo-mysql -- with-pdo-pgsql -- with-mysqli -- with-pgsql -- enable-calendar -- with-gettext -- with-iconv -- enable-mbstring -- with-pspell -- enable-exif -- with-gd -- with-png-dir =/opt /php -- with-jpeg-dir =/opt/php -- with-imap -- enable-bcmath -- with-gmp -- enable-pcntl -- enable-sysvshm -- enable-shmop --- tidy -- with-curl -- enable-ftp -- with-ldap -- enable-sockets -- enable-fpm -- enable-soap -- with-xmlrpc -- enable-wddx -- with-xsl --- kerberos -- with-imap-ssl

The value of the -- prefix parameter specifies the php installation path. If this parameter is not specified, the php files will be scattered in various places after installation, which is not conducive to management, all php files stored in the specified path are stored in the specified path. All other parameters can be found in the php Manual. you only need to view the required parameters by referring to the installation instructions for each extension in the function reference section. These parameters can be increased or decreased as needed. If you need to add an extension later, you only need to add new extension parameters to the original parameters and re-compile and install them (as long as the -- prefix parameter location remains unchanged, you can overwrite the previously installed php ).

After compilation, run the make command. after the make command is executed, run the sudo make install command to install it.

During the installation process, you may encounter various problems, such as missing dependency packages. The problems encountered during the installation process are as follows:

Configure: error: utf8_mime2text () has new signature, but U8T_CANONICAL is missing. This shocould not happen. Check config. log for additional information

Solution: apt-get install libc-client2007e-dev

Configure: error: Cannot find ldap libraries in/usr/lib.

Solution: ln-fs/usr/lib/x86_64-linux-gnu/libldap. so/usr/lib/

Configure: error: mcrypt. h not found. Please reinstall libmcrypt.

Solution: sudo apt-get install libmcrypt-dev

CONFIGURE: ERROR: cannot find LIBPQ-FE.H. PLEASE SPECIFY CORRECT POSTGRESQL INSTALLATION PATH

Solution: sudo apt-get install postgresql-server-dev-9.5

Configure: error: Cannot find pspell

Solution: sudo apt-get install libpspell-dev

Configure: error: Cannot find libtidy

Solution: sudo apt-get install libtidy-dev

Configure: error: xslt-config not found. Please reinstall the libxslt> = 1.1.0 distribution

Solution: sudo apt-get install libxslt1-dev

/Usr/bin/ld: ext/ldap/. libs/ldap. o: undefined reference to symbol 'ber _ strdup @ OPENLDAP_2.4_2'

/Usr/lib/x86_64-linux-gnu/liblber-2.4.so.2: error adding symbols: DSO missing from command line

Collect2: error: ld returned 1 exit status

Make: *** [sapi/cli/php] Error 1

Solution: Find the EXTRA_LIBS row (with many parameters) in the vim Makefile Directory of the PHP source code, add '-llber' at the end of the row, save and make again.

The above is only a part of the problems encountered, because I encountered some problems during the installation is not recorded, so currently only these problems, the next installation will be added.

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.