LAMP
2024-06-28 16:02:00
供稿:網友
準備工作:yun isntall -y gcc gcc-c++ cmake bison python-devel ncurses-devel Apache的安裝1.cp -r /lamp/aPR-1.4.6 /lamp/httpd-2.4.7/srclib/apr cp -r /lamp/apr--util-1.4.6 /lamp/httpd-2.4.7/srclib/apr-util2.cd pcre-8.34 ./configure && make && make install3.cd httpd-2.4.7 ./configure --prefix=/usr/local/apache2/ --sysconfdir=/usr/local/apache2/etc/ --with-include-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared make make install4.(7) 把httpd添加到系統服務中a) cp /usr/local/Apache2/bin/apachectl /etc/init.d/b) mv /etc/init.d/apachectl /etc/init.d/httpdc) vim /etc/init.d/httpd 在第一行#!/bin/sh下增加兩行文字:1. # chkconfig: 35 70 302. # description: Apached) chkconfig --add httpde) chkconfig --level 35 httpd onf) vim /etc/profilei. export PAHT="/usr/local/apache/bin:$PATH"g) source /etc/profileh) service httpd start(8) 報錯AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this messageapache 啟動出現這種錯誤的解決方法:將 apache 的配置文件httpd.conf中的 ServerName 改成可用域名或如下配置ServerName localhost:80MySQL的安裝1.安裝ncurses的安裝cd /lamp/ncurses-5.9./configure -with-shared --without-debug --without-ada --enable-overwritemake && make install 2.mysql的安裝添加用戶和用戶組:groupadd mysql useradd -r -g mysql mysqlcmake預編譯:cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306 -DENABLE_DOWNLOADS=1make && make install初始化數據庫:cd /usr/local/mysql && scrpts/mysql_install_db --user=mysql修改權限:chown -Rf mysql:mysql /usr/local/mysql將mysql添加到系統服務中,開機啟動:cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql && chkconfig --add mysql && chkconfig --level 2345 mysqld on添加PATH:vim /etc/profile 在文件最后添加export PATH="/usr/local/mysql/bin:$PATH" source /etc/profilemysql的啟動:service mysql start修改密碼:/usr/local/mysql/bin/mysqladmin -u root passWord root php的安裝libxml2的安裝:./configure --prefix=/usr/local/libxml2 && make && make installlibmcrypt的安裝./configure --prefix=/usr/local/libmcrypt/ && make && make installlibltdl的安裝./configure --enable-ltdl-install && make && make installmhash的安裝./configure && make && make installmcrypt的安裝LD_LIBRARY_PATH=/usr/local/libmcrypt/lib:/usr/local/lib ./configure --with-libmcrypt-prefix=/usr/local/libmcrypt && make && make installzlib的安裝./configure && make && make installlibpng的安裝./configure --prefix=/usr/local/libpng && make && make installjpeg的安裝mkdir -p /usr/local/jpeg7/bin/ /usr/local/jpeg7/lib/ /usr/local/jpeg7/include/ /usr/local/jpeg7/man/man1/ && ./configure --prefix=/usr/local/jpeg7/ --enable-shared --enable-static && make && make install freetype的安裝./configure --prefix=/usr/local/freetype/ && make && make install gd的安裝./configure --prefix=/usr/local/gd2/ --with-jpeg=/usr/local/jpeg7/ --with-freetype=/usr/local/freetype/ --with-png=/usr/local/libpng/ && make && make installphp的安裝:./configure --prefix=/usr/local/php --with-config-file-path/usr/local/php/etc/ --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/ --with-libxml-dir=/usr/local/libxml2/ --with-jpeg-dir=/usr/local/jpeg7/ --with-png-dir=/usr/local/libpng/ --with-mcrypt=/usr/local/libmcrypt/ --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-soap --enable-mbstring=all --enable-sockets --with-pdo-mysql=/usr/local/mysql --without-pear && make && make install生成php.ini:mkdir /usr/local/php/etc/ cp /lamp/php-5.6/php.ini-production /usr/local/php/etc/php.ini編輯/usr/local/apache2/etc/http.confAddType application/x-httpd-PHP .phpLoadModule php5_module modules/libphp5.so<IfModule mod_php5.c> AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps </IfModule>測試phpvim /usr/local/apache2/htdoc/index.php<?phpphpinfo();?>memcache的安裝/usr/local/php/bin/phpize && ./configure --with-php-config=/usr/local/php/bin/php-config && make && make installmcrypt的安裝/usr/local/php/bin/phpize && ./configure --with-php-config=/usr/local/php/bin/php-config --with-mcrypt=/usr/local/libmcrypt/ && make && make install修改php.ini在vim中輸入set nu命令 在732行左右找到extension_dir="./",把它修改為memcache擴展的安裝位置:extension_dir="/usr/local/php/lib/php/extension/no-debug-zts-20130605",并把前面的";"去掉。并在下面添加:extension="memcache.so";extension="mcrypt.so"; 重啟apache。安裝memcache源代碼把yum源配置成http://mirrors.163.com/centos/6/os/x86_64/,安裝libevent* yum install -y libevent-devel libevent-header libevent-doc./configure --prefix=/usr/local/memcache && make && make install添加用戶:useradd -r memcache啟動:/usr/local/memcache/bin/memcached -u memcache &