Linux下安装配置apache,mysql,php并支持gd,jpeg,png,freetype的方法

如果是用RPM包装的PHP+Mysql+Apache,GD库默认就装好了。
如果想要编译安装这些,GD库是要自己动手安装上去的。
我编译安装(源代码)了Apache+PHP,现在要用到GD库,所以又要装GD库了
在网上找了好多资料,都不太详细或过时了。
看了一些文档,总算弄好了,现在总结出来。
在Red Hat Linux 9.0+Apache+PHP下通过。
...........
 如果是用RPM包装的PHP+Mysql+Apache,GD库默认就装好了。
如果想要编译安装这些,GD库是要自己动手安装上去的。
我编译安装(源代码)了Apache+PHP,现在要用到GD库,所以又要装GD库了
在网上找了好多资料,都不太详细或过时了。
看了一些文档,总算弄好了,现在总结出来。
在Red Hat Linux 9.0+Apache+PHP下通过。
Powered by aspbiz(at)163.com
一、下载
二、说明
最新的GD库包括了对GIF的支持,所以不要打GIF补丁
[url]http://sourceforge.net/[/url] 好多源代码包可以在上面找到
安装步骤:
先安装zlib,freetype,libpng,jpeg,再装GD,再装PHP
三、安装
1.安装zlib
zlib-1.2.2.tar.gz 
http://zlib.net/
http://nchc.dl.sourceforge.net/project/libpng/zlib/1.2.7/zlib-1.2.7.tar.gz
 
  tar zxvf zlib-1.2.7.tar.gz
  cd zlib-1.2.7
  ./configure
  make 
  make install
2.安装libpng
libpng-1.2.7.tar.tar  [url]http://sourceforge.net/projects/libpng/[/url]
  tar zxvf libpng-1.2.8.tar.gz
  cd libpng-1.2.8
  cd scripts/
  mv makefile.linux ../makefile
  cd ..
  make
  make install
  注意,这里的makefile不是用./configure生成,而是直接从scripts/里拷一个
3.安装freetype
freetype-2.1.9.tar.gz  [url]http://sourceforge.net/projects/freetype/[/url]
  tar zxvf freetype-2.1.10.tar.gz
  cd freetype-2.1.10
  ./configure
  make
  make install
不要下载zip版本的,否则在编译的时候会出现错误
 
4.安装Jpeg
jpegsrc.v6b.tar.gz   [url]http://www.ijg.org/[/url]
  tar zxvf jpegsrc.v6b.tar.gz 
  cd jpeg-6b/
  ./configure --enable-shared
  make
  make test
  make install
注意,这里configure一定要带--enable-shared参数,不然,不会生成共享库
5.安装GD
[url]http://www.boutell.com/gd/[/url]
GD下载地址:   https://bitbucket.org/pierrejoye/gd-libgd/downloads
gd-2.0.33.tar.gz  
tar zxvf gd-2.0.33.tar.gz 
cd gd-2.0.33
 ./configure --with-png --with-freetype --with-jpeg
make 
make install

缺省情况下,GD库编译时并不加入JPEG支持,得修改Makefile文件。
修改Makefile文件,使得:
CFLAGS=-O -DHAVE_XPM -DHAVE_JPEG -DHAVE_LIBTTF
LIBS=-lm -lgd -lpng -lz -ljpeg -lttf -lXpm -lX11
此后,编译并安装:
make
make install
命令完成后,gd.h被拷到/usr/local/lib目录下,libgd.a被拷到/usr/local/lib目录下。
6.安装PHP
php-4.3.9.tar.gz  [url]http://www.php.net[/url]
  tar zxvf php-5.2.2.tar.gz
  cd php-5.2.2

[root@s10 php-5.2.2]# ./configure --prefix=/opt/php --with-apxs2=/opt/apache/bin/apxs --with-mysql=/opt/mysql  --with-gd=/usr/local/lib --with-zlib --with-png --with-jpeg --with-freetype --enable-sockets --enable-track-vars 

  make
  make install
7.配置Apache支持PHP
整合apache和php
       找到并编辑文件/etc/httpd/conf/httpd.conf:
       在 #AddType application/x-tar .tgz
下加上
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
还有找到
DirectoryIndex index.html index.html.var 
在后面加 index.php 和default.php让它把index.php和default.php做为默认首页。
重启apache
http://mrsun.blog.51cto.com/881719/185383
8.测试
phpinfo();
?>
Ok.....
 
 
 
 
 
 
 
编译GD报错 `AM_ICONV’ not found in library
 

安装php5需要gd2的支持,但在安装过程中,执行编译的时候出现

aclocal:configure.ac:64: warning: macro `AM_ICONV’ not found in library的错误,

搜索google得知安装gettext这个包就可以了。
#yum install gettext gettext-devel
再执行make编译就好了。


No related posts.

 
 
 
 
 
http://hi.baidu.com/firefly5002/item/7a0e5c0ecb95ea1feafe388d
 
 
 
 
 
configure: error: xml2-config not found. Please check your libxml2 installation

参考文章:http://blog.csdn.net/anljf/article/details/6981247

 

安装php时的报错

checking libxml2 install dir... no
checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.

 

检查是否安装了libxm包

[root@XKWB3403 php-5.3.8]# rpm -qa |grep  libxml2
libxml2-2.6.26-2.1.12
libxml2-python-2.6.26-2.1.12

 

重新安装libxml2和libxml2-devel包

yum install libxml2

yum install libxml2-devel -y

 

安装完之后查找xml2-config文件是否存在

[root@XKWB3403 php-5.3.8]# find / -name "xml2-config"
/usr/bin/xml2-config

 

如果存在的话重新安装php

[root@XKWB3403 php-5.3.8]# ./configure

 

安装成功的标志是

Linux下安装配置apache,mysql,php并支持gd,jpeg,png,freetype的方法_第1张图片

 

之后再进行编译

make && make install

 

 

 

 

http://blog.renren.com/share/284198213/5322251233

 

编译PHP时:configure: error: Cannot find MySQL header files under /usr/mysql  

安装 PHP 时,刚执行 ./php.config.sh

checking for MSSQL support via FreeTDS.. no

checking for MySQL support... yes

checking for specified location of the MySQL UNIX socket... no

checking for MySQL UNIX socket location... /tmp/mysql.sock

configure: error: Cannot find MySQL header files under yes.

Note that the MySQL client library is not bundled anymore.

 解法:   

如果不知道 header file 在哪,用 「find / -name mysql.h」命令找出其位置;   

如果是自己也有手動安裝 MySQL 套件的話,直接指定該位置。

在 ./configure 下参数指定 header file 的位置(即mysql安装目录),如下:

./configure --with-apxs2=/usr/local/Apache2/bin/apxs --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config

 

如果依然提示找不到mysql_config提示:

checking for mysql_config... /usr/bin/mysql_config is not a directory
configure: error: can not find mysql under the /usr/bin/mysql_config that you specified

则cp /usr/local/mysql/bin/mysql_config /usr/bin/mysql_config

 

 

 

 

php.config.sh的编译参数如下:

#! /bin/sh
ulimit -HSn 65536
CFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer"; CXXFLAGS="$CFLAGS" ;export CFLAGS CXXFLAGS
#LDFLAGS="-L/usr/lib64 -L/lib64"; export LDFLAGS

