Home>Article>Backend Development> linux centOS5 build lamp environment

linux centOS5 build lamp environment

不言
不言 Original
2018-04-14 16:21:51 1485browse


(Reference Document)https://help.aliyun.com/document_detail/50774.html

Compile and install PHP

1. Download php7

cd /usr/local/src/

wget -O php7.tar.gz http://cn2.php.net/get/php-7.1.1.tar.gz/from/this/mirror

2. Unzip PHP7

tar -xvf php7.tar.gz

3. Enter the PHP source file directory

cd php-7.0.4

4. Install dependency packages

yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel

5. Compile configuration

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc/--enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-soap --with-libxml -dir --with-xmlrpc --with-openssl --with-mcrypt --with-mhash --with-pcre-regex --with-sqlite3 --with-zlib --enable-bcmath --with-iconv - -with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --with-pcre-dir --enable- ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring --enable-mbregex --enable-mbregex-backtrack --with- libmbfl --with-onig --enable-pdo --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-zlib-dir --with-pdo-sqlite --with-readline --enable- session --enable-shmop --enable-simplexml --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl -- enable-zip --enable-mysqlnd-compression-support --with-pear --enable-opcache--with-apxs2=/usr/local/apache/bin/apxs

Note:--with-apxs2=/usr/local/apache/bin/apxsMake sure otherwise apache cannot recognize PHP

6. Compile and install

make && make install

7. Configure environment variables

vi /etc/profile

Append

PATH=$PATH:/usr/local/php at the end /bin

export PATH

Execute the command and it will take effect immediately

source /etc/profile


Modify the Apache configuration ( Allow Apache to compile PHP files)

Append the following code to the configuration file httpd.conf

AddType application/x-httpd-php .php

AddType application/x-httpd -php-source .phps

Locate DirectoryIndex and add index.php


Restart Apache


##Note: Startup report

httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

#vim /web/apache/conf /httpd.conf (here/web/apahce is the directory where I installed apache. If you install it by default, it should be /usr/local/apache2/icons)


Find #ServerName www.example.com:80 Remove # and restart apache and everything will be fine.


Phenomenon:


##bogon:~/webserver/ httpd-2.0.59 # /usr/local/apache2/bin/apachectl start

httpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

httpd (pid 20183) already running


This problem should not be in /etc/httpd/conf/ Set ServerName in httpd.conf


vi /usr/local/apache2/conf/httpd.conf


The simplest way is to modify the httpd.conf file and add:

ServerName www.example.com:80

Mine changed to:


ServerName localhost:80



Start again and it will be normal!

The above is the detailed content of linux centOS5 build lamp environment. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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
Previous article:Using PHP Strategy Pattern Next article:Using PHP Strategy Pattern