LAMP apache2.4 + php5.5 + mysql5.5/6

可以安装就安装,安装不了往下走遇错在解决
yum groupinstall "Development tools" "Server Platform Development" -y
yum install pcre* -y
 yum  -y   install  wget  make zip  unzip patch autoconf   libjpeg  libjpeg-devel  libpng libpng-devel  freetype freetype-devel   libxml2  libxml2-devel  zlibzlib-devel   glibc  glibc-devel   glib2   glib2-devel  bzip2b   zip2-devel  ncurses  ncurses-develc

yum install -y make gcc gcc-c++ perl zlib-devel libaio libpng libpng-devel libjpeg-devel pcre-devel
yum install -y  libXpm-devel openssl openssl-devel libxml2-devel bzip2-devel.x86_64 libjpeg-turbo-devel
yum install -y  freetype freetype-devel libtool cmake ncurses-devel bison re2c curl-devel wget  perl*
rpm -ivh "http://mirrors.sohu.com/fedora-epel/epel-release-latest-6.noarch.rpm"
yum install -y libmcrypt-devel re2c

  yum install libxml2-devel  libjpeg-*  libpng-devel freetype-devel gd-devel libmcrypt-devel openssl-devel

yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers libevent libevent-devel

 http://blog.51cto.com/minitoo/1257698

安装Apache2.4

可以参考这个文章  https://www.cnblogs.com/MIC2016/p/7131204.html#_label0_0  或者https://www.cnblogs.com/c-night/p/8151663.html 或者https://blog.csdn.net/blueleaf21/article/details/54950688?utm_source=itdadao&utm_medium=referral  或者 https://blog.csdn.net/along602/article/details/42695779
wget http://mirror.bit.edu.cn/apache//httpd/httpd-2.4.28.tar.gz
wget http://archive.apache.org/dist/httpd/httpd-2.4.16.tar.gz
wget http://apache.etoak.com//httpd/httpd-2.4.1.tar.bz2               三个里面可以随便选一个
  wget http://archive.apache.org/dist/apr/apr-1.5.1.tar.gz
  wget https://mirrors.slackware.com/mb-sources/apr-util/apr-util-1.5.4.tar.bz2

  wget  http://nongnu.askapache.com/freetype/

wget  http://rpmfind.net/linux/rpm2html/search.php?query=libtool-ltdl-devel   这里面可以搜索或者是用源码安装

wget  http://exim.mirror.fr/pcre/
  which pcre
  wget http://exim.mirror.fr/pcre/pcre-8.36.tar.gz

tar -xf apr-1.5.1.tar.gz 
  517  cd apr-1.5.1
  518  ./configure --prefix=/usr/local/apr
  520  yum   install automake autoconf libtool  
  521  which libtool
  522  ./configure --prefix=/usr/local/apr
  523   yum install openssl-devel 
  526  tar -xf apr-1.5.1.tar.gz 
  527  cd apr-1.5.1
  529  vi configure
  530  ./configure --prefix=/usr/local/apr
  531  autoreconf --force --install
  532  libtoolize --automake --force
  533  automake --force --add-missing
  534  vi configure
  535  ./configure --prefix=/usr/local/apr 
  536  make
  537  make install
  538  vim /etc/profile
  539  source /etc/profile
  540  cd ..
  541  ls
  542  tar -xf apr-util-1.5.4.tar.bz2 
  543  cd apr-util-1.5.4
  544  ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
  545  make && make install
cd httpd-2.4.10
./configure –prefix=/usr/local/apache2 –with-apr=/usr/local/apr –with-apr-util=/usr/local/apr-util –with-pcre=/usr/local/pcre –enable-so –enable-rewrite
make && make install
cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
service httpd start

安装出现的问题

linux下安装libxml2,cannot remove `libtoolT': No such file or directory
安装 libxml2-2.9.0
./configure --prefix=/usr/localbxml2
出现问题:cannot remove `libtoolT': No such file or directory
网上说的方法可以具体一些吗?   参考解决文章 https://zhidao.baidu.com/question/1638333565022136300.html


