这篇文章给大家分享的是如何在云服务器配置php环境?小编觉得挺实用的,因此分享给大家做个参考,文中的介绍得很详细,而要易于理解和学习,有需要的朋友可以参考,接下来就跟随小编一起了解看看吧。
购买好之后选择安装:
点登陆 就可以到linux的操作界面了
进入操作界面
输入root账号密码取得权限之后就可以开始配置环境了
Apache安装
yum install httpd
启动
systemctl start httpd.service #启动
systemctl stop httpd.service #停止
systemctl restart httpd.service #重启
设置开机启动/关闭
systemctl enable httpd.service #开机启动
systemctl disable httpd.service #开机不启动
检查httpd状态
systemctl status httpd.service
关闭防火墙
关闭:systemctl stop firewalld.service
查看状态:systemctl status firewalld.service
PHP安装
yum -y install php
php各项服务安装:
yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel php-mysql
安装MariaDB数据库
CentOS 7.0中,已经使用MariaDB替代了MySQL数据库,原因你懂的,MYSQL被Oracle收购以后,前景堪忧,所以MYSQL兄弟MariaDB就出来了,继续开源事业。
安装:yum -y install mariadb-server mariadb-client
启动:systemctl start mariadb.service
停止:systemctl stop mariadb.service
查看状态:systemctl status mariadb.service
开机启动:systemctl enable mariadb.service
重启:systemctl restart mariadb.service
网站文件夹:
/var/www/html
然后把你的PHP文件上传到html文件夹里去浏览器中输入主机IP就可以了
还有个比较简单的方法就是用WDCP云主机服务器管理系统,这个系统集成了PHP的运行环境非常方便。
安装好了之后输入ip地址+端口8080就可以进入操作界面了。
嗯OK了登陆进去按照你的需要去上传网页配置数据库就好了。
上述内容具有一定的借鉴价值,感兴趣的朋友可以参考,希望能对大家有帮助。