LAMP环境搭建学习笔记2.docx
《LAMP环境搭建学习笔记2.docx》由会员分享,可在线阅读,更多相关《LAMP环境搭建学习笔记2.docx(10页珍藏版)》请在冰豆网上搜索。
![LAMP环境搭建学习笔记2.docx](https://file1.bdocx.com/fileroot1/2023-1/25/11c657c7-2956-4597-9319-acef363812af/11c657c7-2956-4597-9319-acef363812af1.gif)
LAMP环境搭建学习笔记2
安装
Centos6.4
zlib1.2.8
libpng1.6.9
jpegsrcv9a.
Freetype.2.5.3
apr-1.5.0
apr-util-1.5.3
gd2.44
libgd2.10
备注:
.xz解压tar.xz文件:
先xz-dxxx.tar.xz将xxx.tar.xz解压成xxx.tar然后,再用tarxvfxxx.tar来解包。
安装cmake2.8.12.2
安装Mysql5.6.16
#cmake-DMYSQL_DATADIR=/base/MySQL/data
-DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci
-DEXTRA_CHARSETS=all
-DMYSQL_UNIX_ADDR=/base/MySQL/socket
-DMYSQL_TCP_PORT=3306
-DMYSQL_USER=mysql
-DCMAKE_INSTALL_PREFIX=/base/MySQL
-DINSTALL_SBINDIR=bin
上面参数过于复杂
所以直接cmake.
make
makeinstall
默认安装路径/usr/local/mysql
groupaddmysql
useradd-gmysqlmysql
chown-Rmysql.mysql/usr/local/mysql
cd/usr/local/mysql/scripts
./mysql_install_db–user=mysql--basedir=/usr/local/mysql–datadir=/usr/local/mysql/data
cd/usr/local/mysql/support-files
cpmysql.server/etc/rc.d/init.d/mysql
cpmy-f/etc/f
chkconfig-addmysql
chkconfigmysqlon
servicemysqlstart
mysql
安装httpd2.4.7
./configure--prefix=/usr/local/apache2--enable-lib64--libdir=/usr/lib64--enable-so--enable-deflate=shared--enable-expires=shared--enable-rewrite=shared--enable-mods-shared=all--enable-modules=all--enable-static-support--with-z=/usr/local/zlib--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util--with-included-apr--with-pcre=/usr/local/pcre--enable-cache--enable-disk-cache--enable-mem-cache--enable-file-cache
make
makeinstall
cd/usr/local/apache2
cdbin
./apachectl-t
./apchectlstart
成功
安装libxml2-2.9.1
./configure–prefix=/usr/local/libxml
make
make[4]:
***[libxml.lo]错误1
make[4]:
Leavingdirectory`/root/libxml2-2.9.1/python'
make[3]:
***[all-recursive]错误1
make[3]:
Leavingdirectory`/root/libxml2-2.9.1/python'
make[2]:
***[all]错误2
make[2]:
Leavingdirectory`/root/libxml2-2.9.1/python'
make[1]:
***[all-recursive]错误1
make[1]:
Leavingdirectory`/root/libxml2-2.9.1'
make:
***[all]错误2
makeclean
重装
试验./configure
依旧出错
再重装
安装libtool
libtool-2.4.tar.gz
依旧出错
安装libiconv1.14
依旧出错
安装apr-iconv-1.2.1
依旧出错
跳过
直接安装libmcrypt-2.5.7
再次重装libxml
./configure--prefix=/usr/local/libxml2--disable-static--with-history--with-python--with-modules--disable-shared–with-pic
make
错误依旧
安装python-2.7.5.tar.bz2
tarxvfpython-2.7.5.tar.bz2
cdpython-2.7.5
./configure–prefix=/usr/local/python
make
makeinstall
重新编译libxml
./configure--prefix=/usr/local/libxml2--disable-static--with-history
make
仍旧出错
下载
Python-2.7.6
xz-dPython-2.7.6.tar.xz
tarxvfPython-2.7.6.tar
cdPython-2.7.6
./configure--prefix=/usr\
--enable-shared\
--with-system-expat\
--with-system-ffi\
--enable-unicode=ucs4&&
make
makeinstall
继续重新编译libxml
./configure–prefix=/usr/local/libxml2–with-python=/usr/local/python
make
makeinstall
通过
安装mhash0.9.9.9
下载curl-7.35.0.tar.gz安装
安装php-5.5.10
./configure--prefix=/usr/local/php--with-config-file-path=/usr/local/php/etc/--with-apxs2=/usr/local/apache2/bin/apxs--with-mysql=/usr/local/mysql--with-mysqli=/usr/local/mysql/bin/mysql_config--with-iconv-dir=/usr/local/libiconv--with-freetype-dir=/usr/local/freetype/--with-jpeg-dir=/usr/local/jpeg9/--with-png-dir=/usr/local/libpng/--with-zlib-dir=/usr/local/zlib/--with-libxml-dir=/usr/local/libxml2/--enable-xml--enable-mbstring--enable-ftp--with-gd=/usr/local/gd2/--with-mhash=/usr/local/libmhash--without-pear--enable-sockets--enable-soap--enable-gd-native-ttf--enable-sysvsem--enable-sysvshm--enable-shmop--enable-zip--with-mcrypt=/usr/local/libmcrypt/--with-pcre-regex=/usr/local/pcre--enable-bcmath--with-curl=/usr/local/curl--enable-mbregex--with-openssl
出错
/root/php-5.5.10/ext/gd/gd.c:
57:
22:
错误:
X11/xpm.h:
没有那个文件或目录
make:
***[ext/gd/gd.lo]错误1
重新编译GD
重新编译php
错误依旧
下载libxpm-3.5.9.tar.gz
yuminstalllibxpm-develop
重新编译PHP
/root/php-5.5.10/ext/gd/gd.c:
1330:
undefinedreferenceto`XpmLibraryVersion'
collect2:
ldreturned1exitstatus
make:
***[sapi/cli/php]错误1
makeclean
makeZEND_EXTRA_LIBS='-liconv'
make:
***[libphp5.la]错误1
yuminstalllibtool-ltdl-devel
yuminstalllibtool
重新编译PHP
依旧出错
cd/usr/loal/mysql
ln-slibmysqlclient.so.15.0.0libmysqlclient_r.so
出错/usr/bin/ld:
cannotfind-liconv
collect2:
ldreturned1exitstatus
make:
***[libphp5.la]错误
将--with-iconv-dir=/usr/local/libiconv去掉重新编译
./configure--prefix=/usr/local/php--with-config-file-path=/usr/local/php/etc/--with-apxs2=/usr/local/apache2/bin/apxs--with-mysql=/usr/local/mysql--with-mysqli=/usr/local/mysql/bin/mysql_config--with-iconv-dir=/usr/local/libiconv--with-freetype-dir=/usr/local/freetype/--with-jpeg-dir=/usr/local/jpeg9/--with-png-dir=/usr/local/libpng/--with-zlib-dir=/usr/local/zlib/--with-libxml-dir=/usr/local/libxml2/--enable-xml--enable-mbstring--enable-ftp--with-gd=/usr/local/gd2/--with-mhash=/usr/local/libmhash--without-pear--enable-sockets--enable-soap--enable-gd-native-ttf--enable-sysvsem--enable-sysvshm--enable-shmop--enable-zip--with-mcrypt=/usr/local/libmcrypt/--with-pcre-regex=/usr/local/pcre--enable-bcmath--with-curl=/usr/local/curl--enable-mbregex--with-openssl
make
错误依旧
重装libiconv
/usr/bin/ld:
cannotfind-liconv
collect2:
ldreturned1exitstatus
make:
***[libphp5.la]错误1
今天编译程序遇到:
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld:
cannotfind-lxml2
网上查询,记录如下:
解决/usr/bin/ld:
cannotfind-lxxx问题
问题:
在linux环境编译应用程式或lib的sourcecode时常常会出现如下的错误讯息:
/usr/bin/ld:
cannotfind-lxxx
这些讯息会随着编译不同类型的sourcecode而有不同的结果出来如:
/usr/bin/ld:
cannotfind-lc
/usr/bin/ld:
cannotfind-lltdl
/usr/bin/ld:
cannotfind-lXtst
其中xxx即表示函式库文件名称,如上例的:
libc.so、libltdl.so、libXtst.so。
其命名规则是:
lib+库名(即xxx)+.so。
会发生这样的原因有以下三种情形:
1系统没有安装相对应的lib
2相对应的lib版本不对
3lib(.so档)的symboliclink不正确,没有连结到正确的函式库文件(.so)
解决方法:
(1)先判断在/usr/lib下的相对应的函式库文件(.so)的symboliclink是否正确,若不正确改成正确的连结目标即可解决问题。
(2)若不是symboliclink的问题引起,而是系统缺少相对应的lib安装lib即可解决。
(3)如何安装缺少的lib:
以上面三个错误讯息为例:
错误1缺少libc的LIB
错误2缺少libltdl的LIB
错误3缺少libXtst的LIB
以Ubuntu为例:
先搜寻相对应的LIB再进行安装的作业如:
apt-cachesearchlibc-dev
apt-cachesearchlibltdl-dev
apt-cachesearchlibXtst-dev
实例:
在进行输入法gcin的SourceCode的编译时出现以下的错误讯息:
/usr/bin/ld:
cannotfind-lXtst
经检查后发现是:
lib(.so档)的symboliclink不正确
解决方法如下:
cd/usr/lib
ln-slibXtst.so.6libXtst.so
如果在/usr/lib的目录下找不到libXtst.so档,那么就表示系统没有安装libXtst的函式库。
解法如下:
apt-getinstalllibxtst-dev
出错
/root/php-5.5.10/ext/gd/gd.c:
1330:
undefinedreferenceto`XpmLibraryVersion'
collect2:
ldreturned1exitstatus
make:
***[sapi/cli/php]错误1
rpm-qllibxpm查找软件安装的路径
显示为
/usr/lib64/libXpm.so.4
/usr/lib64/libXpm.so.4.11.0
/usr/share/doc/libXpm-3.5.10
/usr/share/doc/libXpm-3.5.10/AUTHORS
/usr/share/doc/libXpm-3.5.10/COPYING
/usr/share/doc/libXpm-3.5.10/ChangeLog
./configure--prefix=/usr/local/php--with-config-file-path=/usr/local/php/etc/--with-apxs2=/usr/local/apache2/bin/apxs--with-mysql=/usr/local/mysql--with-mysqli=/usr/local/mysql/bin/mysql_config--with-iconv-dir=/usr/local/libiconv--with-freetype-dir=/usr/local/freetype/--with-jpeg-dir=/usr/local/jpeg9/--with-png-dir=/usr/local/libpng/--with-zlib-dir=/usr/local/zlib/--with-libxml-dir=/usr/local/libxml2/--enable-xml--enable-mbstring--enable-ftp--with-gd=/usr/local/gd2/--with-mhash=/usr/local/libmhash--without-pear--enable-sockets--enable-soap--enable-gd-native-ttf--enable-sysvsem--enable-sysvshm--enable-shmop--enable-zip--with-mcrypt=/usr/local/libmcrypt/--with-pcre-regex=/usr/local/pcre--enable-bcmath--with-curl=/usr/local/curl--enable-mbregex--with-openssl–with-xpm-dir=/sur/share/doc/libXpm-3.5.10
makeZEND_EXTRA_LIBS='-liconv'
出错
Generatingphar.php
/root/php-5.5.10/sapi/cli/php:
errorwhileloadingsharedlibraries:
libiconv.so.2:
cannotopensharedobjectfile:
Nosuchfileordirectory
make:
***[ext/phar/phar.php]错误127
viMakefile
在安裝PHP到系统中时要是发生「undefinedreferencetolibiconv_open'」之类的错误信息,那表示在「./configure」沒抓好一些环境变数值。
错误发生点在建立「-osapi/cli/php」是出错,没給到要link的iconv函式库参数。
解决方法:
编辑Makefile大约77行左右的地方:
EXTRA_LIBS=.....-lcrypt在最后加上-liconv,例如:
EXTRA_LIBS=.....-lcrypt-liconv然后重新再次make即可。
makeclean
make
出错
/root/php-5.5.10/sapi/cli/php:
errorwhileloadingsharedlibraries:
libiconv.so.2:
cannotopensharedobjectfile:
Nosuchfileordirectory
make:
***[ext/phar/phar.php]错误127
rpm-qllibiconv
显示packagelibiconvisnotinstalled
重新安装
libiconv
给libiconv.so.2做个软件链接
ln-s/usr/local/libiconv/lib/libiconv.so.2/usr/lib/libiconv.so.2
make
通过
makeinstalll
InstallingPHPCLImanpage:
/usr/local/php/php/man/man1/
cp:
cannotstat`sapi/cli/php.1':
Nosuchfileordirectory
make:
***[install-cli]错误1
Libmcrypt
#tarzxvflibmcrypt-2.5.8.tar.gz
#cdlibmcrypt-2.5.8
#./configure
#make
#makeinstall
#/sbin/ldconfig
#cdlibltdl/
#./configure--enable-ltdl-install
#make
#makeinstall
#cd/usr/local/src/
从上面第六行开始做
下载mcrypt
yuminstalllibxslt-devel
makeZEND_EXTRA_LIBS='-liconv'
makeinstall
错误依旧
./configure--prefix=/usr/local/php--with-config-file-path=/usr/local/php/etc/--with-apxs2=/usr/local/apache2/bin/apxs--with-mysql=/usr/local/mysql--with-mysqli=/usr/local/mysql/bin/mysql_config--with-iconv-dir=/usr/local/libiconv--with-freetype-dir=/usr/local/freetype/--with-jpeg-dir=/usr/local/jpeg9/--with-png-dir=/usr/local/libpng/--with-zlib-dir=/usr/local/zlib/--with-libxml-dir=/usr/local/libxml2/--enable-xml--enable-mbstring--enable-ftp--with-gd=/usr/local/gd2/--with-mhash=/usr/local/libmhash--without-pear--enable-sockets--enable-soap--enable-gd-native-ttf--enable-sysvsem--enable-sysvshm--enable-shmop--enable-zip--with-mcrypt=/usr/local/libmcrypt/--with-pcre-regex=/usr/local/pcre--enable-bcmath--with-curl=/usr/local/curl--enable-mbregex--with-openssl–with-xpm-dir=/sur/share/doc/libXpm-3.5.10--enable-cli–enable-cgi--enable-opcache=no
makeZEND_EXTRA_LIBS='-liconv'
makeinstall
成功编译
cd/usr/local/apac