解决这个方法

检查一下默认系统是有的:

[root@~ 15:18]#find / -name "libxml2*"
/usr/lib64/libxml2.so
/usr/lib64/libxml2.so.2
/usr/lib64/libxml2.so.2.7.6
/usr/share/doc/libxml2-devel-2.7.6
/usr/share/doc/libxml2-devel-2.7.6/libxml2-api.xml.gz
/usr/share/doc/libxml2-2.7.6

如果要手动安装:出现你的问题两个办法:(纠正下你的./configure --prefix=/usr/local/libxml2)

1,方法一,尝试过,可以。第二种没试了。

vim configure 找到17035行,方法是:vim configure 后,输入17035然后回车,找到

$RM “$cfgfile” ,移动光标到前面。按i然后,添加#号,或者dd这行,删除。

然后按Esc,再按: 输入wq,这样就可以了。

或者可以搜索一下?$RM直接定位到这段,操作如上。

 还要看一下这个文章 https://blog.csdn.net/hanzheng260561728/article/details/54019369

2,方法二,这样就可以继续安装。

#yum install automake autoconf libtool

# autoreconf --force --install
# libtoolize --automake --force
# automake --force --add-missing

rm: cannot remove `libtoolT': No such file or directory  来自https://blog.csdn.net/hanzheng260561728/article/details/54019369

环境依赖
yum -y install libtool autoconf automake

解决方法一
autoreconf --force --install

libtoolize --automake --force

automake --force --add-missing


解决方法二
cd apr-1.5.2
修改
vim configure
 9365 #RM=$ac_cv_prog_RM
 9355 #ac_cv_prog_RM="rm"


在重新编译,就OK了
cd apr-1.5.2
./configure --prefix=/usr/local/apr 
make

make install

安装mysql5.5

可以参考我mysql5.6的源码安装来安装   自己找

./scripts/mysql_install_db  --user=mysql

-bash: ./scripts/mysql_install_db: /usr/bin/perl: bad interpreter: No such file or directory  这个错误应该就是没有perl,当时用yum安装的时候,有不能安装上

wget http://www.cpan.org/src/5.0/perl-5.16.1.tar.gz    安装perl或者初始化数据库有报错的时候,可以参考这个文章    https://www.cnblogs.com/zhjh256/p/5728878.html

tar -xzf  perl-5.16.1.tar.gz   安装perl的文章  https://blog.csdn.net/wtwshui/article/details/79415799

 cd perl-5.16.1

./Configure -des -Dprefix=/usr/local/perl

make && make test && make install

perl -v

内容如下  防止文章会有时候不能打开

centos 7安装mysql报错-bash: ./scripts/mysql_install_db: /usr/bin/perl: bad interpreter: No such file or directory

[root@localhost mysql]# ./scripts/mysql_install_db  --user=mysql

-bash: ./scripts/mysql_install_db: /usr/bin/perl: bad interpreter: No such file or directory

貌似提示注释器错误,没有/usr/bin/perl文件或者档案,解决办法(安装perl跟perl-devel即可):

执行  yum -y install perl perl-devel

后在初始化数据库即可。

 bin/mysql_install_db 
FATAL ERROR: please install the following Perl modules before executing /usr/bin/mysql_install_db: 
Data::Dumper

yum install -y perl-Data-Dumper 即可。。

安装PHP


wget -c http://cn2.php.net/distributions/php-5.5.16.tar.gz

  tar -xf php-5.5.16.tar.gz
  cd php-5.5.16
./configure
--prefix=/usr/local/php
--with-config-file-path=/etc
--with-apxs2=/usr/local/apache/bin/apxs
--enable-inline-optimization
--disable-debug
--disable-rpath
--enable-shared
--enable-opcache
--enable-fpm
--with-fpm-user=www
--with-fpm-group=www
--with-mysql=mysqlnd
--with-mysqli=mysqlnd
--with-pdo-mysql=mysqlnd
--with-gettext
--enable-mbstring
--with-iconv
--with-mhash
--with-mcrypt
--with-openssl
--enable-bcmath
--enable-soap
--with-libxml-dir
--enable-pcntl
--enable-shmop
--enable-sysvmsg
--enable-sysvsem
--enable-sysvshm
--enable-sockets
--with-curl
--with-zlib
--enable-zip
--with-bz2
--with-gd 
--with-freetype-dir=/usr/local/freetype     #安装freestype的安装路径
--with-readline
--without-sqlite3
--without-pdo-sqlite
--with-pear
上面要是configure不能满足开发那边的需求的时候,就用下面的这个来做  最重要的是要参考这个网址  http://blog.51cto.com/minitoo/1257698
./configure
--prefix=/usr/local/php
--with-mysql 
--with-apxs2=/usr/local/apache/bin/apxs
--with-mysqli=/usr/local/mysql/bin/mysql_config 
--with-libxml-dir=/usr/local/libxml2/  
--with-png-dir=/usr/local/libpng 
--with-jpeg-dir=/usr/local/jpeg7 
--with-freetype-dir=/usr/local/freetype  
--with-gd 
--with-zlib=/usr/local/zlib/  
--with-mcrypt=/usr/local/libmcrypt
--enable-mbstring=all
--enable-sockets
--enable-soap 
--enable-shared 
--with-iconv
--with-pear
--with-pdo-mysql=mysqlnd
--enable-inline-optimization
--disable-debug
--disable-rpath
--enable-shared
--enable-opcache
--enable-fpm
--with-fpm-user=www
--with-fpm-group=www
--with-gettext
--enable-pcntl
--without-pdo-sqlite
--enable-shared
--enable-opcache
--enable-fpm
--enable-zip
--with-bz2
--with-curl
--with-openssl
--enable-bcmath
--with-mhash

--enable-shmop
--enable-sysvmsg
--enable-sysvsem
--enable-sysvshm
--with-readline
--without-sqlite3

make &&  make install

安装PHP5.5的时候./configure时的报错

    ext/gd/libgd/.libs/gdkanji.o: In function `do_convert':
    /var/soft/php-5.3.8/ext/gd/libgd/gdkanji.c:350: undefined reference to `libiconv_open'
    /var/soft/php-5.3.8/ext/gd/libgd/gdkanji.c:365: undefined reference to `libiconv'
    /var/soft/php-5.3.8/ext/gd/libgd/gdkanji.c:381: undefined reference to `libiconv_close'
    ext/iconv/.libs/iconv.o: In function `_php_iconv_strlen':
    /var/soft/php-5.3.8/ext/iconv/iconv.c:592: undefined reference to `libiconv_open'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:615: undefined reference to `libiconv'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:649: undefined reference to `libiconv_close'
    ext/iconv/.libs/iconv.o: In function `php_iconv_string':
    /var/soft/php-5.3.8/ext/iconv/iconv.c:430: undefined reference to `libiconv_open'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:442: undefined reference to `libiconv'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:456: undefined reference to `libiconv'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:467: undefined reference to `libiconv_close'
    ext/iconv/.libs/iconv.o: In function `_php_iconv_strpos':
    /var/soft/php-5.3.8/ext/iconv/iconv.c:840: undefined reference to `libiconv_open'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:868: undefined reference to `libiconv'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:982: undefined reference to `libiconv_close'
    ext/iconv/.libs/iconv.o: In function `_php_iconv_appendl':
    /var/soft/php-5.3.8/ext/iconv/iconv.c:337: undefined reference to `libiconv'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:374: undefined reference to `libiconv'
    ext/iconv/.libs/iconv.o: In function `_php_iconv_substr':
    /var/soft/php-5.3.8/ext/iconv/iconv.c:712: undefined reference to `libiconv_open'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:736: undefined reference to `libiconv'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:791: undefined reference to `libiconv_close'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:795: undefined reference to `libiconv_close'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:744: undefined reference to `libiconv_open'
    ext/iconv/.libs/iconv.o: In function `_php_iconv_mime_decode':
    /var/soft/php-5.3.8/ext/iconv/iconv.c:1342: undefined reference to `libiconv_open'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:1838: undefined reference to `libiconv_close'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:1841: undefined reference to `libiconv_close'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:1453: undefined reference to `libiconv_close'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:1456: undefined reference to `libiconv_open'
    ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_dtor':
    /var/soft/php-5.3.8/ext/iconv/iconv.c:2473: undefined reference to `libiconv_close'
    ext/iconv/.libs/iconv.o: In function `_php_iconv_mime_encode':
    /var/soft/php-5.3.8/ext/iconv/iconv.c:1032: undefined reference to `libiconv_open'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:1046: undefined reference to `libiconv_open'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:1304: undefined reference to `libiconv_close'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:1307: undefined reference to `libiconv_close'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:1165: undefined reference to `libiconv'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:1117: undefined reference to `libiconv'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:1149: undefined reference to `libiconv'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:1307: undefined reference to `libiconv_close'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:1217: undefined reference to `libiconv'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:1248: undefined reference to `libiconv'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:1291: undefined reference to `libiconv'
    ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_append_bucket':
    /var/soft/php-5.3.8/ext/iconv/iconv.c:2623: undefined reference to `libiconv'
    /var/soft/php-5.3.8/ext/iconv/iconv.c:2623: undefined reference to `libiconv'
    ext/iconv/.libs/iconv.o:/var/soft/php-5.3.8/ext/iconv/iconv.c:2545: more undefined references to `libiconv' follow
    ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_ctor':
    /var/soft/php-5.3.8/ext/iconv/iconv.c:2499: undefined reference to `libiconv_open'
    ext/xmlrpc/libxmlrpc/.libs/encodings.o: In function `convert':
    /var/soft/php-5.3.8/ext/xmlrpc/libxmlrpc/encodings.c:73: undefined reference to `libiconv_open'
    /var/soft/php-5.3.8/ext/xmlrpc/libxmlrpc/encodings.c:81: undefined reference to `libiconv'
    /var/soft/php-5.3.8/ext/xmlrpc/libxmlrpc/encodings.c:101: undefined reference to `libiconv_close'
    collect2: ld returned 1 exit status
    make: *** [sapi/fpm/php-fpm] 错误 1

