Centos 6 5下的LAMP環境搭建

2021-09-20 22:18:15 字數 2336 閱讀 5615

安裝步驟:

必須先安裝apache或者mysql,之後才能安裝php

1. 安裝mysql

cd /usr/local/src/

wget

(wget

tar zxvf/usr/local/src/mysql-5.1.72-linux-x86_64-glibc23.tar.gz

mv mysql-5.1.72-linux-x86_64-glibc23/usr/local/mysql

useradd -s /sbin/nologin mysql

cd /usr/local/mysql

mkdir -p /data/mysql

chown -r mysql:mysql /data/mysql

./scripts/mysql_install_db --user=mysql--datadir=/data/mysql

cp support-files/my-large.cnf /etc/my.cnf

cp support-files/mysql.server/etc/init.d/mysqld

chmod 755/etc/init.d/mysqld

vim /etc/init.d/mysqld   #修改datadir

{basedir=/usr/local/mysql

{datadir=/data/mysql

chkconfig --add mysqld

chkconfig mysqld on

service mysqld start

2. 安裝apache

注:重啟不了?

出現:httpd:couldnot reliably detemire the server's fally qualified domain name

解決:vim/usr/local/apache2/conf/httpd.conf

將#servernamelocalhost:80前的#去掉即可。

3.  安裝php

wget

tar zxf php-5.4.35.tar.gz

cd php-5.4.35

./configure  --prefix=/usr/local/php   --with-apxs2=/usr/local/apache2/bin/apxs \

--with-config-file-path=/usr/local/php/etc   --with-mysql=/usr/local/mysql\

--with-libxml-dir   --with-gd  --with-jpeg-dir   --with-png-dir \

--with-freetype-dir   --with-iconv-dir   --with-zlib-dir   --with-bz2 \

--with-openssl   --with-mcrypt   --enable-soap   --enable-gd-native-ttf \

--enable-mbstring   --enable-sockets   --enable-exif   --disable-ipv6

注:出現錯誤大多為依賴包沒有安裝,只許yum裝上依賴包即可

若出現:configure:error: mcrypt.h not found. please reinstall libmcrypt.

則需要:1、rpm -ivh ""(centos6系列64位)

rpm -ivh " "(32位)

2、yum install -y  libmcrypt-devel

make&& make install

apache

與php

之間的連線(

php解析)

2、找到

directoryindex index.html 改為

directoryindex index.html index.htm index.php

CentOS 6 5 搭建 LAMP 環境

目錄 第一步 安裝和配置apache伺服器 第二步 設定 繫結站點目錄檔案 第三步 安裝mysql資料庫 第四步 安裝php環境 總結 begin 第一步 安裝和配置apache伺服器 yum update 更新 yum yum install httpd 使用 yum 安裝 httpd httpd...

Centos6 5 原始碼安裝LAMP

z開始安裝之前解除安裝預裝的httpd mysql php。root賬戶下執行rpm qa grep http rpm qa grep mysql rpm qa grep php,檢查是否有預裝的httpd mysql php。執行rpm e nodeps 命令,解除安裝預裝的軟體。準備工作 移動a...

完美搭建lamp環境 centos6 5

一.安裝mysql 1.安裝mysql 2.啟動mysql etc init.d mysqld start 這裡不詳細講解mysql的密碼修改,遠端登入的設定,可以看 rpm方式安裝mysql5.6 其中有詳細的說明。二 安裝 apache 元件 1.安裝apache 2.啟動 apache 注意 ...