CentOS PHP-5.4.8 build and installation experience, centosphp-5.4.8

Source: Internet
Author: User
Tags ereg spl zts

CentOS PHP-5.4.8 build and installation experience, centosphp-5.4.8

1. download version 5.4.8

[Root @ Test data] wget http://museum.php.net/php5/php-5.4.8.tar.gz

2. Extract

[Root @ Test php-5.4.8] # tar xzf php-5.4.8.tar.gz

3. Compile and install

[Root @ Test php-5.4.8] # cd php-5.4.8

[Root @ Test php-5.4.8] #./configure -- prefix =/data/application/php & make install

By default, the path of the configuration file after installation is:

[Root @ Test php-5.4.8] # cd/data/application/php/

[Root @ Testphp php] # ll

Total 20

Drwxr-xr-x 2 root 4096 Mar 8 bin

Drwxr-xr-x 2 root 4096 Mar 8 etc

Drwxr-xr-x 3 root 4096 Mar 8 17: 27 include

Drwxr-xr-x 3 root 4096 Mar 8 lib

Drwxr-xr-x 3 root 4096 Mar 8 php

View the configuration file information loaded after installation

[Root @ Testphp php] # php -- ini

Configuration File (php. ini) Path:/data/application/php/lib

Loaded Configuration File: (none)

Scan for additional. ini files in: (none)

Additional. ini files parsed: (none)

By default, php. ini reads files in the/data/application/php/lib directory.

You can copy the/data/php-5.4.8/php. ini-production file to this directory to load the configuration file

[Root @ Testphp php] # cp-a/data/php-5.4.8/php. ini-production/data/application/php/lib/php. ini

[Root @ Testphp php] # php -- ini

Configuration File (php. ini) Path:/data/application/php/lib

Loaded Configuration File:/data/application/php/lib/php. ini

Scan for additional. ini files in: (none)

Additional. ini files parsed: (none)

Now you can see that the configuration file has been loaded normally. Check the default modules loaded by php.

[Root @ Testphp php] # php-m

[PHP Modules]

Core

Ctype

Date

Dom

Ereg

Fileinfo

Filter

Hash

Iconv

Json

Libxml

Pcre

PDO

Pdo_sqlite

Phar

Posix

Reflection

Session

SimpleXML

SPL

Sqlite3

Standard

Tokenizer

Xml

Xmlreader

Xmlwriter

[Zend Modules]

To install an unloaded module, follow these steps.

[Root @ Testphp php] # cd/data/php-5.4.8/ext/

We can see that there are many extensions. Take pcntl (php multi-process management module) as an example:

[Root @ Testphp ext] # cd pcntl

[Root @ Testphp php] #/data/application/php/bin/phpize

[Root @ Testphp php] #./configure -- with-php-config =/data/application/php/bin/php-config & make install

In this case, a pcntl. so file is generated, and the storage path is:

/Data/application/php/lib/php/extension/ no-debug-non-zts-20100525/pcntl. so

Edit/data/application/php/lib/php. ini

[Root @ Testphp php] # vim/data/application/php/lib/php. ini

Add two lines of Configuration:

Extension_dir = "/data/application/php/lib/php/extensions/no-debug-non-zts-20100525/" (if so, just put pcntl. so in this directory)

Extension = pcntl. so

View the module recorded in php again, and you can see that the newly installed pcntl has been loaded

[Root @ Testphp php] # php-m

[PHP Modules]

Core

Ctype

Date

Dom

Ereg

Fileinfo

Filter

Hash

Iconv

Json

Libxml

Pcntl

Pcre

PDO

Pdo_sqlite

Phar

Posix

Reflection

Session

SimpleXML

SPL

Sqlite3

Standard

Tokenizer

Xml

Xmlreader

Xmlwriter

[Zend Modules]

For other modules, you can refer to this solution. In particular, php. ini does not know include *. ini by default.

[Root @ Test php-5.4.8] #./configure -- help | grep scan

-- With-config-file-scan-dir = PATH

Set the path where to scan for configuration files

You can place additional configuration files in this directory. If no configuration file is specified, this is not loaded.

[Root @ Test php-5.4.8] # php -- ini

Configuration File (php. ini) Path:/data/application/php/lib

Loaded Configuration File:/data/application/php/lib/php. ini

Scan for additional. ini files in: (none)

Additional. ini files parsed: (none)

The following is the default configuration information for the YUM Installation Method on another machine.

[Root @ Test2 ~] # Php -- ini

Configuration File (php. ini) Path:/etc

Loaded Configuration File:/etc/php. ini

Scan for additional. ini files in:/etc/php. d

Additional. ini files parsed:/etc/php. d/bcmath. ini,

/Etc/php. d/curl. ini,

/Etc/php. d/dom. ini,

/Etc/php. d/fileinfo. ini,

/Etc/php. d/gd. ini,

/Etc/php. d/imap. ini,

/Etc/php. d/json. ini,

/Etc/php. d/ldap. ini,

/Etc/php. d/mbstring. ini,

/Etc/php. d/mcrypt. ini,

/Etc/php. d/mysql. ini,

/Etc/php. d/mysqli. ini,

/Etc/php. d/odbc. ini,

/Etc/php. d/pdo. ini,

/Etc/php. d/pdo_mysql.ini,

/Etc/php. d/pdo_odbc.ini,

/Etc/php. d/pdo_sqlite.ini,

/Etc/php. d/phar. ini,

/Etc/php. d/sqlite3.ini,

/Etc/php. d/wddx. ini,

/Etc/php. d/xmlreader. ini,

/Etc/php. d/xmlrpc. ini,

/Etc/php. d/xmlwriter. ini,

/Etc/php. d/xsl. ini,

/Etc/php. d/zip. ini

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.