Centos 7 PHP开发环境搭建
来源:互联网 发布:学淘宝美工需要多少钱 编辑:程序博客网 时间:2024/06/07 06:14
软件包安装
安装Apache
shell# yum install httpd
安装完成之后使用以下命令查看Apache版本
shell# apachectl -v
安装MySQL
由于Centos不再提供MySQL安装包,需要配置yum源
shell# wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpmshell# rpm -ivh mysql57-community-release-el7-7.noarch.rpm
接下来安装MySQL
shell# yum install mysql-community-server
安装PHP
由于Centos 7提供的PHP版本与需求不一致,需要配置第三方yum源
shell# wget https://mirror.webtatic.com/yum/el7/epel-release.rpmshell# wget https://mirror.webtatic.com/yum/el7/webtatic-release.rpmshell# rpm -ivh epel-release.rpmshell# rpm -ivh webtatic-release.rpm
安装PHP及一些需要的扩张
shell# yum install php56w php56w-mysqlnd php56w-gd php56w-mbstring
PHP配置
#/etc/php.inidate.timezone = Asia/Shanghai
MySQL配置
配置默认字符集
#/etc/my.cnf#在mysqld下添加character_set_server配置参数[mysqld]#...character_set_server=utf8#...#添加mysql和client配置项,并设置默认字符集[mysql]default-character-set = utf8[client]default-character-set = utf8
设置root用户密码
启动mysql服务
shell# service mysqld start
从/var/log/mysqld.log查找默认的root用户密码
shell# grep 'temporary password' /var/log/mysqld.log
修改密码
shell# mysqladmin -uroot -p 'old-password' password 'new-password'
配置sql_mode
在开发过程中,因为不全用select字句中的列作为group by字句的参数,因此需要把ONLY_FULL_GROUP_BY配置参数去掉。
在MySQL终端使用以下命令查看当前的sql_mode配置,将ONLY_FULL_GROUP_BY以外的配置参数复制下来
mysql> select @@GLOBAL.sql_mode
将上面复制下来的内容填写到MySQL配置文件中
#/etc/my.cnf#在mysqld下添加sql_mode配置参数[mysqld]#...sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
其他
开放80端口。因为Centos 7默认只开放了ssh访问端口,想要访问WEB服务器,需在iptables中打开80端口。
shell# iptables -A IN_public_allow -p tcp -m tcp --dport 80 -m conntrack --ctstate NEW -j ACCEPT
配置httpd开机启动。安装Apache服务后并没有自动将httpd服务添加到开机启动配置中,因此需手动配置。
shell# systemctl enable httpd
目录写入权限。因为Centos默认开启SELinux,因此如果想在WEB目录下写入文件(如缓存/日志文件),则需要给该目录设置SELinux对应的权限。如下:
shell# chcon -R -t httpd_sys_content_rw_t runtimeshell# chmod 757 runtime
0 0
- Centos 7 PHP开发环境搭建
- Centos-6.5php开发环境搭建过程
- CentOS 7 开发环境搭建
- CentOS PHP环境搭建
- CentOS搭建php开发环境(安装apache,mysql,php)
- CentOS开发环境搭建
- Centos开发环境搭建
- CentOS 开发环境搭建
- Linux(centos)下用vim搭建php开发环境IDE
- centos 6.4下搭建Apache + php + mysql 开发环境
- 云主机服务器centos搭建PHP开发环境
- 【机器学习】Centos下搭建php ocr开发环境
- CentOS 7下搭建java开发环境
- CentOS 7快速搭建Nodejs开发环境
- centos 7 搭建dpdk开发环境
- centos 搭建php服务器环境
- CentOS 上php环境搭建
- centOs安装搭建php环境
- 原生JS根据元素id调用元素事件无效的问题
- iOS 分类之NSString+MD5
- MySQL----error:no query specified
- iOS 7系列译文:忘记NSURLConnection,拥抱NSURLSession吧!
- Java设计模式(四):原型模式深拷贝的两种实现方式,以及和new对象的性能测试对比
- Centos 7 PHP开发环境搭建
- NSDictionary初始化的坑
- Matlab中读取txt文件的几种方法
- Java抽象类的学习
- 【深入浅出Node.js系列七】Connect模块解析
- AR涂色类app使用ShareRec录制及分享视频
- 多线程如何实现同步
- webstorm常用快捷键
- <快速幂模> HDU 2035