解决办法   参考解决文章  https://blog.csdn.net/ikscher/article/details/51009584
 表面看,是libiconv安装问题,重装libiconv之后问题依旧,网上看有人舍弃libiconv,使用 --without-iconv,我觉的不可取,这样是回避问题。

找了n久,终于找到bug所在: 在执行完 ./configure ... 之后,修改下 Makefile,找到其中的
< View plain text >
  PHP
 

    EXTRA_LIBS = -lcrypt -lz -lcrypt -lrt -lmysqlclient -lmcrypt -lldap -llber -lfreetype -lpng -lz -ljpeg -lcurl -lz -lrt -lm -ldl -lnsl -lrt -lxml2 -lz -lm -lssl -lcrypto -ldl -lz -lcurl -ldl -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lidn -lssl -lcrypto -lz -lxml2 -lz -lm -lssl -lcrypto -ldl -lz -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lxml2-lz -lm -lcrypt

在后面添加 -liconv,即修改为:
< View plain text >
  PHP
 

    EXTRA_LIBS = -lcrypt -lz -lcrypt -lrt -lmysqlclient -lmcrypt -lldap -llber -lfreetype -lpng -lz -ljpeg -lcurl -lz -lrt -lm -ldl -lnsl -lrt -lxml2 -lz -lm -lssl -lcrypto -ldl -lz -lcurl -ldl -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lidn -lssl -lcrypto -lz -lxml2 -lz -lm -lssl -lcrypto -ldl -lz -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lxml2-lz -lm -lcrypt -liconv

继续make && make install, 打完收工!
原文地址:https://www.cnblogs.com/fyy-hhzzj/p/8966241.html