eglid 发表于 2015-8-19 11:32:10

LAMP环境搭建

  以前只是在线下做些实验,很多包都缺少,还有许多问题没有遇到过,这次在线上搭建的,遇到了很多问题,做下记录,谢谢大家支持!
  参照此处做的http://www.php100.com/html/itnews/it/2013/0219/12062.html
  并添加了一些别的模块和中间的一些问题的解决方法!
  # tar zxvf libxml2-2.9.0.tar.gz
  # cd libxml2-2.9.0
  # ./configure --prefix=/usr/local/libxm12
  /bin/rm: cannot remove `libtoolT': No such file or directory
Done configuring
  这时直接打开 configure,把 $RM “$cfgfile” 那行删除掉,重新再运行 ./configure 就可以了。
  # tar zxvf libmcrypt-2.5.8.tar.gz
  # cd libmcrypt-2.5.8
  # ./configure --prefix=/usr/local/libmcrypt
  # make && make install
  # cd libltdl/
  # ./configure --enable-ltdl-install
  # make && make install
  # tar zxvf zlib-1.2.7.tar.gz
  # cd zlib-1.2.7
  # ./configure --prefix=/usr/local/zlib
  # make && make install
  # tar zxvf libpng-1.5.14.tar.gz
  # cd libpng-1.5.14
  # ./configure --prefix=/usr/local/libpng
  # make && make install
  # mkdir /usr/local/jpeg8
# mkdir /usr/local/jpeg8/bin
# mkdir /usr/local/jpeg8/lib
#mkdir /usr/local/jpeg8/include
# mkdir -p /usr/local/jpeg8/man/man1
  # tar zxvf jpegsrc.v8b.tar.gz
  # cd jpeg-8b/
  # ./configure --prefix=/usr/local/jpeg8 --enable-share --enable-static
  #make && make install
  # tar zxvf freetype-2.4.10.tar.gz
  # ./configure --prefix=/usr/local/freetype
  # make && make install
  # tar zxvf autoconf-2.69.tar.gz
  # cd autoconf-2.69
  # ./configure && make && make install
  # tar zxvf gd-2.0.35.tar.gz
  # cd gd-2.0.35
  # ./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg8 --with-freetype=/usr/local/freetype/ --with-png=/usr/local/libpng/
  # make && make install
  # yum remove apr apr-util
  # tar zxvf apr-1.4.6.tar.gz
  # cd apr-1.4.6
  # ./configure --prefix=/usr/local/apr-httpd/
  # make && make install
  # tar zxvf apr-util-1.5.1.tar.gz
  # ./configure --prefix=/usr/local/apr-util-httpd/ --with-apr=/usr/local/apr-httpd/
  # make && make install
  # unzip pcre-8.32.zip
  # cd pcre-8.32
  # ./configure --prefix=/usr/local/pcre
  # make && make install
  # tar zxvf httpd-2.4.3.tar.gz
  # cd httpd-2.4.3
  # ./configure --prefix=/usr/local/apache --enable-mods-shared=all --enable-deflate \
> --enable-speling --enable-cache --enable-file-cache --enable-disk-cache --enable-mem-cache --enable-so \
>--enable-expires=shared --enable-rewrite=shared --enable-static-support --with-z=/usr/local/zlib/ \
> --with-apr=/usr/local/apr-httpd/ --with-apr-util=/usr/local/apr-util-httpd/ --with-pcre=/usr/local/pcre/ \
> --disable-userdir
  # make && make install
  # /usr/local/apache/bin/apachectl start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.0.52. Set the 'ServerName' directive globally to suppress this message
#
  
# tar zxvf php-5.4.11.tar.gz
  # cd php-5.4.11
  # ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/data/mysql --with-libxml-dir=/usr/local/libxml2/ --with-png-dir=/usr/local/libpng/ --with-jpeg-dir=/usr/local/jpeg8/--with-freetype-dir=/usr/local/freetype/ --with-gd=/usr/local/gd/ --with-zlib-dir=/usr/local/zlib/ --with-mcrypt=/usr/local/libmcrypt/ --with-mysqli=/data/mysql/bin/mysql_config --enable-soap --enable-mbstring=all --enable-sockets
  # make
  
/root/php/php-5.4.11/ext/gd/gd_ctx.c:153: 错误:‘gdIOCtx’ 没有名为 ‘data’ 的成员
make: *** 错误 1
  解决方法如下:
  好像说这个错误算是php5.4的bug
  # vi /usr/local/gd/include/gd_io.h
  typedef struct gdIOCtx
{
int (*getC) (struct gdIOCtx *);
int (*getBuf) (struct gdIOCtx *, void *, int);
  void (*putC) (struct gdIOCtx *, int);
int (*putBuf) (struct gdIOCtx *, const void *, int);
  /* seek must return 1 on SUCCESS, 0 on FAILURE. Unlike fseek! */
int (*seek) (struct gdIOCtx *, const int);
  long (*tell) (struct gdIOCtx *);
  void (*gd_free) (struct gdIOCtx *);
void (*data);
}
gdIOCtx;
  
# cp php.ini-development /usr/local/php/etc/php.ini
  # vi /usr/local/apache/conf/httpd.conf
  AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType application/x-httpd-php .php .phtml
  
重启apache 发现apache起来了,但是php页面不能加载
查看日志报错如下
   AH00489: Apache/2.4.3 (Unix) PHP/5.4.11 configur
ed -- resuming normal operations
AH00094: Command line: '/usr/local/apache/bin/httpd'
  
经百度发现是 加固时限制系统资源会导致此故障
  解决方法
# vi /etc/security/limits.conf
  # End of file
#* hard nofile 65536
#* soft nofile 65536
  # /usr/local/apache/bin/apachectl restart
  网页显示正常了,但是页面date出现这么一个警告,百度查后结果是发现从php5.3 ,当对使用date()等函数时,如果timezone设置不正确,在每一次调用时间函数时,都会产生E_NOTICE 或者 E_WARNING 信息。
  解决方法是
修改php.ini。打开php.ini查找date.timezone 去掉前面的分号修改成为:date.timezone =PRC
g: phpinfo(): It is not safe to rely on the system's timezone settings. You
  添加pdo_mysql模块
  
# tar zxvf PDO_MYSQL-1.0.2.tgz
  # cd PDO_MYSQL-1.0.2
  # /usr/local/php/bin/phpize
Configuring for:
PHP Api Version:         20100412
Zend Module Api No:      20100525
Zend Extension Api No:   220100525
  # ./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/data/mysql
  # make
  /root/php/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:36: ′?£oexpected specifier-qualifier-list before ??MYSQL?ˉ
/root/php/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:48: ′?£oexpected specifier-qualifier-list before ??MYSQL_FIELD?ˉ
/root/php/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:53: ′?£oexpected specifier-qualifier-list before ??MYSQL_RES?ˉ
make: *** ′? 1
  # ln -s /data/mysql/include/mysql/* /usr/local/include/
  # make install
Installing shared extensions:   /usr/local/php/lib/php/extensions/no-debug-zts-20100525/
  # vi /usr/local/php/etc/php.ini
  extension_dir = "/usr/local/php/lib/php/extensions/no-debug-zts-20100525/"
extension = "pdo_mysql.so"
  重启apache,终于完工了!
  
页: [1]
查看完整版本: LAMP环境搭建