• centos手动编译安装apache、php、mysql


    64位centos 5.5手动安装lamp,要求curl、json、pdo_mysql、gd,记录如下。

    centos 5.4、5.5、5.6的内核都是2.6.18,都可以安装php 5.3。

    卸载旧版本apache、php、mysql:
    sudo yum erase httpd
    sudo yum erase php php-cli
    sudo yum erase mysql
    下载编译安装apache 2.2.19:
    http://httpd.apache.org/download.cgi

    cd ~
    wget http://mirror.bjtu.edu.cn/apache/httpd/httpd-2.2.19.tar.bz2
    tar -jxvf httpd-2.2.19.tar.bz2
    cd httpd-2.2.19
    sudo yum install gcc
    ./configure --prefix=/opt/httpd --enable-so --enable-rewrite
    make
    sudo make install
    sudo /opt/httpd/bin/httpd -k start
    安装完apache,用浏览器访问http://localhost,能正常显示说明装好了。

    下载安装mysql 5.5.13:
    http://dev.mysql.com/downloads/mysql/#downloads

    下载这2个(64位的): MySQL-client MySQL-server

    sudo yum install libaio
    sudo rpm -i MySQL-client-5.5.13-1.rhel5.x86_64.rpm
    sudo rpm -i MySQL-server-5.5.13-1.rhel5.x86_64.rpm
    sudo /etc/init.d/mysql start
    /usr/bin/mysqladmin -u root password '1'
    sudo cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
    sudo /etc/init.d/mysql restart
    mysql -uroot -p1
    下载编译安装php 5.3.6:
    http://php.net/downloads.php

    sudo yum install libxml2 libxml2-devel curl curl-devel libjpeg libjpeg-devel libpng libpng-devel libmcrypt libmcrypt-devel libtool-ltdl-devel
    tar -jxvf php-5.3.6.tar.bz2
    cd php-5.3.6
    ./configure --prefix=/opt/php -with-apxs2=/opt/httpd/bin/apxs --with-curl --with-mcrypt --enable-mbstring --with-iconv --with-gd -with-jpeg-dir=/usr/local/lib --enable-pdo --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd
    make
    sudo make install
    sudo cp php.ini-development /opt/php/lib/php.ini
    sudo ln -s /opt/php/bin/php /usr/bin/php
    sudo vi /opt/php/lib/php.ini

    把include_path前面的分号删除,改成include_path = "/opt/php/lib/php"
    sudo vi /opt/httpd/conf/httpd.conf
    在最下面加入一行AddHandler application/x-httpd-php .php
    sudo /opt/httpd/bin/httpd -k restart
    sudo vi /opt/httpd/htdocs/phpinfo.php
    phpinfo.php的内容如下:

    安装完php,重启apache,用浏览器访问http://localhost/phpinfo.php,能正常显示说明php装好了。搜索mysqlnd、pdo_mysql、mysqli,如果有,则说明php能访问mysql。

    PHP常用配置
    http://www.cnblogs.com/sink_cup/archive/2011/10/28/php_ini.html

    把apache加入系统service,开机自启动
    sudo cp /opt/httpd/bin/apachectl /etc/init.d/httpd
    sudo vi /etc/init.d/httpd
    在文件开头加入下面几行:
    !/bin/sh
    chkconfig: 2345 85 15
    description: Apache is a World Wide Web server.
    sudo chmod +x /etc/init.d/httpd
    sudo /sbin/chkconfig --add httpd
    sudo /sbin/chkconfig --list httpd
    sudo ln -s /sbin/chkconfig /usr/bin/chkconfig
    sudo ln -s /sbin/service /usr/bin/service
    把mysql加入系统service,开机自启动
    sudo /sbin/chkconfig --list mysql
    通过rpm安装的mysql,已经开机自启动了。

    安装php扩展ssh2
    先安装libssh2

    http://sourceforge.net/projects/libssh2/

    ./configure

    make

    sudo make install

    再安装ssh2

    http://pecl.php.net/package/ssh2

    /opt/php/bin/phpize && ./configure --with-ssh2 && make

    sudo make install

    在/opt/php/lib/php.ini中加1行:

    extension=ssh2.so

  • 相关阅读:
    JMeter--聚合报告之 90% Line 正确理解
    jmeter--函数助手对话框之参数详解
    测试理论--如何根据需求设计测试用例
    java jdk 1.6 下载
    linux磁盘满时,如何定位并删除文件
    linux mysql 新增用户 分配权限
    Hibernate 中多对多(many-to-many)关系的查询语句
    springMVC的url-pattern /和/*的区别
    thinkphp多表关联并且分页
    thinkphp 模板里嵌入 php代码
  • 原文地址:https://www.cnblogs.com/chjw8016/p/5926636.html
Copyright © 2020-2023  润新知