Home php教程 php手册 centos64位lamp配置第三步:编译php5.3.27

centos64位lamp配置第三步:编译php5.3.27

Jun 06, 2016 pm 08:02 PM
lamp compile Configuration

下载php-5.3.27.tar.gz,解压tar -zxvf php-5.3.27,确保已经安装了yum -y install wget gcc-c ncurses ncurses-devel cmake make perl bison openssl openssl-devel gcc* libevent libevent-devel libxml2 libxml2-devel libmcrypt libmcrypt-devel curl-deve

下载php-5.3.27.tar.gz,解压tar -zxvf php-5.3.27,确保已经安装了yum -y install wget gcc-c++ ncurses ncurses-devel cmake make perl bison openssl openssl-devel gcc* libevent libevent-devel libxml2 libxml2-devel  libmcrypt libmcrypt-devel curl-devel libpng-devel libtool-ltdl-devel libjpeg* libpng* freetype* zlib zlib-devel openldap openldap-devel libxslt-devel* bzip2-devel

执行:cp -frp /usr/lib64/libldap* /usr/lib/

安装mhash:

# tar zxvf mhash-0.9.9.tar.gz<br> # cd mhash-0.9.9

# mkdir -p /usr/local/mhash<br> # ./configure prefix=/usr/local/mhash<br> # make && make install<br>

安装libmcrpt:

wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz<br>

tar -zxvf libmcrypt-2.5.7.tar.gz <br> cd libmcrypt-2.5.7 <br> mkdir -p /usr/local/libmcrytp <br> ./configure prefix=/usr/local/libmcrytp/   #默认也可以<br> make<br> make install <br>

这些准备环境。

<br>

进入php-5.3.27目录,执行./configure,如果是在nginx之前编译,要去掉

<span><strong>--with-apxs2=/usr/local/apache/bin/apxs,--with-iconv=/usr/local/libiconv改为--with-iconv</strong></span>
Copy after login
:
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-openssl --with-zlib --with-bz2 --with-gettext --with-mhash --with-mcrypt --with-iconv=/usr/local/libiconv --with-curl --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-pdo --enable-gd-native-ttf --enable-bcmath --enable-mbstring --enable-zip --enable-soap --enable-sockets --enable-ftp --without-pear --enable-fpm --enable-inline-optimization
Copy after login
<br>

下面是参考:

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-iconv-dir=/usr/local/libiconv --with-libxml-dir=/usr --enable-xml --with-curl --with-curlwrappers --with-mhash --with-mcrypt=/usr/local/libmcrytp --with-gd --enable-gd-native-ttf --with-xsl --with-openssl --with-ldap --with-ldap-sasl --with-xmlrpc --without-pear --with-plugins=innobase --without-debug --with-charset=utf8 --with-collation=utf8_unicode_ci --with-extra-charsets=utf8 --with-pthread --enable-static --enable-safe-mode --enable-thread-safe-client --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --enable-thread-safe-client --with-mysqld-user=mysql --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-pdo --with-big-tables --without-debug --with-jpeg-dir=/usr/lib --with-png-dir --with-freetype-dir --with-zlib --enable-mbstring --with-pear --enable-mbregex --enable-zend-multibyte --enable-sockets --enable-soap --enable-exif --with-mhash=/usr/local/mhash --with-apxs2=/usr/local/apache/bin/apxs --enable-fpm --enable-inline-optimization<br>

完成后会看到thank you for use php字样

  make

make install

没有出现error就ok了。

cp php.ini-production /usr/local/php/etc/php.ini

sed -i 's/;date.timezone =/date.timezone = Asia\/Shanghai/g' /usr/local/php/etc/php.ini<br> sed -i 's/short_open_tag = Off/short_open_tag = On/g' /usr/local/php/etc/php.ini<br> sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /usr/local/php/etc/php.ini<br> sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 50M/g' /usr/local/php/etc/php.ini<br> sed -i '262i output_buffering = On' /usr/local/php/etc/php.ini<br>

配置php-fpm:

cp sapi/fpm/init.d.php-fpm  /etc/rc.d/init.d/php-fpm

chmod +x /etc/init.d/php-fpm

chkconfig --add php-fpm

chkconfig php-fpm on

<br>

# cd /usr/local/php/etc/

# cp php-fpm.conf.default php-fpm.conf

# vi php-fpm.conf    //一般配置的依据如下

内存小于4G服务器(值可逐级递减):

修改如下参数:

pm=dynamic

pm.max_children=40

pm.start_servers=10

pm.min_spare_servers=10

pm.max_spare_servers=40

 ******************************

内存大于4G服务器(值可逐级递增):

修改如下参数:

pm=static

pm.max_children=100

<br>

<br>

安装pdo-mysql:

tar zxvf PDO_MYSQL-1.0.2.tgz<br> cd PDO_MYSQL-1.0.2/<br> /usr/local/php/bin/phpize<br> ./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql<br> make && make install<br>

修改Php.ini:

extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/"<br> extension = "pdo_mysql.so"<br>

 service php-fpm start<br>

  vim /usr/local/apache/conf/httpd.conf

查找AddType

添加:AddType application/x-httpd-php .php

查找DirectoryIndex,在DirectoryIndex后面添加index.php

DirectoryIndex index.php index.html

        查找:LoadModule php5_module modules/libphp5.so

        如果没有就添加,使用phpinfo()测试,能输出php信息就ok了。

        

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

The perfect combination of PyCharm and PyTorch: detailed installation and configuration steps The perfect combination of PyCharm and PyTorch: detailed installation and configuration steps Feb 21, 2024 pm 12:00 PM

PyCharm is a powerful integrated development environment (IDE), and PyTorch is a popular open source framework in the field of deep learning. In the field of machine learning and deep learning, using PyCharm and PyTorch for development can greatly improve development efficiency and code quality. This article will introduce in detail how to install and configure PyTorch in PyCharm, and attach specific code examples to help readers better utilize the powerful functions of these two. Step 1: Install PyCharm and Python

The working principle and configuration method of GDM in Linux system The working principle and configuration method of GDM in Linux system Mar 01, 2024 pm 06:36 PM

Title: The working principle and configuration method of GDM in Linux systems In Linux operating systems, GDM (GNOMEDisplayManager) is a common display manager used to control graphical user interface (GUI) login and user session management. This article will introduce the working principle and configuration method of GDM, as well as provide specific code examples. 1. Working principle of GDM GDM is the display manager in the GNOME desktop environment. It is responsible for starting the X server and providing the login interface. The user enters

Understand Linux Bashrc: functions, configuration and usage Understand Linux Bashrc: functions, configuration and usage Mar 20, 2024 pm 03:30 PM

Understanding Linux Bashrc: Function, Configuration and Usage In Linux systems, Bashrc (BourneAgainShellruncommands) is a very important configuration file, which contains various commands and settings that are automatically run when the system starts. The Bashrc file is usually located in the user's home directory and is a hidden file. Its function is to customize the Bashshell environment for the user. 1. Bashrc function setting environment

How to configure workgroup in win11 system How to configure workgroup in win11 system Feb 22, 2024 pm 09:50 PM

How to configure a workgroup in Win11 A workgroup is a way to connect multiple computers in a local area network, which allows files, printers, and other resources to be shared between computers. In Win11 system, configuring a workgroup is very simple, just follow the steps below. Step 1: Open the "Settings" application. First, click the "Start" button of the Win11 system, and then select the "Settings" application in the pop-up menu. You can also use the shortcut "Win+I" to open "Settings". Step 2: Select "System" In the Settings app, you will see multiple options. Please click the "System" option to enter the system settings page. Step 3: Select "About" In the "System" settings page, you will see multiple sub-options. Please click

How to configure and install FTPS in Linux system How to configure and install FTPS in Linux system Mar 20, 2024 pm 02:03 PM

Title: How to configure and install FTPS in Linux system, specific code examples are required. In Linux system, FTPS is a secure file transfer protocol. Compared with FTP, FTPS encrypts the transmitted data through TLS/SSL protocol, which improves Security of data transmission. In this article, we will introduce how to configure and install FTPS in a Linux system and provide specific code examples. Step 1: Install vsftpd Open the terminal and enter the following command to install vsftpd: sudo

MyBatis Generator configuration parameter interpretation and best practices MyBatis Generator configuration parameter interpretation and best practices Feb 23, 2024 am 09:51 AM

MyBatisGenerator is a code generation tool officially provided by MyBatis, which can help developers quickly generate JavaBeans, Mapper interfaces and XML mapping files that conform to the database table structure. In the process of using MyBatisGenerator for code generation, the setting of configuration parameters is crucial. This article will start from the perspective of configuration parameters and deeply explore the functions of MyBatisGenerator.

Flask installation and configuration tutorial: a tool to easily build Python web applications Flask installation and configuration tutorial: a tool to easily build Python web applications Feb 20, 2024 pm 11:12 PM

Flask installation and configuration tutorial: A tool to easily build Python Web applications, specific code examples are required. Introduction: With the increasing popularity of Python, Web development has become one of the necessary skills for Python programmers. To carry out web development in Python, we need to choose a suitable web framework. Among the many Python Web frameworks, Flask is a simple, easy-to-use and flexible framework that is favored by developers. This article will introduce the installation of Flask framework,

How to install and configure DRBD on CentOS7 system? Tutorial on implementing high availability and data redundancy! How to install and configure DRBD on CentOS7 system? Tutorial on implementing high availability and data redundancy! Feb 22, 2024 pm 02:13 PM

DRBD (DistributedReplicatedBlockDevice) is an open source solution for achieving data redundancy and high availability. Here is the tutorial to install and configure DRBD on CentOS7 system: Install DRBD: Open a terminal and log in to the CentOS7 system as administrator. Run the following command to install the DRBD package: sudoyuminstalldrbd Configure DRBD: Edit the DRBD configuration file (usually located in the /etc/drbd.d directory) to configure the settings for DRBD resources. For example, you can define the IP addresses, ports, and devices of the primary node and backup node. Make sure there is a network connection between the primary node and the backup node.

See all articles