search

Home  >  Q&A  >  body text

How to configure ./configure when compiling PHP under Linux?

./configure --enable-curl
./configure --with-curl
1. What is the difference between enable and with parameter commands?
2. How to compile the extension into php instead of existing in the form of .so dynamic extension?
3. Which extensions are officially supported by PHP? Are the ones in the ext directory of the PHP source code package officially supported by PHP? Can it be compiled into php?
4. What command is used to compile the officially supported extensions into php?

What should I do if I need to configure memcached extension? I already know how to add modules specifically. What I want to know now is whether I can add them directly when compiling php? Will it automatically download the required third-party installation package for me?
If I need to support laravel5.5, how do I need to compile php when I install php?

迷茫迷茫2811 days ago714

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-05-16 13:05:51

    Specify the php installation directory

    --prefix=/usr/local/php

    Integrate apache. The function of apxs is to use the LoadModule instruction in mod_so to load the specified module into apache and require apache to open the SO module

    --with-apxs2=/usr/local/apache/bin/apxs

    Specify php.ini location

    --with-config-file-path=/usr/local/php/etc               

    mysql installation directory, support for mysql

    --with-MySQL=/usr/local/mysql

    Mysqli extension technology can not only call MySQL stored procedures and process MySQL transactions, but also make accessing the database more stable.

    --with-mysqli=/usr/local/mysql/bin/mysql_config            

    Turn on safe mode

    --enable-safe-mode    

    Turn on ftp support

    --enable-ftp    

    Turn on support for zip

    --enable-zip    

    Turn on support for bz2 files

    --with-bz2            

    Turn on support for jpeg images

    --with-jpeg-dir    
    Configuration Instructions
    --with-png-dir Turn on support for png images
    --with-freetype-dir Open support for freetype font library
    --without-iconv Close the iconv function to convert between character sets
    --with-libXML-dir Turn on support for libxml2 library
    --with-XMLrpc Open the c language of xml-rpc
    --with-zlib-dir Turn on zlib library support
    --with-gd Turn on gd library support
    --enable-gd-native-ttf Support TrueType string function library
    --with-curl Turn on curl browsing tool support
    --with-curlwrappers Use curl tool to open url stream
    --with-ttf Enable freetype1.* support, you don’t need to add it
    --with-xsl Open XSLT file support, extended libXML2 library, requires libxslt software
    --with-gettext Enable gnu’s gettext support, which is used by the coding library
    --with-pear Enable support for pear command, used for PHP extension
    --enable-calendar Open calendar extension
    --enable-mbstring Multi-byte, string support
    --enable-bcmath Open image size adjustment, this module is used when using zabbix monitoring
    --enable-sockets Turn on sockets support
    --enable-exif Image metadata support
    --enable-magic-quotes Magic Quotes Support
    --disable-rpath Close additional runtime files
    --disable-debug Turn off debug mode
    --with-mime-magic=/usr/share/file/magic.mime Magic header file location

    Parameters only used for CGI installation

    Configuration Instructions
    --enable-fpm This parameter is only available after applying the PHP-fpm patch, the startup program installed by CGI
    --enable-fastCGI Support fastcgi mode to start PHP
    --enable-force-CGI-redirect Start PHP with redirection
    --with-ncurses A dynamic library that supports ncurses screen drawing and text terminal-based graphical interaction functions
    --enable-pcntl freeTDS needs to be used, it may be used to link mssql

    Extensions to mhash and mcrypt algorithms

    Configuration Instructions
    --with-mcrypt Algorithm

    --with-mhash | Algorithm

    After Mysql compiles the Mysql development library, you don’t need to specify the path to mysql.

    PHP compilation has basic dependencies. To compile PHP, you first need to install the XML extension, because the php5 core has XML support turned on by default. Other basic libraries require the following:

    GD -> zlib, Png, Jpg, if you need to support others, you still need to compile the extension library according to the actual situation. The ttf library needs the support of the freetype library.

    --enable-magic-quotes is an extremely not recommended parameter. Of course, if you need PHP to do the underlying work for you, it actually does not solve the problem very thoroughly.

    --with-openssl, requires openssl library.

    mysqli is a MySQL driver provided by the MySQL team and has many practical functions and typical features. However, it is not the best choice for MySQL on the PHP platform. PDO has been proven to be a simple, high-concurrency, and easy-to-create and recycle standard interface. However, PDO also experienced memory overflow problems before 5.3. After 5.3, when reading Oracle's LOB resources, if the memory is not restricted, memory overflow will still occur.

    If it is product mode, it is not recommended to use pear, shmop, ftp, etc. What they want to do is using C/C++, Java, or even other scripting languages. There are good and fast options, no need to be limited to Use PHP to implement it. Unfamiliar class libraries and libraries that are not commonly used are not recommended. Magic-quote, session.auto_start, PHP server information, PHP error information, etc. should be closed as soon as possible after compilation is completed to avoid exposing server information.

    The Web Server mode corresponding to PHP only requires one of Module, fastcgi, and fpm. The server is not your experimental field. Fastcgi can choose Nginx and lighttpd. In fact, Nginx also uses lighttpd's spwan-fcgi for fcgi process management. fpm uses PHP itself to manage multiple processes, somewhat similar to a back-end proxy. Regardless of the mode, when releasing a product server, process and thread tuning should be done, and enough stress testing should be done to find the best combination of process numbers.

    Choose a PHP OPCode cache extension. This is also very important. Under Linux 2.6 core and fcgi, xcache has good practical experience. Others will have serious performance degradation after the number of concurrency increases.

    If you really want to experience it, you would rather compile several PHP versions than collect various extensions for one version of PHP to adapt to various environments. This will put yourself in a dilemma

    reply
    0
  • Cancelreply