


分享ubuntu 64 server 干净环境安装php5.3.10+mysql5.5.20+apache2.2.22(完)解决思路
分享ubuntu 64 server 干净环境安装php5.3.10+mysql5.5.20+apache2.2.22(完)
最近php 出了几个大的安全隐患,在熟悉了yum 和 apt-get install 这些懒人安装模式后,逐渐的忘记了以前配置和编译环境的事情,昨天因为changjay同学说能不能提供一些安装过程,看了看我们板块这方面的文章也少,花了一下午和一晚上时间终于把裸机(只有系统的ubuntu 64 server 11.10) 装上了最新的php apache mysql 其中用到的各种扩展模块 全部都是最新的版本。
因为是裸机 需要安装各种缺失的组件,实际上如果对自己的系统比较熟悉(以前安装模块位置很清楚),仅仅是升级php的话,顺利一次过 这个时间不会超过半个小时(实际上时间最多是10分钟)。剩下的时间都花在下载,找压缩包,以及配置错误重新配置编译上了。其中有一个文件存在bug 在gcc-4.6.1 语法错误的严格检查下报错,根据出错的提示,修改该c文件后顺利编译。
注:本文#符号代表在root 权限下操作提示符,#号后跟指令
直接说升级安装吧,因为安装升级新版本只需要重新编译一下新版本就可以了,升级之前需要将已经安装的模块列出来,以及安装的位置给记录清楚,可以通过echo phpinfo();来查看旧版本安装了什么扩展.
下载最新版本php
http://www.php.net/downloads.php
我下载的文件是
php-5.3.10.tar.gz
#tar -zxf php-5.3.10.tar.gz
#cd php-5.3.10
#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/opt/mysql/server-5.5/ --with-curl=/usr/local/curl --enable-ftp --with-libxml-dir=/usr/local/libxml2 --with-expat-dir=/usr/lib --enable-soap --with-xsl=/usr/local/libxslt --enable-xslt --with-gd=/usr/local/gd2/ --with-jpeg-dir=/usr/local/jpeg8/ --with-zlib-dir=/usr/lib --with-png-dir=/usr/lib --with-freetype-dir=/usr/local/freetype
这里如果照抄应该是不行的,因为除非你安装的路径和所有模块都一致,所以你参照我的配置 可以自己修改一下,一个是路径位置,另外一个是一些不需要的扩展。
这里稍微的解释一下配置参数的意思.
--prefix= 这里设置的是安装的位置
--with- 后面跟的是模块 模块后跟的=是模块已经编译安装好的路径
#make;make install
顺利的话编译完成安装好就可以了,因为配置文件都已经存在,也不需要进行修改,除非是从很旧的版本升级上来有参数需要变动的。
====================
下面是裸机安装整个环境的过程,可能有的忘记了,我慢慢回忆,将过程补充完整。
1.安装apache
比较简单,不需要太多的配置
下载最新稳定版本
#wget http://mirror.bjtu.edu.cn/apache//httpd/httpd-2.2.22.tar.bz2
#tar -zxf httpd-2.2.22.tar.bz2
#cd httpd-2.2.22
# ./configure --prefix=/usr/local/apache --enable-modules=so --enable-rewrite
# make;make install
如果没有安装wget 需要先安装wget工具.
#apt-get install wget
实际上我很少使用 wget,当然顺带的推荐一下 aria2
#apt-get install aria2
使用方法
#aria2c -t x http://xxxxx
x 为多少个线程,自动支持断点继传,万一有事出门,关了电脑,下次继续使用这个指令他会自动从上次中断位置开始.
如果像我一样是裸机安装的话可能会有缺少某些环境的错误提示,发现什么就给装上什么,提示 gcc 不存在 那么 apt-get install gcc
这些编译环境我就直接用apt-get 了.这个还要自己编译的话那就太耗时间了。
安装好后,暂时不需要去启动apache.因为我们还有很多工作要做。
2.安装php以及各种需要使用的库
如果是升级php的话就一般不需要折腾这个步骤了。一般的库都轻松解决,不过也有碰上比较麻烦的,例如GD库。
a.安装GD库 -让php支持gif,png,jpeg格式
GD库需要以下模块的支持
jpeg8,libpng,freetype
首先是 jepg8 (网上大多数使用的是jepg6版本,此为最新模块)
#aria2ch -t 3 ttp://www.ijg.org/files/jpegsrc.v8d.tar.gz
#tar -zxf jpegsrc.v8d.tar.gz
#cd jpeg-8d
#./configure --prefix=/usr/local/jpeg8/ --enable-shared --enable-static
#make;make install
其次是 libpng
http://sourceforge.net/projects/libpng/files/libpng16/1.6.0beta10/libpng-1.6.0beta10.tar.gz/download
使用浏览器打开地址下载(网上大多是旧的1.2x版本,这里是最新的模块)
#tar -zxf libpng-1.6.0beta10.tar.gz
#cd libpng-1.6.0beta10
#cp ./scripts/makefile.std makefile
注意这里不需要配置,直接复制文件就可以了
#make; make install
最后是freetype
# wget http://cdnetworks-kr-1.dl.sourceforge.net/project/freetype/freetype2/2.4.8/freetype-2.4.8.tar.bz2
这是最新的版本
#bzip2 -d freetype-2.4.8.tar.bz2
#tar -xvf freetype-2.4.8.tar
#cd freetype-2.4.8
#./configure --prefix=/usr/local/freetype
#make; make install
现在需要的三个模块都已经编译好了,
正式开始安装GD库
#wget https://bitbucket.org/pierrejoye/gd-libgd/get/GD_2_0_34RC1.tar.gz
这是最新的版本
#tar -zxf GD_2_0_34RC1.tar.gz
#cd pierrejoye-gd-libgd-5551f61978e3/src/
#./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg8/ --with-png --with-zlib --with-freetype=/usr/local/freetype/
#make; make install
b.安装curl库
这是最新版本的curl
#wget http://curl.haxx.se/download/curl-7.24.0.tar.gz
#tar -zxf curl-7.24.0.tar.gz
#cd curl-7.24.0
#./configure --prefix=/usr/local/curl
#make; make install
3.安装php
安装php前我们还得解决libxml2 和 libxslt
a.libxml2
这也是最新的版本
#wget http://ftp.gnome.org/pub/GNOME/sources/libxml2/2.6/libxml2-2.6.30.tar.gz

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