./configure --enable-inline-optimization --disable-debug  --with-mysql=/usr/local/mysql  --with-mysqli=/usr/local/mysql/bin/mysql_config --with-apxs2=/usr/local/apache2/bin/apxs --with-iconv --with-curl --enable-mbstring --enable-sockets --with-png-dir --with-jpeg-dir=/usr/local/jpeg6/lib --with-freetype-dir --with-gd --with-libxml-dir=/usr --enable-xml --enable-zip --with-zlib-dir --with-gettext --enable-pdo --with-pdo-sqlite --with-pdo-mysql=/usr/bin/mysql_config --enable-calendar --enable-ftp --with-pcre-regex --disable-ipv6 --enable-soap

 
[root@localhost software]# cd mysql-5.5.11
[root@localhost mysql-5.5.11]# cmake .
-- Could NOT find Curses (missing:  CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake:82 (MESSAGE):
  Curses library not found.  Please install appropriate package,

          remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.
Call Stack (most recent call first):
  cmake/readline.cmake:126 (FIND_CURSES)
  cmake/readline.cmake:216 (MYSQL_USE_BUNDLED_LIBEDIT)
  CMakeLists.txt:250 (MYSQL_CHECK_READLINE)
 
 
 
 
操作系统:ubuntu 11.04

、安装所需要系统库相关库文件


2、创建mysql安装目录
  # mkdir -p /usr/local/mysql/
4、创建用户和用户组与赋予数据存放目录权限
  # groupadd mysql
  # useradd -g mysql mysql
  # chown mysql.mysql -R /service/mysql/
5、安装cmake(mysql5.5以后是通过cmake来编译的)
  # wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz
  # tar zxvf cmake-2.8.4.tar.gz
  # cd cmake-2.8.4
  #./configure
  # make && make install


初始工具:gcc,cmake,make

增加用户组和用户

shell> sudo groupadd mysql

shell> sudo useradd -r -g mysql mysql

将压缩包.tar.gz解压缩到所需的目录

进入解压缩的目录

shell> sudo cmake .

安装遇到错误:

– MySQL 5.5.11

– Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)

CMake Error at cmake/readline.cmake:82 (MESSAGE):

Curses library not found. Please install appropriate package,



remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu , package name is libncurses5-dev ,

on RedHat and derivates it is ncurses-devel.

Call Stack (most recent call first):

cmake/readline.cmake:126 (FIND_CURSES)

cmake/readline.cmake:216 (MYSQL_USE_BUNDLED_LIBEDIT)

CMakeLists.txt:256 (MYSQL_CHECK_READLINE)

– Configuring incomplete, errors occurred!



下载工具libncurses5-dev,如果在RedHat 下是ncurses-devel。

下载之后先移除目录中的CMakeCache.txt

然后输入

shell> sudo cmake .



遇到警告:

Warning: Bison executable not found in PATHWarning: no usable bison found, /usr/src/mysql-5.5.11/sql/sql_yacc.yy will not be rebuilt.

下载工具:bison

下载之后先移除目录中的CMakeCache.txt

然后输入

shell> sudo cmake .



没有警告和错误发生,然后输入

shell> sudo make

shell> sudo make install

编译结束

shell> cd /usr/local/mysql

shell>sudo chown -R mysql .                               //修改mysql目录的所有者

shell> sudo chgrp -R mysql .                               //修改mysql目录的所有群组

shell> scripts/mysql_install_db --user=mysql   


cp support-files/my-medium.cnf /etc/my.cnf

cp support-files/mysql.server /etc/init.d/mysqld

chmod 755 /etc/init.d/mysqld

/etc/init.d/mysqld start

/usr/local/mysql/bin/mysql -u root -p

mysql>use mysql ;
mysql>update user set password=PASSWORD("bjsyx825") where user='root';
mysql>FLUSH PRIVILEGES;


-- Configuring incomplete, errors occurred!
[root@localhost mysql-5.5.11]# rm CMakeCache.txt
[root@localhost mysql-5.5.11]# yum install ncurses-devel
Warning: Bison executable not found in PATH
-- Configuring done
-- Generating done
-- Build files have been written to: /software/mysql-5.5.11
[root@localhost mysql-5.5.11]# yum install bison
 
 
linux 下 tar.bz2 怎样 解压安装
 
 

你可能感兴趣的:(apache,linux,PHP,工作,mysql,upload)