阿里云服务器 安装 nginx+php+mysql———-第二步安装php和mysql

By | 2013 年 3 月 16 日

文本内容如下:

配置php

没有安装mysql
./configure --prefix=/mnt/web/php --with-config-file-path=/mnt/web/php --with-openssl --with-zlib --with-curl --enable-gd-native-ttf --with-mysql --with-bz2 --with-gd --enable-mbstring --with-mcrypt --with-mysqli --enable-embedded-mysqli --enable-zip --enable-fpm --with-zlib --enable-mbstring --enable-sockets --with-png-dir --with-freetype-dir=/usr/include/freetype2/freetype/ --with-iconv-dir --with-jpeg-dir --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization  --enable-mbregex --with-mhash --enable-pcntl  --with-xmlrpc  --enable-pdo --with-pdo-mysql --with-pdo-sqlite

已经安装了Mysql的话
./configure --prefix=/mnt/web/php --with-config-file-path=/mnt/web/php --with-openssl --with-zlib --with-curl --enable-gd-native-ttf --with-mysql=/mnt/web/mysql --with-libxml --with-bz2 --with-gd --enable-mbstring --with-mcrypt --with-mysqli=/mnt/web/mysql/bin/mysql_config --enable-embedded-mysqli --enable-zip --enable-fastcgi --enable-fpm --with-zlib --enable-mbstring --enable-pic --with-xml --enable-sockets --with-png-dir --with-freetype-dir=/usr/include/freetype2/freetype/ --with-iconv-dir --with-jpeg-dir --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curlwrappers --enable-mbregex --with-mhash --enable-pcntl --with-ldap-dir=/usr/lib64 --with-xmlrpc --with-gd
configure: error: xml2-config not found. Please check your libxml2 installation.
yum -y install libxml2
yum -y install libxml2-devel

configure: error: Please reinstall the BZip2 distribution
wget http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz
tar -zxvf bzip2-1.0.6.tar.gz
cd bzip2-1.0.6
make
make install

configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/
wget http://curl.haxx.se/download/curl-7.29.0.tar.gz
tar -zxvf curl-7.29.0.tar.gz
cd curl-7.29.0
./configure
make
make install

yum -y install libjpeg
yum -y install libpng
yum -y install freetype
yum install libpng-devel-1.2.49-1.el6_2.x86_64
yum install freetype-devel-2.3.11-14.el6_3.1.x86_64
yum install libjpeg-turbo-devel-1.2.1-1.el6.x86_64
yum install openldap
yum install openldap-clients
yum install openldap-devel
yum install openldap-servers

configure: error: mcrypt.h not found. Please reinstall libmcrypt.

wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
tar -zxvf libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7
./configure
make
make install
ok配置通过

make
make install

复制php.ini到php安装目录
cp php.ini-production /mnt/web/php/php.ini
系统带有系统服务注册文件
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

chmod +x /etc/init.d/php-fpm

chkconfig --add php-fpm

chkconfig --level 2345 php-fpm on
、、、、
Wrote PEAR system config file at: /mnt/web/php/etc/pear.conf
You may want to add: /mnt/web/php/lib/php to your php.ini include_path
/mnt/tmp/php-5.4.13/build/shtool install -c ext/phar/phar.phar /mnt/web/php/bin
ln -s -f /mnt/web/php/bin/phar.phar /mnt/web/php/bin/phar
Installing PDO headers: /mnt/web/php/include/php/ext/pdo/

、、、、
MYsql
新版本的MYsql 使用cmake来编译
wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz
cd cmake-2.8.10.2.tar.gz
cd cmake-2.8.10.2
./configure
make
make install

wget http://www.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.10.tar.gz/from/http://cdn.mysql.com/

tar -zxvf mysql-5.6.10.tar.gz
cd mysql-5.6.10

cmake -DCMAKE_INSTALL_PREFIX=/mnt/web/mysql -DMYSQL_DATADIR=/mnt/web/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1 -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock

报错。 remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.

yum -y install ncurses-devel
rm -f CMakeCache.txt
重新cmake
然后make
make install

配置mysql系统自动启动

cp /mnt/web/mysql/support-files/mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql

chkconfig --add mysql

chkconfig --level 2345 mysql on

建立user和group,执行配置脚本

groupadd mysql

useradd -g mysql mysql

chown mysql:mysql /mnt/web/mysql/data

chmod 755  /mnt/web/mysql/data

./mysql_install_db --user=mysql --basedir=/mnt/web/mysql --datadir=/mnt/web/mysql/data

service mysql start

修改mysql登陆密码和远程连接

/mnt/web/mysql/bin/mysql -u root mysql

mysql>use mysql;
mysql>desc user;
mysql> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "root";  //为root添加远程连接的能力。
mysql>update user set Password = password('xxxxxx') where User='root';
mysql>select Host,User,Password from user where User='root';
mysql>flush privileges;
mysql>exit

 

发表回复

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据