1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
| 安装gcc sudo apt-get install build-essential 编译安装APR wget http://mirrors.hust.edu.cn/apache//apr/apr-1.5.2.tar.gz sudo mv apr-1.5.2.tar.gz /usr/local/src/ sudo tar -zxvf apr-1.5.2.tar.gz cd apr-1.5.2/ sudo ./configure -prefix=/usr/local/apr sudo make sudo make install 再编译安装apr-util sudo wget http://www.apache.org/dist/apr/apr-util-1.5.4.tar.bz2 sudo tar -jxvf apr-util-1.5.4.tar.bz2 cd apr-util-1.5.4/ sudo ./configure -prefix=/usr/local/apr-util --with-apr=/usr/local/apr sudo make sudo make install 再编译安装pcre sudo wget http://exim.mirror.fr/pcre/pcre-8.35.tar.gz sudo tar -zxvf pcre-8.35.tar.gz cd pcre-8.35/ sudo ./configure -prefix=/usr/local/pcre sudo make sudo make install 安装zlib-devel sudo apt-get install zlib1g-dev wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.4.20.tar.bz2 tar xvf httpd-2.4.20.tar.bz2 cd httpd-2.4.20/ sudo ./configure -prefix=/usr/local/apache2 --enable-deflate --enable-expires --enable-headers --enable-modules=most --enable-so --with-mpm=worker --enable-rewrite --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre echo $? [检查是否有错误,返回0说明没问题了] sudo make sudo make install
启动apache sudo vi /usr/local/apache2/conf/httpd.conf #ServerName www.example.com:80 => ServerName localhost:80 sudo /usr/local/apache2/bin/apachectl start 安装php前 sudo apt-get install openssl sudo apt-get install libssl-dev sudo apt-get install curl sudo apt-get install libcurl4-gnutls-dev sudo apt-get install libjpeg-dev sudo apt-get install libpng-dev sudo apt-get install libmcrypt4 sudo apt-get install libmcrypt-dev sudo apt-get install libreadline6 libreadline6-dev sudo apt-get install libxml2 sudo apt-get install libxml2-dev sudo apt-get -y install libfreetype6-dev scp /Users/youwenzhang/USVN/MyRepositories/IKPCP-M/部署\&升级/ccsinstall/src/libmcrypt-2.5.8.tar.gz youwenzhang@172.16.37.14:/home/youwenzhang sudo wget http://vorboss.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz sudo wget http://heanet.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz sudo tar -zxvf libmcrypt-2.5.8.tar.gz cd libmcrypt-2.5.8 sudo ./configure sudo make sudo make install sudo tar -zxvf mhash-0.9.9.9.tar.gz cd mhash-0.9.9.9/ sudo ./configure sudo make sudo make install sudo tar -zxvf mcrypt-2.6.8.tar.gz cd mcrypt-2.6.8/ sudo LD_LIBRARY_PATH=/usr/local/lib ./configure sudo make sudo make install
安装php tar -jxvf php-7.0.6.tar.bz2 cd php-7.0.6/ sudo ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-shared --enable-opcache --with-mysql --with-mysqli --with-mysql-sock --enable-pdo --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --disable-fileinfo --enable-maintainer-zts sudo make sudo make install sudo cp php.ini-development /usr/local/php/etc/php.ini
编辑 httpd.conf 文件以调用 PHP 模块 sudo vi /usr/local/apache2/conf/httpd.conf LoadModule php7_module modules/libphp7.so 告知 Apache 将特定的扩展名解析成 PHP <FilesMatch \.php$> SetHandler application/x-httpd-php </FilesMatch>
sudo /usr/local/apache2/bin/apachectl stop sudo /usr/local/apache2/bin/apachectl start
开机启动: sudo cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd sudo ln -s /etc/init.d/httpd /etc/rc2.d/S80httpd sudo service httpd start sudo service httpd stop 删除: sudo update-rc.d -f httpd remove
|