文档库 最新最全的文档下载
当前位置:文档库 › Linux+PHP5+Mysql+GD的安装

Linux+PHP5+Mysql+GD的安装

相关软件下载:
Httpd: https://www.wendangku.net/doc/058876457.html,
PHP: https://www.wendangku.net/doc/058876457.html,/downloads.php
Mysql: https://www.wendangku.net/doc/058876457.html,/downloads
libxml2: ftp://https://www.wendangku.net/doc/058876457.html,/libxml2
GD库:
gd-2.0.33.tar.gz https://www.wendangku.net/doc/058876457.html,/releases
libpng-1.2.29.tar.gz https://www.wendangku.net/doc/058876457.html,/projects/libpng
zlib-1.2.3.tar.gz https://www.wendangku.net/doc/058876457.html,/project/showfiles.php?group_id=5624
freetype-2.2.1.tar.gz https://www.wendangku.net/doc/058876457.html,/projects/freetype
jpegsrc.v6b.tar.gz https://www.wendangku.net/doc/058876457.html,/files/

phpMyAdmin: https://www.wendangku.net/doc/058876457.html,/home_page/downloads.php
-------------------------------------------------------------------
安装过程
1).安装MySQL
>> CODE
#tar -zxvf mysql-max-4.1.20-pc-linux-gnu-i686.tar.gz
#mv mysql-max-4.1.20-pc-linux-gnu-i686 /usr/local/mysql
#cd /usr/local/mysql
#groupadd mysql #添加mysql用户组
#useradd -g mysql mysql #添加mysql用户并将它加入mysql用户组
#scripts/mysql_install_db --user=mysql #执行表
#chown -R root . #修改文件(夹)属性
#chown -R mysql data
#chgrp -R mysql .
#cd support-files
#cp mysql.server /etc/rc.d/init.d/mysqld
#chmod 700 /etc/rc.d/init.d/mysqld
#chkconfig --add mysqld
#chkconfig --level 345 mysqld on #设置开机启动mysqld服务
#cp https://www.wendangku.net/doc/058876457.html,f /etc/https://www.wendangku.net/doc/058876457.html,f #mysql配置文件
#/usr/local/mysql/bin/mysqld_safe --user=mysql& #安全启动mysql
#cd ../bin
#./mysqladmin -u root password "123456789" #修改数据库root用户密码为123456789


安装说明文件:mysql文件夹中的 INSTALL-BINARY 文件
遇到的错误:
1.在运行bin/mysql_safe --user=mysql&时
Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm'(errno:13)
原因:/usr/local/mysql/data/mysql 文件夹中的所有数据库文件的属性为root,使用 chown -R mysql . 和chgrp -R mysql . 命令更改为mysql用户(组)
2.在安装配置完成后登录phpMyAdmin网页时
出现错误:#2002 - 服务器没有响应(or the local MySQL server's socket is not correctly configured)
原因:没有执行cp https://www.wendangku.net/doc/058876457.html,f /etc/https://www.wendangku.net/doc/058876457.html,f

2).安装libxml2(php5需要libxml2-2.5.10以上版本的支持)

>> CODE
#rpm -e --nodeps libxml2.*.* #如有已安装的rpm包,将其卸载,下同
#tar -zxvf libxml2-2.6.26.tar.gz
#cd libxml2-2.6.26
#./configure
#make
#make install


3).安装 zlib


>> CODE
#tar -zxvf zlib-1.2.3.tar.gz
#cd zlib-1.2.3
#./configure
#make
#make install


4).安装libpng


>> CODE
#tar -zxvf libpng-1.2.29.tar.gz
#cd libpng-1.2.29
#cd scripts
#mv makefile.linux ../makefile #不使用configure生成的makefile
#cd ..
#make
#make install


5).安装freetype


>> CODE
#tar -zxvf freetype-2.2.1.tar.gz
#cd freetype-2.2.1
#./configure
#make
#make install


6).安装jpeg


