zoukankan      html  css  js  c++  java
  • 从0开始LInux配置PHP开发环境

    一、apache安装
    1、yum install lrzsz  这样才能够上传/下载文件
    2、从aPache官网下载tar包:http://mirrors.hust.edu.cn/apache/httpd/ (我下的是:httpd-2.2.31.tar.gz)
    3、将下载下来的安装包 放到 linux中,/usr/apache2.2/ (rz)
    4、 解压 tar -zxvf httpd-2.2.31.tar.gz  -C /usr/apache2.2
    5、建立makefile ./configure --prefix=/usr/local/Apace2.2 --enable-proxy=shared --enable-proxy-balancer=shared --enable-proxy-http=shared --enable-proxy-connect=shared  --enable-asis=shared --enable-isapi=shared  --enable-mods-shared=all --enable-so 
      并编译 make, 再安装 make install(中间需要安装zlib依赖  yum install zlib-devel)
    小插曲:make报错,猜测可能和之前装过有关,清理了原先的目录,再 make clean 重新编译安装
    6、启动APACHE /usr/local/Apace2.2/bin/httpd -k start, curl "http://localhost"  出现it works就是成功。(注意修改httpd.conf中ServerName)
    7、最后 cp /usr/local/Apace2.2/bin/apachectl /etc/init.d/httpd  ,启动文件放进去
    8、设置开机启动

    使用编辑器打开httpd文件,并在第一行#!/bin/sh下增加两行文字如下

    # chkconfig: 35 70 30

    # description: Apache

    接着注册该服务

    chkconfig –add httpd

    二、Mysql安装

    1、Mysql下载:http://dev.mysql.com/downloads/mysql/#downloads

         其中,有三种包,要注意:

         rpm package:是某个特定的包,比如server,client,shared lib等  -- 是的,可以单独安装
         rpm bundle:是该版本所有包的集合                                          --- 一般是把服务器端要用的都安装上,其他的不带,尤其是开发包
         Compressed TAR Archive,是源码,必须用源码方式安装。        ----  这个是源码,需要自己编译的,也有编译好,但不是安装包的

    2、安装参考:(http://jingyan.baidu.com/article/a378c9609eb652b3282830fd.html)

    3、遇到的问题集合

        a、Starting MySQLCouldn't find MySQL server (/usr/local/mysql/[FAILED]ld_safe)

            原因: 在my.cnf中缺少basedir配置 

        [mysqld]
        port            =3306
        socket          =/tmp/mysql.sock
        ############# 添加下面这一条配置###########
        basedir                 =/usr/local/mysql
        b、The server quit without updating PID file (/usr/local/mysql/mysql5.6/data/iZ285yuqecaZ.pid).

        上面a做完后,在./scripts/mysql_install_db --user=mysql 安装mysql

    三、PHP安装
    首先在安装PHP之前必须安装libxml curl  libmcrypt,不然在生成配置文件的时候会各种error
    直接安装:yum install libxml2
                     yum install libxml2-devel -y
                     yum install curl curl-devel
                    yum install php-mcrypt libmcrypt libmcrypt-devel
     2、解压:tar -zxvf /tmp/php-5.4.45.tar.gz -C /usr/sofotware/
    3、生成config配置文件:./configure --prefix=/usr/local/php-5.5.30/ --with-apxs2=/usr/local/Apace2.2/bin/apxs --with-mysql=/usr/local/mysql/mysql5.6/ --with-mysqli=/usr/local/mysql/mysql5.6/bin/mysql_config --enable-soap --enable-mbstring=all --enable-sockets --disable-fileinfo
    4、编译安装:  make;make install;
    5、将 配置文件copy过去 cp php.ini-development /usr/local/lib/php.ini
    6、到apache中配置文件中增加一句话(表示哪些文件需要用php来解析)
         httpd.conf中增加一句 addtype application/x-httpd-php .php
    然后即可测试下,建个index.php,里面write: <?php  phpinfo();?>
    访问测试下

    四、安装PHPMyAdmin 参考:http://jingyan.baidu.com/article/0320e2c1e1fc661b87507b17.html

    1、下载:wget https://files.phpmyadmin.net/phpMyAdmin/4.5.1/phpMyAdmin-4.5.1-all-languages.zip

    2、解压,并放到网站根目录下    

    3、更改配置文件 

      a.打开config.inc.php文件(可以用写字板),找到$cfg['blowfish_secret']=''; 与$cfg['servers'][$i]['auth_type']='cookie';,如果$cfg['servers'][$i] ['auth_type']的值就像前面看到的那样为cookie的话,那么我们必须在$cfg['blowfish_secret']=''的引号中任 意写入一串字符,大家可以把它理解为一个身份验证码。比如$cfg['blowfish_secret']='sunec'。存盘退出。

    到此,LAMP 环境搭建完成

     
     
     
     
     
     
  • 相关阅读:
    HDU 1813 Escape from Tetris
    BZOJ 2276 Temperature
    BZOJ 4499 线性函数
    BZOJ 3131 淘金
    HDU 5738 Eureka
    POJ 2409 Let it Bead
    POJ 1286 Necklace of Beads
    POJ 1696 Space Ant
    Fox And Jumping
    Recover the String
  • 原文地址:https://www.cnblogs.com/wangmy/p/4979492.html
Copyright © 2011-2022 走看看