redhat 9下配置APACHE2.0.50 +PHP5+MYSQL4.0.20+GD库
apache|mysql|php5
linux下配置APACHE2.0.50+PHP5.0.3+MYSQL4.0.20+GD库前些天,升级服务器的时候,因为GD库的原因.make不了PHP4.3.8 于是就一步步装了PHP5
其实,安装步骤和PHP4只差一点点而已
如果你机器里原来装有了PHP或者APACHE的RPM或者低版本.请先删除
首先,服务器GCC要有,不然什么都不能做.可以用gcc -v来查看是否安装了GCC,
#gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-34)
有以上类似信息说明已有GCC,
如果你没有,请先拿安装光盘装好它
请下载以下所有的东西:
httpd-2.0.50.tar.gz
MySQL-client-4.0.20-0.i386.rpm
MySQL-server-4.0.20-0.i386.rpm
php-5.0.3.tar.gz
ZendOptimizer-2.5.3-linux-glibc21-i386.tar.gz
gd-2.0.28.tar.gz
libxml2-2.5.11.tar.gz
zlib-1.2.1.tar.gz
jpegsrc.v6b.tar.gz
libpng-1.2.5.tar.gz
xpm-3.4k-2.i386.rpm
gd-devel-1.8.4-11.i386.rpm
可能你的电脑不需要这么多.但最好都下载吧.
这些我都放在我 FTP里 的soft目录下,如果你点左边的>看不了,那可能是密码改了,请看我论坛签名里的下载信息.
不过,
可能你看到这贴子的时候会有以上软件新的版本下载了.看着办吧.
开始装吧>>>>>>>>>>>>>>>>>>>>>>>>>
先安装MYSQL 服务器
#rpm -ivh MySQL-server-4.0.20-0.i386.rpm
接着客户端
#rpm -ivh MySQL-client-4.0.20-0.i386.rpm
安装好后试试能不能用
#mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 27651 to server version: 4.0.20-standard
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
说明OK
请自己改mysql的密码
安装GD库基本包
#rpm -ivh gd-devel-1.8.4-11.i386.rpm
安装XPM支持
#rpm -ivh xpm-3.4k-2.i386.rpm
安装libxml2 (记得PHP5只支持libxml2-2.5.10以上版本)
#tar zxvf libxml2-2.5.11.tar.gz
#cd libxml2-2.5.11
#./configure
#make
#make install
开始装GD库支持
-------------------------------------------------------
ZLIB
#tar zxvf zlib-1.2.1.tar.gz
#cd zlib-1.2.1
#./configure
#make
#make install
JPEGSRC
#tar zxvf jpegsrc.v6b.tar.gz
#cd jpegsrc-6b
#./configure
#make
#make install-lib
#make install
LIBPNG
#tar zxvf libpng-1.2.5.tar.gz
#cd libpng-1.2.5
#cp scripts/makefile.linux Makefile
#./configure
#make
#make install-headers
#make install
最后是GD2.*
gd-2.0.28
#tar zxvf gd-2.0.28.tar.gz
#cd gd-2.0.28
#./configure --with-png=/usr/local --with-jpeg=/usr/local --with-freetype=/usr
#make
#make install
----------------------------------------------
上面一切都很顺利的话,GD就算成功的安装上了. 如果有问题,应该是缺少支持包,总之是少什么就下载什么来安装上.
跟着下来,开始安装APAHCHE2和PHP5
#tar zxvf httpd-2.0.50.tar.gz
#cd httpd-2.0.50
#./configure --prefix=/usr/local/apache2 --enable-module=so
#make
#make install
#tar zxvf php-5.0.3.tar.gz
#cd php-5.0.3
#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-gd=/usr/local --enable-trace-vars --with-zlib-dir=/usr/local -with-mysql=/var/lib/mysql
#make
#make install
我是把他们分别安装在/usr/local/apache2 & PHP目录下的
我原来MAKE PHP4.3.8 的时候,遇到
ext/gd/gd.lo(.text+0x63a): In function `zm_deactivate_gd':
/root/software/php-4.3.8/ext/gd/gd.c:385: undefined reference to `gdFreeFontCache'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php]Error 1
是因为GD库的freetype没装,后来我马上去下载它安装.就没错误了
所有的安装工作做好了,接着我们来配置.
复制PHP.INI文件到正确位置
在PHP目录下运行
#cp php.ini-dist /usr/local/php/lib/php.ini
编辑apache配置文件httpd.conf
#vi /usr/local/apache2/conf/httpd.conf
要改的有如下几处:
一般都在
#AddType application/x-tar .tgz
下加一行
#LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
如果你搜索其它地方没有以下这行
LoadModule php5_module modules/libphp5.so
请把上面的#号去掉
还有找到
DirectoryIndex index.html index.html.var
在后面加 index.php 让它把index.php做为默认页
找到
# don't use Group #-1 on these systems!
把下面的用户名和组改为
User apache
Group apache
(原来好像是nobody)
再找
#ServerName
把#去掉,后面的IP改成你的IP.
找到
DocumentRoot "/usr/local/apache2/htdocs"
把/usr/local/apache2/htdocs改为你存放网页文件的路径
比如我是放在/home/easy目录下,所以我以后上传PHP文件就放在/home/easy目录下,然后用IP访问,就能看到首页了
为了让中文网页没乱码
找到
AddDefaultCharset iso8859-1
把后面的iso8859-1改为gb2312
差不多就这些了,至于apache2其它优化,请看www.phpv.net 里的apache配置那一分类.
保存httpd.conf文件.
启动它
# /usr/local/apache2/bin/apachectl start
如果没有出错,写一个测试页放到你网页目录下, 我的就是上面所说的 /home/easy
#vi /home/easy/index.php
phpinfo();
保存.试试在测试器里打IP进去就可以看到PHPINFO页了
好了.如无意外.你现在可以放心在你的机器上运行PHP脚本连接mysql了.
用ZendOptimizer-2.5.3加速PHP
#tar zxvf ZendOptimizer-2.5.3-linux-glibc21-i386.tar.gz
#cd ZendOptimizer-2.5.3-linux-glibc21-i386
#./install.sh
一路默认下去应该就好了.
再看看测试页,
找找是不是这样的?
This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies with Zend Extension Manager v1.0.3, Copyright (c) 2003-2004, by Zend Technologies with Zend Optimizer v2.5.3, Copyright (c) 1998-2004, by Zend Technologies
好了,全部的安装就完成了.
接下来的工作才是最重要的!
那就是如何用PHP5来为我们制作高效率的网站

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP is used to build dynamic websites, and its core functions include: 1. Generate dynamic content and generate web pages in real time by connecting with the database; 2. Process user interaction and form submissions, verify inputs and respond to operations; 3. Manage sessions and user authentication to provide a personalized experience; 4. Optimize performance and follow best practices to improve website efficiency and security.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP uses MySQLi and PDO extensions to interact in database operations and server-side logic processing, and processes server-side logic through functions such as session management. 1) Use MySQLi or PDO to connect to the database and execute SQL queries. 2) Handle HTTP requests and user status through session management and other functions. 3) Use transactions to ensure the atomicity of database operations. 4) Prevent SQL injection, use exception handling and closing connections for debugging. 5) Optimize performance through indexing and cache, write highly readable code and perform error handling.

The core benefits of PHP include ease of learning, strong web development support, rich libraries and frameworks, high performance and scalability, cross-platform compatibility, and cost-effectiveness. 1) Easy to learn and use, suitable for beginners; 2) Good integration with web servers and supports multiple databases; 3) Have powerful frameworks such as Laravel; 4) High performance can be achieved through optimization; 5) Support multiple operating systems; 6) Open source to reduce development costs.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHP is a server-side scripting language used for dynamic web development and server-side applications. 1.PHP is an interpreted language that does not require compilation and is suitable for rapid development. 2. PHP code is embedded in HTML, making it easy to develop web pages. 3. PHP processes server-side logic, generates HTML output, and supports user interaction and data processing. 4. PHP can interact with the database, process form submission, and execute server-side tasks.
