linux下的apache2 + mysql5 + php4 + gd2 源码完整安装详解

linux下的apache2 + mysql5 + php4 + gd2 源码完整安装详解

大家好,又见面了,我是全栈君。

1.安装mysql
 
小五注释:mysql的安装包实在是太多了,我在学习的时候,遇到最大的问题就是安装mysql的问题,后来才发现,原来是自己选择安装包不对,非常郁闷,为了避免其他朋友也遇到同样的问题,所以,我把本文所涉及的mysql安装包放到skydrive网盘上,这样,你就不会下载错了,希望对需要的朋友能有所帮组,下载地址
 
 
下载速度可能慢一些,但是绝对好用


shell> groupadd -g 500 mysql

shell> useradd -u500 -gmysql -M mysql

shell> tar -xzf mysql.**.tar.gz

shell> cd mysql.**

shell> ./configure –prefix=/usr/local/mysql –localstatedir=/usr/local/mysql/data –with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock

shell> make

shell> make install

shell> cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysql //开机启动mysql

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

shell> cd /usr/local/mysql

shell> bin/mysql_install_db –user=mysql

shell> chown -R root .

shell> chown -R mysql var

shell> chgrp -R mysql .

shell> bin/mysqld_safe –user=mysql & 

注意直接执行后会出现下面错误:

Starting mysqld daemon with databases from /usr/local/mysql/data STOPPING server from pid file /usr/local/mysql/data/localhost.localdomain.pid 070514 19:15:13 mysqld ended

需执行 shell> chown -R mysql.mysql data

修改root密码:

use mysql

update user set Password=password(“123456″) where User=”root”;

delete from user where User=””;

2.apache安装

shell> tar -xzf httpd-2.2.4.tar.gz

shell> cd httpd-2.2.4

shell> ./configure –prefix=/usr/local/apache2 –enable-rewrite=shared –enable-speling=shared –enable-module=so

shell> make

shell> make install

3.iconv安装

shell> ./configure –prefix=/usr/local/iconv

shell> make

shell> make install

4.gd部分安装

zlib包

shell> ./configure –prefix=/usr/local/zlib

shell> make check

shell> make install

libpng包(支持PNG)

shell> ./configure –prefix=/usr/local/libpng

shell> make

shell> make install

jpeg-6b包(支持jpg格式)

shell> ./configure –prefix=/usr/local/jpeg-6b –enable-share –enable-static

shell> make test

shell> make

shell> make install

shell> make install-lib

freetype包(字体支持)

shell> ./configure –prefix=/usr/local/freetype

shell> make

shell> make install

最后安装gd包

shell> ./configure –prefix=/usr/local/gd2 –with-jpeg=/usr/local/jpeg-6b –with-zlib-dir=/usr/local/zlib –with-png=/usr/local/libpng –with-freetype=/usr/local/freetype

shell> make

shell> make install

make时会出现

make[2]: *** [gd_png.lo] Error 1

make[2]: Leaving directory `/tmp/gd-2.0.26gif’

make[1]: *** [all-recursive] Error 1

make[1]: Leaving directory `/tmp/gd-2.0.26gif’

make: *** [all] Error 2

需要复制/usr/local/libpng/include/目录下的cp /usr/local/libpng/include/pngconf.h /home/jong/tmp/gd-2.0.34

cp /usr/local/libpng/include/png.h /home/jong/tmp/gd-2.0.34

5.安装php

shell> ./configure –prefix=/usr/local/php –with-apxs2=/usr/local/apache2/bin/apxs –with-gd=/usr/local/gd2 –with-jpeg-dir=/usr/local/jpeg-6b –with-zlib-dir=/usr/local/zlib –with-png-dir=/usr/local/libpng –with-freetype-dir=/usr/local/freetype –enable-trace-vars -with-mysql=/usr/local/mysql -with-iconv=/usr/local/iconv –enable-mbstring=all –with-curl –enable-track-vars –with-DBA –enable-mbstr-enc-trans –enable-mbregex –with-config-file-path=/usr/local/php –with-xml –with-gettext

shell> make

shell> make install

shell> cp php.ini-dist /usr/local/php/php.ini 

编辑apache配置档

shell> cd /usr/local/apache2/conf

shell> vi httpd.conf

在LoadModule php4_module modules/libphp4.so

添加AddType application/x-httpd-php .php

OK,基本的安装已经完成,如果重新起动APACHE出现:/usr/local/apache2/bin/apachectl start Syntax error . line 232 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp4.so into server: /usr/local/apache2/modules/libphp4.so: cannot restore segment prot after reloc: Permission denied

那就要按照下面的方法解决:

编辑/etc/selinux/config,找到这段:

# This file controls the state of SELinux . the system.

# SELINUX= can take .e of these three values:

# enforcing – SELinux security policy is enforced.

# permissive – SELinux prints warnings instead of enforcing.

# disabled – SELinux is fully disabled.

SELINUX=enforcing 

把 SELINUX=enforcing 注释掉:#SELINUX=enforcing ,然后新加一行为:

SELINUX=disabled

保存,关闭。

编辑/etc/sysconfig/selinux,找到:

# This file controls the state of SELinux . the system.

# SELINUX= can take .e of these three values:

# enforcing – SELinux security policy is enforced.

# permissive – SELinux prints warnings instead of enforcing.

# disabled – SELinux is fully disabled.

SELINUX=enforcing 

如果SELINUX已经是 SELINUX=disabled,那么就不用改了,否则就把SELINUX=enforcing 注释掉,新加一行:

SELINUX=disabled

保存,退出。

如果你碰到其他类似提示:

cannot restore segment prot after reloc: Permission denied

哪应该是SELinux的问题,可以考虑把它关闭。




本文转自 Jhuster 51CTO博客,原文链接:http://blog.51cto.com/xwnet/124588,如需转载请自行联系原作者

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/107878.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 8年软件测试工程师感悟——写给还在迷茫中的朋友

    8年软件测试工程师感悟——写给还在迷茫中的朋友这两天和朋友谈到软件测试的发展,其实软件测试已经在不知不觉中发生了非常大的改变,前几年的软件测试行业还是一个风口,随着不断地转行人员以及毕业的大学生疯狂地涌入软件测试行业,目前软件测试行业“缺口”已经基本饱和。当然,我说的是最基础的功能测试的岗位需求已经很少了,而自动化、性能、安全乃至于以后可能出现的大数据测试、AI测试仍存在着非常多的机会。“长江后浪推前浪,前浪死在沙滩上”,曾经一句让人…

    2026年1月22日
    5
  • linux 复制文件夹内所有文件到另一个文件夹

    linux 复制文件夹内所有文件到另一个文件夹cp-Rf/home/user1/*/root/temp/将/home/user1目录下的所有东西拷到/root/temp/下而不拷贝user1目录本身。即格式为:cp-Rf原路径/目的路径/

    2022年8月23日
    7
  • 关于Git这一篇就够了

    关于Git这一篇就够了目录前言发展过程集中式与分布式的区别Debian/Linux安装Git配置git环境:gitconfig–global创建本地空仓库:gitinit新建文件添加到本地仓库:gitadd、gitcommit-m改写提交:gitcommit–amend查看历史提交日志:gitlog回滚代码仓库:gitreset–hard查看提交之后文件是否做了改动:gitstatus工作区与缓存区修改缓存区内容:gitadd、gitco.

    2022年5月2日
    87
  • Windows程序设计——LoadImage参数及其用法「建议收藏」

    Windows程序设计——LoadImage参数及其用法「建议收藏」LoadImage是一种函数,功能是装载图标,光标,或位图。简介编辑函数功能:该函数装载图标,光标,或位图。函数原型:HANDLE LoadImage(HINSTANCE hinst,LPCTSTR lpszName,UINT uType,int cxDesired,int cyDesired,UINT fuLoad);参数hinst:处理包含被装载图像模块的实例。若要…

    2022年8月18日
    16
  • 数据库设计——关系数据理论(超详细)「建议收藏」

    数据库设计——关系数据理论(超详细)「建议收藏」问题——什么是一个好的数据库逻辑设计●关系型数据库逻辑设计:➠针对一个具体问题应如何构造一个适合于它的数据模式,即应构造几个关系,每个关系由哪些属性组成等eg:?这样的设计是一个好的设计吗?观察这个表所对应的一个实例(在某个时刻student模式所对应的一个实际的数据情况):如有若干个学生,他们都为’计算机系’,系主任为’张明’,选修了’C1’课程,得到各自的成绩☟☞关系模式STUDENT(Sno,Sdept,Mname,Cno,Grade)中存在的问题:☜1、数据冗余太大,浪费存储空间如

    2022年10月9日
    6
  • android vlc 字幕乱码,VLC播放器中文字幕乱码问题解决方法[通俗易懂]

    android vlc 字幕乱码,VLC播放器中文字幕乱码问题解决方法[通俗易懂]VLC对于Mac用户来说算得上是必备软件。其相当于PC上的“暴风影音”,但Mac新手使用VLC播放avi时都会碰到字幕乱码的问题。avi字幕的格式有多种,这里假设你使用常见的.srt字幕。VLC默认支持的字幕内码为utf-8,而网上提供的.srt字幕基本上都是GBK码,所以在初装VLC后的默认状态下,加载.srt字幕都会出现乱码。VLC播放器中文字幕乱码问题解决方法如下正如上面所说的,VL…

    2022年7月11日
    44

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号