首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 編程語言 >  >> 網頁程式設計 >> PHP 程式設計 >> PHP 相關知識

Red Hat Linux 9 文字模式下從源碼編譯安裝 LAMP 完整實錄

     編輯:PHP 相關知識

環境規格

  • OS:Red Hat Linux 9,內核 2.4.20-8,純文本模式
  • CPU:Celeron 1.8GHz,RAM:128MB,Disk:40GB

軟件版本與下載

  • Apache 2.2.6:https://httpd.apache.org/download.cgi
  • MySQL 5.0.x:https://dev.mysql.com/downloads/mysql/5.0.html
  • PHP 5.2.x:https://www.php.net/downloads.php

編譯安裝流程

  1. 安裝依賴庫:openssl-devel、zlib-devel、pcre-devel、libxml2-devel、curl-devel、gd-devel 等(使用 up2date 或 RPM)。
  2. MySQL:
    ./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-collation=utf8_general_ci \
        --with-extra-charsets=all --enable-thread-safe-client
    make && make install
    /usr/local/mysql/bin/mysql_install_db --user=mysql
    chown -R mysql:mysql /usr/local/mysql
    cp support-files/my-medium.cnf /etc/my.cnf
    /usr/local/mysql/bin/mysqld_safe --user=mysql &
    
  3. Apache:
    ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --enable-ssl --with-mpm=prefork
    make && make install
    
  4. PHP:
    ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs \
        --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config \
        --with-pdo-mysql=/usr/local/mysql --with-gd --with-jpeg-dir --with-png-dir \
        --with-freetype-dir --with-zlib --with-curl --with-openssl --enable-mbstring \
        --enable-sockets --enable-ftp --enable-bcmath
    make && make install
    cp php.ini-dist /usr/local/php5/lib/php.ini
    
  5. 整合驗證:修改 httpd.conf 添加 AddType application/x-httpd-php .php,重啟 Apache,瀏覽 phpinfo() 確認模塊載入。

自啟動配置

將 /usr/local/apache2/bin/apachectl start、/usr/local/mysql/bin/mysqld_safe --user=mysql & 加入 /etc/rc.d/rc.local。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved