centos7安装php环境_docker搭建php开发环境

centos7安装php环境_docker搭建php开发环境centos7php环境手动搭建:1.先安装apache:yum安装yuminstallhttpd进入配置文件vi/etc/httpd/conf/httpd.conf(/etc/httpd/conf/httpd.conf为配置文件位置)apache默认就是使用80端口防火墙开启80端口(一般例如在阿里云网站控制台直接开启即可)服务器常用指令:linux常用服务的启动、停止、重启操作服务/操作 启动 停止 重启apache systemctlstarthttpd开启

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

centos7 php环境手动搭建:

1.先安装apache:

yum安装
yum install httpd
进入配置文件
vi /etc/httpd/conf/httpd.conf( /etc/httpd/conf/httpd.conf为配置文件位置)
apache默认就是使用80端口
防火墙开启80端口(一般例如在阿里云网站控制台直接开启即可)

服务器常用指令:

linux常用服务的启动、停止、重启操作
服务/操作 启动 停止 重启
apache
systemctl start httpd 开启
systemctl stop httpd 停止
systemctl restart httpd 重启

nginx
systemctl start nginx 开启
systemctl stop nginx 停止
systemctl restart nginx 重启

mysql
systemctl start mysqld 开启
systemctl stop mysqld 停止
systemctl restart mysqld 重启

设置开机启动/关闭

systemctl enable httpd.service #开机启动
systemctl disable httpd.service #开机不启动
其他类似

查询端口是否开放

firewall-cmd –query-port=8080/tcp

开放80端口

firewall-cmd –permanent –add-port=80/tcp

移除端口

firewall-cmd –permanent –remove-port=8080/tcp

重启防火墙(修改配置后要重启防火墙)

firewall-cmd –reload

参数解释

1、firwall-cmd:是Linux提供的操作firewall的一个工具;
2、–permanent:表示设置为持久;
3、–add-port:标识添加的端口;

开启

service firewalld start

重启

service firewalld restart

关闭

service firewalld stop

systemctl status httpd.service
systemctl start mysqld.service #启动mysql服务
systemctl status mysqld.service #查看mysql服务状态

解决方案:

开启httpd

systemctl start httpd.service

进入httpd.conf文件

vi /etc/httpd/conf/httpd.conf
更改监听端口
更改监听端口

更改文件路径
更改文件路径
更改路径下执行文件名(my.php)
在这里插入图片描述
配置好保存退出

启动服务

systemctl start httpd.service

安装mysql

yum install mysql mysql-server
不多解释

yum安装php

yum install php php-devel

重启apache 使之生效

systemctl restart httpd.service

/var/www/html/下建立一个PHP文件(my.php)

内容 <?php phpinfo(); ?>

重启apache 浏览器输入IP即可看见PHP页面

安装PHP扩展

yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc

重启apache : systemctl restart httpd.service

测试MYSQOL连接

<?php $servername = “localhost”; $username = “username”; $password = “password”; // 创建连接 $conn = new mysqli($servername, $username, $password); // 检测连接 if ($conn->connect_error) { die(“连接失败: ” . $conn->connect_error); } echo “连接成功”; ?>

放在新的.php文件下 更改配置文件即可在浏览器下看见测试结果

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/190645.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • oracle 查询指定约束的关联表

    oracle 查询指定约束的关联表

    2021年8月26日
    62
  • MySQL安装配置教程(超级详细、保姆级)

    MySQL安装配置教程(超级详细、保姆级)一、下载MySQLMysql官网下载地址https://downloads.mysql.com/archives/installer/1.选择想要安装的版本,本篇文章选择的是5.7.31版本,下面的那个文件,点击Download下载二、安装MySQL1.选择设置类型双击运行mysql-installer-community-5.7.31.0.msi这里选择是自定义安装,所以直接选择“Custom”,点击“Next”“DeveloperDefault”是开发者默认

    2022年5月31日
    43
  • wmic创建进程

    wmic创建进程wmic node ip user user password password Servicewhere W3SVC callstopserv node ip user user password password Servicewhere W3SVC callstartser node ip user user password password processwhere

    2025年8月12日
    4
  • RewriteCond 详解「建议收藏」

    RewriteCond 详解「建议收藏」RewriteCond重写规则执行条件语法:RewriteCondTestStringCondPattern生效域:serverconfig,virtualhost,directory,.htaccess特别的上面的TestString,可提供反向引用.引用模式为:%N其中N为(0&lt;=N&lt;=9),引用当前若干Rew…

    2022年6月14日
    25
  • [TensorFlow 学习笔记-02]配置PyCharm IDE环境「建议收藏」

    [TensorFlow 学习笔记-02]配置PyCharm IDE环境「建议收藏」工欲善其事必先利其器,IDE我选择的是PyCharm。[本地环境]操作系统:Windows7bit[PyCharm下载地址]下载地址:http://www.jetbrains.com/pycharm/download/#section=windows选择版本:Community,具体如下图所示:**[安装PyCharm]**采用默认安装方式,安装成功后,首次出现如下界面,Cr

    2022年8月26日
    4
  • ABAP调用外部接口

    ABAP调用外部接口DATA:lc_http_clientTYPEREFTOif_http_client,LENTYPEI,”发送报文长度l_json_dataTYPEstring,l_json_stringTYPEstring,l_result_dataTYPEstring,l_urlTYPEstring.DATAlc_jsonTYP..

    2022年5月10日
    77

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号