// 红色加粗是linux命令
安装gcc和gcc-c++
yum -y install gcc gcc-c++
yum list httpd*
安装apche
yum -y install httpd.x86_64 httpd-devel.x86_64 httpd-tools.x86_64
开启服务
/bin/systemctl start httpd.service
停止服务
/bin/systemctl stop httpd.service
设置Apache服务开机启动
systemctl enable httpd.service
默认目录:/var/www/html/
卸载
yum remove httpd
安装mysql
一、检查系统是否安装其他版本的MYSQL数据
yum list installed | grep mysql#yum -y remove mysql-libs.x86_64
二、安装及配置
wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm# rpm -ivh mysql-community-release-el6-5.noarch.rpm
yum repolist all | grep mysql
安装MYSQL数据库
yum install mysql-community-server -y
设置为开机启动(2、3、4都是on代表开机自动启动)
chkconfig --list | grep mysqld# chkconfig mysqld on
三、设置远程root
启动mysql
service mysqld start
设置root密码
mysql_secure_installation
登陆root账号
mysql -uroot -p
建立远程root用户
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你设置的密码' WITH GRANT OPTION;mysql> flush privileges;
四、设置utf-8编码
查看mysql原本编码:
mysql> show variables like 'character%';
mysql> q
设置编码
vim /etc/my.cnf
如下(少补):
[mysqld]character-set-server=utf8 collation-server=utf8_general_ci sql_mode='NO_ENGINE_SUBSTITUTION'
[mysql]default-character-set = utf8[mysql.server]default-character-set = utf8[mysqld_safe]default-character-set = utf8[client]default-character-set = utf8
重启mysql
service mysqld restart
再次查看编码:
mysql -uroot -p
mysql> show variables like 'character%';+--------------------------+----------------------------+| Variable_name | Value |+--------------------------+----------------------------+| character_set_client | utf8 || character_set_connection | utf8 || character_set_database | utf8 || character_set_filesystem | binary || character_set_results | utf8 || character_set_server | utf8 || character_set_system | utf8 || character_sets_dir | /usr/share/mysql/charsets/ |+--------------------------+----------------------------+8 rows in set (0.00 sec)
mysql> q
1.检查当前安装的PHP包
yum list installed | grep php
如果有安装的PHP包,先删除他们
yum remove php.x86_64 php-cli.x86_64 php-common.x86_64 php-gd.x86_64 php-ldap.x86_64 php-mbstring.x86_64 php-mcrypt.x86_64 php-mysql.x86_64 php-pdo.x86_64
2 CentOs 7.X
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
如果想删除上面安装的包,重新安装
rpm -qa | grep webstatic
rpm -e 上面搜索到的包即可
3.运行yum install
yum install php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 php56w-gd.x86_64 php56w-ldap.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64
注:如果想升级到7.0把上面的56w换成70w就可以了。
yum install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64
4.安装PHP FPM,以后需要可以单独安装插件
yum install php56w-fpm
yum install php70w-fpm
djl补充安装的扩展
yum install php56w-xml.x86_64 php56w-xmlrpc.x86_64 php56w-devel.x86_64
yum install php56w-bcmath.x86_64 php56w-odbc.x86_64
安装php完成后,重启apache
/bin/systemctl restart httpd.service
//查看有哪些可以yum安装的扩展
yum list php56w*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* webtatic: uk.repo.webtatic.com
Installed Packages
php56w.x86_64 5.6.35-1.w7 @webtatic
php56w-cli.x86_64 5.6.35-1.w7 @webtatic
php56w-common.x86_64 5.6.35-1.w7 @webtatic
php56w-gd.x86_64 5.6.35-1.w7 @webtatic
php56w-ldap.x86_64 5.6.35-1.w7 @webtatic
php56w-mbstring.x86_64 5.6.35-1.w7 @webtatic
php56w-mcrypt.x86_64 5.6.35-1.w7 @webtatic
php56w-mysql.x86_64 5.6.35-1.w7 @webtatic
php56w-pdo.x86_64 5.6.35-1.w7 @webtatic
Available Packages
php56w-bcmath.x86_64 5.6.35-1.w7 webtatic
php56w-dba.x86_64 5.6.35-1.w7 webtatic
php56w-devel.x86_64 5.6.35-1.w7 webtatic
php56w-embedded.x86_64 5.6.35-1.w7 webtatic
php56w-enchant.x86_64 5.6.35-1.w7 webtatic
php56w-fpm.x86_64 5.6.35-1.w7 webtatic
php56w-imap.x86_64 5.6.35-1.w7 webtatic
php56w-interbase.x86_64 5.6.35-1.w7 webtatic
php56w-intl.x86_64 5.6.35-1.w7 webtatic
php56w-mssql.x86_64 5.6.35-1.w7 webtatic
php56w-mysqlnd.x86_64 5.6.35-1.w7 webtatic //安装报错
php56w-odbc.x86_64 5.6.35-1.w7 webtatic
php56w-opcache.x86_64 5.6.35-1.w7 webtatic
php56w-pear.noarch 1:1.10.4-1.w7 webtatic
php56w-pecl-apcu.x86_64 4.0.11-2.w7 webtatic
php56w-pecl-apcu-devel.x86_64 4.0.11-2.w7 webtatic
php56w-pecl-gearman.x86_64 1.1.2-1.w7 webtatic
php56w-pecl-geoip.x86_64 1.1.1-1.w7 webtatic
php56w-pecl-igbinary.x86_64 2.0.5-1.w7 webtatic
php56w-pecl-igbinary-devel.x86_64 2.0.5-1.w7 webtatic
php56w-pecl-imagick.x86_64 3.4.3-1.w7 webtatic
php56w-pecl-imagick-devel.x86_64 3.4.3-1.w7 webtatic
php56w-pecl-libsodium.x86_64 1.0.6-1.w7 webtatic
php56w-pecl-memcache.x86_64 3.0.8-2.w7 webtatic
php56w-pecl-memcached.x86_64 2.2.0-1.w7 webtatic
php56w-pecl-mongodb.x86_64 1.4.1-1.w7 webtatic
php56w-pecl-redis.x86_64 3.1.6-1.w7 webtatic
php56w-pecl-xdebug.x86_64 2.5.5-2.w7 webtatic
php56w-pgsql.x86_64 5.6.35-1.w7 webtatic
php56w-phpdbg.x86_64 5.6.35-1.w7 webtatic
php56w-process.x86_64 5.6.35-1.w7 webtatic
php56w-pspell.x86_64 5.6.35-1.w7 webtatic
php56w-recode.x86_64 5.6.35-1.w7 webtatic
php56w-snmp.x86_64 5.6.35-1.w7 webtatic
php56w-soap.x86_64 5.6.35-1.w7 webtatic
php56w-tidy.x86_64 5.6.35-1.w7 webtatic
php56w-xml.x86_64 5.6.35-1.w7 webtatic
php56w-xmlrpc.x86_64 5.6.35-1.w7 webtatic