LAMP环境搭建二
LAMP环境搭建(补php)
- L 代表服务器操作系统使用Linux
- A 代表网站服务使用的是Apache软件基金会中的httpd的模块
- M 代表网站后台使用的数据库时MySQL数据库
- P 代表网站是使用PHP语言开发
三安装 PHP
编译安装
cd/usr/local/php-5.6.39
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/src/mysql-5.6.43-linux-glibc2.12-x86_64 --with-png-dir --with-freetype-dir --with-openssl --with-mcrypt --with-libxml-dir --with-gd --with-bz2 --with-iconv-dir --with-zlib-dir --enable-soap --enable-gd-native-ttf
上面依赖啥模块就自己手动安装啥模块
# yum install -y libxml2-devel
# yum install -y libpng libpng-devel
# yum install -y libmcrypt-devel
# yum install -y openssl openssl-devel
# yum install -y bzip2 bzip2-devel
# yum install -y freetype freetype-devel
# yum install -y epel-release
# cd/usr/local/php-5.6.39
编译安装
mask && make install
creating libtool
appending configuration tag “CXX” to libtool
Generating files
configure: creating ./config.status
creating main/internal_functions.c
creating main/internal_functions_cli.c
±-------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
±-------------------------------------------------------------------+
Thank you for using PHP.
config.status: creating php5.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/cgi/php-cgi.1
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands
configure: error: Cannot find MySQL header files under /usr/local/src/mysql-5.1.14-beta-linux-i686-glibc23/include/.
Note that the MySQL client library is not bundled anymore!
#/usr/local/apache2.4/bin/httpd –M
//若下面多了一条php5的模块,那就安装OK
查询php的相关信息:
#/usr/local/php/bin/php –i | less
#cat /usr/local/apache2.4/conf/httpd.conf
拷贝配置文件用于生产环境:
#cd /usr/local/php-5.6.39
#cp php.ini-production /usr/local/php/etc/php.ini
遇到错误
configure: error: Cannot find MySQL header files under /usr/local/src/mysql-5.1.14-beta-linux-i686-glibc23/include/.
Note that the MySQL client library is not bundled anymore!
解决方法
查看系统有没有安装mysql header
find / -name mysql.h
如果有。请指定–with-mysql=/跟正常路径。