>> CODE
#tar -zxvf jpegsrc.v6b.tar.gz
#cd jpeg-6b
#./configure --enable-shared --enable-static #生成共享库和静态库
#make
#make install




7).安装GD库


>> CODE
#tar -zxvf gd-2.0.33.tar.gz
#cd gd-2.0.33
#./c

onfigure --with-png --with-freetype --with-jpeg
#make install



8).安装httpd


>> CODE

#groupadd apache
#useradd -g apache apache
#tar -zxvf httpd-2.2.2.tar.gz
#cd httpd-2.2.2
#./configure --enable-so --with-mpm=worker #可进行其它一些配置
#make
#make install

--enable-so 让Apache可以支持动态模块功能
--enable-deflate=shared 开启gzip功能
--enable-headers=shared 与deflate配套
--enable-rewrite=shared 开启地址重写
--enable-speling=shared 开启URL错误纠正
--with-mpm=worker 使用称为worker的多线程化多处理模块
--enable-mods-shared=most 动态编译大部分常用的模块,most意思是只包含通常用的模块,并且以动态加载模式加载.也可以换成 all

9).安装PHP5


>> CODE
#tar -zxvf php-5.1.4.tar.gz
#cd php-5.1.4
#./configure --with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-libxml-dir=/usr/local/lib \
--with-gd \
--with-jpeg \
--with-png \
--with-freetype \
--with-zlib \
--enable-dba \
--with-openssl \
--with-regex=php \
--enable-bcmath \
--with-gnu-ld \
--with-tsrm-pthreads \
--enable-ftp \
--with-gettext \
--enable-memory-limit \
--enable-zend-multibyte \
--enable-mbstring=all #可进行其它一些配置
#make
#make install


安装时有下面一个提示:
libtool: install: warning: remember to run `libtool --finish /root/php-5.1.4/libs`
所以


>> CODE
#libtool --finish /root/php-5.1.4/libs


遇见的错误:
1.configure: error: libjpeg.(a|so) not found.
GD库没有安装成功
2.configure: error: mysql configure failed. Please check config.log for more information.
原因mysql的版本不对,不能下载如mysql-standard-4.1.20-pc-linux-gnu-i686-icc-glibc23.tar.gz等icc编译版本的.还有不知怎么回事下载的mysql5的几个版本都出现这个错误。



配置环境:



>> CODE
#cp php.ini-dist /usr/local/lib/php.ini
#vi /usr/local/apache2/conf/httpd.conf




>> CODE
添加
ServerName 127.0.0.1
AddType application/x-httpd-php .php .php5 #这里指定php脚本的默认扩展名

修改
User apache
Group apache

DirectoryIndex index.php index.html





>> CODE
#/usr/local/apache2/bin/apachectl start #启动httpd


遇见的错误:
1.运行/usr/local/apache2/bin/apachectl start时
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
原因:没有在httpd.conf文件中添加ServerName 127.0.0.1



>> CODE
#cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
#vi /etc/rc.d/init.d/httpd


在第二行加入


>> CODE

# chkconfig: - 85 15
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.



保存,退出


>> CODE
#chkconfig --add httpd
#chkconfig --level 345 httpd on #设置开机启动httpd服务




测试:


>> CODE
#cd /usr/local/apache2/htdocs/
#vi info.php




>> CODE
phpinfo();
?>


在浏览器中打入网址: http://127.0.0.1/info.php
出现:


>> CODE
PHP Version 5.1.4
System Linux Arden 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686
Build Date Jul 2 2006 12:44:11
Configure Command './configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-mysql=/usr/local/mysql' '--with-libxml-dir=/usr/local/lib' '--with-gd' '--with-jpeg' '--with-png' '--with-freetype' '--with-zlib' '--enable-mbstring=all' '-with-mysqli=/usr/local/mysql/bin/mysql_config'
Server API Apache 2.0 Handler
Virtual Directory Support disabled
Configuration File (php.ini) Path /usr/local/lib/php.ini

..........


配置成功!

相关文档
相关文档 最新文档