码迷,mamicode.com
首页 > Web开发 > 详细

centos6.5 x86_64下yum安装lnmp+phpmyadmin

时间:2015-07-25 23:08:13      阅读:383      评论:0      收藏:0      [点我收藏+]

标签:

平台:centos6.5 x86_64

1,关闭SElinux

vi /etc/selinux/config

将SELINUX=enforcing改为SELINUX=disabled

reboot


2,添加yum源

rpm -Uvh http://mirrors.yun-idc.com/epel/6/x86_64/epel-release-6-8.noarch.rpm

rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm


3,安装基本库

yum -y install gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl–devel pcre pcre-devel


4,安装mysql和nginx

yum install -y nginx mysql mysql-server mysql-devel


5,安装php

yum install -y php php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt libmcrypt-devel php-fpm


6,配置mysql

chkconfig mysqld on

service mysqld start

为root账户设置密码

mysql_secure_installation

/usr/local/mysql/bin/mysql -u root -p 输入密码

GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘password‘;

FLUSH PRIVILEGES;


7,配置PHP

chkconfig php-fpm on


cp /etc/php.ini /etc/php.ini.bk

sed -i ‘s/;date.timezone =/date.timezone = PRC/g‘ /etc/php.ini

sed -i ‘s/; cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g‘ /etc/php.ini

sed -i ‘s/; cgi.fix_pathinfo=0/cgi.fix_pathinfo=0/g‘ /etc/php.ini

sed -i ‘s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g‘ /etc/php.ini

sed -i ‘s/max_execution_time = 30/max_execution_time = 300/g‘ /etc/php.ini

sed -i ‘s/disable_functions =.*/disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server/g‘ /etc/php.ini


cp /etc/php-fpm.d/www.conf /etc/php-fpm.d/www.confbak

vi /etc/php-fpm.d/www.conf

#修改用户为nginx

user = nginx

#修改组为nginx

group = nginx


service php-fpm start


8,配置nginx

chkconfig nginx on


cp /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.confbak

vi /etc/nginx/conf.d/default.conf

#location / {

root   /usr/share/nginx/html;

index  index.php index.html index.htm;

#}

修改以下代码

# location ~ \.php$ {

#    root       html;

#    fastcgi_pass   127.0.0.1:9000;

#    fastcgi_index  index.php;

#    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

#    include        fastcgi_params;

#}

去掉除root行外的#,/scripts 改成$document_root


service nginx start


9,测试

vi /usr/share/nginx/html/index.php

<?php

$link=mysql_connect("localhost","root","password","mysql");

echo ‘<br/>‘;

if($link){

      echo ‘connection is ok‘;

      mysql_close($link);

}

else

    echo ‘try config again‘;

?>


显示connection is ok,说明php和mysql已整合,留意iptables状态


10,加上phpmyadmin,安装完php是5.3.3,mysql 5.1.73,根据mysql版本下载对应的phpmyadmin版本,http://www.phpmyadmin.net/downloads/


wget https://files.phpmyadmin.net/phpMyAdmin/4.0.10.10/phpMyAdmin-4.0.10.10-all-languages.zip

tar zxvf phpMyAdmin-4.0.10.10-all-languages.tar.gz

mv phpMyAdmin-4.0.10.10-all-languages phpmyadmin

mv phpmyadmin /usr/share/nginx/html/


chown -R nginx.nginx /var/lib/php/session


OK,http://yourserverip/phpmyadmin,输入MySQL用户名和密码,enjoy it.

php的扩展模块需要再自行添加并修改配置哈


centos6.5 x86_64下yum安装lnmp+phpmyadmin

标签:

原文地址:http://my.oschina.net/u/2404183/blog/483745

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!