To install the Linux kernel on Ubuntu22.04, you can follow the following steps: Update the system: First, make sure your Ubuntu system is the latest, execute the following command to update the system package: sudoaptupdatesudoaptupgrade Download the kernel file: Visit the official Linux kernel website () to download Required kernel version. Select a stable version and download the source code file (with .tar.gz or .tar.xz extension), for example: wget Unzip the file: Use the following command to unzip the downloaded kernel source code file: tar-xflinux-5.14.tar. xz install build dependencies: Install the tools and dependencies required to build the kernel. Execute

Although Windows 11 allows you to extract files from multiple archive formats, creating them has been limited to ZIP, that is, until now. Windows 11 also now allows you to create 7Z and TAR archive files natively, which can be done like a normal ZIP file without relying on third-party tools. How to create 7Z and TAR archive files on Windows 11 without third-party software Earlier, Windows 11 gained support for extracting various archive file formats including .rar, .7z, .tgz, .tar.gz, .tar.bz2 and so on. However, creating them is limited to ZIP archives. However, there is no support for compressing files into 7Z and TAR archive file formats.

Many of us have seen this snippet over and over again in Python code: with open('Hi.text', 'w') as f: f.write("Hello, there") However, some of us Some people don't know what with is used for and why we need to use it here. In this read, you'll find out about almost any problem that can be solved with. let's start! First, let's consider what we need to do without using the with keyword. In this case we need to open the file first and try to write. Regardless of success or failure, we'd better be

The CentOS7 system provides a variety of commands for file compression and decompression operations. The following are some commonly used commands and their usage. tar: The tar command is used to package a file or directory and optionally compress it into a tar archive. Create tar compressed package: tar-cvfarchive.tarfile1file2directory Decompress tar compressed package: tar-xvfarchive.tar Create tar.gz compressed package: tar-czvfarchive.tar.gzfile1file2directory Decompress tar.gz compressed package: tar-xzvfarchive.tar.gz Create tar .bz2 compressed package: t

Basic command: Execute the following command to back up the entire file system: sudo/usr/bin/tar-czpvf/home/zhaomu/backup/linux_backup.tar.gz/. The parameters are explained as follows: -c: means archive. -z: Use gzip format backup. gzip's backup speed is faster, but the backup files generated by other methods are also larger. -p: Keep the file permissions while backing up, so that permission problems will not occur during recovery. -v: Display detailed information about the backup process. -f: Specify the backup directory and file name. /: Indicates backing up the entire file system. Enhanced command 1. Exclude files that do not need to be backed up. The above backup command is not the optimal solution because the entire

Recommendation and comparison of Linux backup tools In daily work, data backup is a crucial operation. Both individual users and enterprise-level users need to back up important data to prevent accidental data loss. Under Linux systems, there are many backup tools to choose from, each with its own characteristics and applicable scenarios. This article will introduce several commonly used Linux backup tools, compare and recommend them. rsyncrsync is a powerful file synchronization tool that can be used locally or via SSH protocol.

I believe many C programmers have had this question, what if a server has different gcc versions? Will they affect each other? The answer is yes. When we generally use gcc to compile source files, this gcc is the first gcc found in the system environment variable PATH. What if you want to cross-compile programs for different systems? This requires multiple sets of compilation tool chains, and the corresponding tool chains are used to compile the programs of the target system. Default path compiler path: usually placed in the /usr/bin directory. Header file path: System-level header files are usually placed in /usr/include, and standard library header files are generally placed in /usr/local/include. Library path: System dynamic libraries are often located in /u

The Linux operating system provides a variety of environment variables for configuring and managing system behavior. This article will introduce the 10 most common environment variables in Linux, and give sample code and corresponding analysis. 1. The PATHPATH environment variable determines the directory where the system searches for executable files. When you enter a command in the terminal, the system retrieves the executable file in the directory specified in the PATH variable. Sample code: echo$PATH output:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games: /snap/bin parsing
