怎么安装php环境(怎么安装php环境软件)

在MacM1上安装PHP开发环境

Apple去年年底发布了搭载M1芯片的新款Mac。
最近想换电脑,但想来想去,还是选择了一台M1芯片的Mac。
刚收到的时候还担心软件不兼容,比如网上推荐一台笔记本电脑作为主要开发笔记本电脑,就不推荐M1,但现在开发环境已经完美配置了,离开也没关系。
它。
汽车。
下面简单介绍一下安装过程的步骤。

注意:如果没有安装Brew,则需要先安装Brew,使用Arch-arm64brewinstall。

首先,搜索您要安装的MySQL版本,如下图。

这里选择mysql@5.7版本。
我是本地安装的。

安装完成后,需要添加环境变量,允许任意目录直接访问mysql。

首先查一下PHP是什么版本你有空去看看。
我之前在网上看到过M1,但是还不支持。
对于php7.3及以下版本,已安装php7.4。

安装完成后,即可开始部署项目。
我的项目是用thinkphp框架开发的,用到了redis,所以首先需要安装Redis依赖。

安装PHPredis依赖(这里使用pecl安装,网上有很多编译安装方法)这个方法比较繁琐,需要配置较多,安装pecl快捷方便。

安装完成后,只需配置nginx目录下的项目文件即可。

话不多说,但主要要提的是,需要修改thinkphp框架、重定向配置、位置配置,如下所示。

之后,修改完成。
重新启动服务器并重新启动php-fpm。
这是关键。

如何安装PHP环境?

搭建LAMP/LNMP环境

1.检查系统环境

1.检查centos版本

[root@localhost~]#cat/etc/redhat-release

2.已安装

rpm-qa|grephttpd

或:

apachectl-v

或:

httpd-v

3.检查Mysql是否安装了mysqldstart服务

如果不能识别则没有安装。

系统已安装或如果出现故障,请清理系统。

4.MySQL跟踪

yumremovemysql

rm-f/etc/my.cnf

5.删除Apache软件包

rpm-qa|grephttpd

注意:如果这是一个新系统或者您以前从未尝试过安装,则可以跳过上述步骤

2。
安装Apache、PHP、Mysql

停止防火墙服务

[root@localhost~]#systemctlstopfirewalld.service

禁用防火墙启动服务

[root@localhost~]#systemctldisablefirewalld.service

1.安装Apache

[root@localhost~]#yum-yinstallhttpd

安装php

[root@localhost~]#yum-yinstallphp

3。
安装php-fpm

[root@localhost~]#yum-yinstallphp-fpm

4.安装Mysql

[root@localhost~]#yum-yinstallmysql

5.安装mysql-server

[root@localhost~]#yuminstallmariadb-server

CentOS7+版本将MySQL数据库软件从默认程序列表中删除,并替换为mariadb。
在entos7配置教程中,大多数安装mariadb,因为centos7被设置为默认。
玛丽亚数据库把它想象成mysql。

MySQL被Oracle收购后,原作者担心MySQL会变成闭源,所以又写了一个mariadb。
如果需要安装mariadb,可以使用yum。

6.安装php-mysql

[root@localhost~]#yum-yinstallphp-mysql

3.安装基本常用扩展包

1.安装Apache扩展包。

yum-yinstallhttpd-manualmod_sslmod_perlmod_auth_mysql

2.安装PHP扩展包。

yum-yinstallphp-gdphp-xmlphp-mbstringphp-ldapphp-pearphp-xmlrpcphp-devel

3.MySQL扩展包

yum-yinstallmysql-connector-odbcmysql-develibdbi-dbd-mysql

4.配置启动Apache和mysql

重启Apache和mysql服务(centos6不同,Cenots7+不能使用6方法)。
)

systemctlstarthttpd.service#启动Apache

systemctlstophttpd.service#停止Apache

systemctlrestarthttpd.service#重启Apache

systemctlenablehttpd服务。
#配置Apache开机启动

重启数据库

#启动Mariap-fpm,这里有多个安装源显示。
只需选择您要安装的5.6版本即可。

yuminstallphp56w-fpm-5.6.31-1.w7.x86_64-y

systemctlstartphp-fpm.service【启动】

systemctlenablephp-fpm.service【开机自动启动】

CentOSyum有时显示为“无法检索mirr”。
orlist”解决方案-配置resolv.conf

原因:没有配置resolv.conf。

解决方案:

在/etc目录下配置resolv。
.conf添加名称作者verIP(例如

nameserver8.8.8.8

nameserver8.8.4.4

searchlocaldomain

上面保存并再次运行命令)从nginx目录:/usr/share/nginx/html

/etc/nginx/conf.d/default.confnginx配置目录:/var/www/html

/etc/httpd/conf/httpd.confapache配置文件

nginx配置域名称

cd/etc/nginx

cpdefault.confimooc.conf

修改server_nameimooctest.com和项目目录

配置虚拟域名要访问Indows,需要在主机上添加linuxip。

ServerName

DocumentRoot"/var/www/html/learnlaravel/public"

OptionsIndexesFollowSymLinks

AllowOverrideAll

Requireallgranted

关闭防火墙

setenforce0

如何安装PHP开发环境

PHP开发环境的标准配置通常是+mysql.mysql。
我就不提了,很简单,只要下载Apache并按照教程安装即可,只需下载PHP压缩包并配置环境变量即可:Apache、mysql以及像phpstydy、wamp这样的php都会自动配置。

如何在服务器上安装PHP程序

您好。
如果您的服务器是Windows机器,则需要远程到服务器启动IIS(asp环境)。
您可以从xp.cn(小皮)或bt.cn(宝塔)安装面板启动。

如果您的服务器是Linux,我们建议使用宝塔。

打开终端。
不同的Linux系统有不同的输入指令。

Centos安装脚本

终端输入:yuminstall-ywgetwget-Oinstall.shshinstall.sh

安装Ubuntu/Deepin脚本

终端输入:wget-Oinstall.shsudobashinstall.sh

Debian安装脚本

终端输入:wget-Oinstall.shbashinstall.sh

Fedora安装脚本

进入终端wget-Oinstall.shbashinstall.sh

输入并安装

怎么安装php环境(怎么安装php环境软件)

在MacM1上安装PHP开发环境

去年年底,苹果推出了采用M1芯片的新款Mac。
一开始了解,担心软件不兼容。
比如如果推荐笔记本作为在线开发的主力笔记本,不推荐使用M1,但现在开发环境已完全配置并且可以安全退出。
车。
下面简单介绍一下安装过程中的步骤:

注意:如果没有安装brew,需要先安装brew,使用arch-arm64brewinstall进行安装

先搜索如果里面有你要安装MySQL版本的内容,如下图:

这里选择版本mysql@5.7,我已经本地安装了

安装完成后,你需要添加变量环境,这样就可以在任意目录下直接访问mysql。
首先检查有哪些php版本可用。
php7.3以下的版本,我已经安装了php7.4

安装完成后,就可以开始部署项目了,由于我的项目是用thinkphp框架开发的,使用了redis,所以这个需要安装先安装redis依赖

安装phpredis依赖(这里使用pecl安装,网上有很多编译安装方法,这种方法比较费力,需要配置较多,如果安装了pecl,又快又方便)

安装完成后,只需要配置nginx目录下的项目文件就可以了。

话不多说,但主要要提的是thinkphp框架,redirect配置和in-location配置需要修改,如下图:

Pass:编辑为完成后,重启服务器,同时重启php-fpm,这是关键

如何安装PHP环境?

搭建LAMP/LNMP环境

1.检查系统环境

1确认centos版本

[root@localhost~]#cat/etc/redhat-release

2已安装

rpm-qa|grephttpd

或者:

apachectl-v

或者:

httpd-v

3.检查Mysql服务是否安装

mysqldstart

如果无法识别,则未安装

如果系统已安装或安装失败,请清理系统

4upMysql痕迹

yumremovemysql

rm-f/etc/my.cnf

5卸载Apache包

rpm-qa|grephttpd

注意:如果这是一个新系统。
或者您以前从未尝试过安装,可以跳过上述步骤

2.安装Apache、PHP、Mysql

停止防火墙服务

[root@localhost~]#systemctlstopfirewalld.service

禁用防火墙启动服务防火墙

[root@localhost~]#systemctldisablefirewalld.service

1安装apache

[root@localhost~]#yum-yinstallhttpd

2.root@localhost~]#yum-yinstallphp

3安装php-fpm

[root@localhost~]#yum-yinstallphp-fpm

4安装Mysql

[root@localhost~]#yum-.yinstallmysql

5安装mysql-server

[root@localhost~]#yuminstallmariadb-server

CentOS7+版本从默认程序列表中删除MySQL数据库软件并将其替换为mariadb。
将mariadb视为mysql。

因为MySQL被Oracle收购后,原作者担心MySQL会闭源,所以又写了一个mariadb。
这个数据库可以理解为MySQL的一个分支。
如果需要安装mariadb,使用yum即可。

6安装php-mysql

[root@localhost~]#yum-yinstallphp-mysql

安装通用核心包

1安装Apache附加包

yum-yinstallhttpd-manualmod_sslmod_perlmod_auth。
_mysql

2安装PHP扩展包

yum-yinstallphp-gdphp-xmlphp-mbstringphp-ldapphp-xmlrpcphp-devel

3Mysql扩展包

yum-yinstallmysql-connector-odbcmysql-develibdbi-dbd-mysql

4配置Apache和mysql启动

重启Apache和mysql服务(注意这与centos6不同,Cenots7+不能使用方法6。

systemctlstarthttpd.service#启动apache

systemctlstophttpd.service#停止apache

systemctlrestarthttpd.service#重启apache

systemctlenablehttpd.service#设置apache开机自启动

重启数据库

#StartMariaDB

[root@localhost~]#systemctlstartmariadb.service

#停止MariaDB

[root@localhost~]#systemctlstopmariadb.service

#RestartMariaDB

[root@localhost~]#systemctlrestartmariadb.service

#设置启动

[root@localhost~]#系统ctlenablemariadb.service

5.Mysql设置

第一次安装mysql时没有密码我们需要设置MySQLroot账户的密码:

[root@localhost~]#mysql_secure_inhang

出现以下提示时直接按回车:

Entercurrentpasswordforroot

出现以下提示时再次按回车:

Setrootpassword?[是/n]

出现以下提示。
此处输入您需要设置的密码。
您输入的密码将不会显示。
按回车键再回车确认:还有四个确认,它们是:

删除匿名用户?[Y/n]

是否进行sallowroot远程访问?[Y/n]

删除测试数据库和访问权限?[Y/n]

现在重新加载privilegetables?[Y/n]

只需按Enter键。

方法二:输入mysqlmysql-r

更改mysql密码:setpasswordfor'root'@'localhost'=password('root');

mysql授权远程连接(navicat等):grantallon*.*torootidentifiedby'root';

6.测试环境

我们在浏览器地址栏输入,正常显示,说明我们的lamp环境搭建成功

7.安装nginx

yuminstallyum-priorities-y

wget

rpm-ivhnginx-release-centos-7-0.el7.ngx.noarch.rpm

yuminstallnginx

Nginx版本号可以更改

8.配置nginx

1nginx启动、停止、重启

systemctlstartnginx.service#启动nginx

systemctlstopnginx.service#停止

systemctlr.estartnginx.service#重启

systemctlenablenginx.service#设置启动

更改nginx端口号(根据自己的需要)

cd/etc/nginx/会议。
d/

vimdefault.conf

将listen80改为listen81

3登录后可以看到nginx的主页面

当安装完成后,需要启动php。
-fpm且不重启访问时会出现下载文件,重启命令如下

systemctlstartphp-fpm.service#Startphp-fpm

systemctlenablephp-fpm.service#设置启动

4更改nginx配置文件识别php

vi/etc/nginx/conf.d/default.conf,去掉前面的数字即可和轻松

location~.php${

roothtml;

fastcgi_pass127.0.0;

fastcgi_indexindex.php;

fastcgi_paramSCRIPT_FILENAME/usr/share/nginx/html/$fastcgi_script_name;

includefastcgi_params;

}

方法二安装nginx

yuminstallnginx

启动nginx并设置启动于启动

systemctlstartnginx

systemctlenablenginx

vim/etc/nginx/conf.d/default.conf

5创建test.phpnewin/usr/share/nginx/html

你可以看到php页面。
访问它

编辑配置后,不要忘记启动apache和php-fpm!九。
加载配置

站点上游{

server172.16.170.138;

server172.16.170.139;

}

服务器{

listen80;

server_namelocalhost;

#charsetkoi8-r;

#access_log/var/log/nginx/log/host.access.logmain;

位置/{

root/usr/share/nginx/html;

index.htmlindex.htm;

proxy_pass;

}

默认目录apache/var/www/html

nginx目录默认/usr/share/nginx/html

升级php版本

centos7上默认安装的php是5.4

查看yum可安装的php版本列表

yumprovidesphp

开始升级更新源PHP:

rpm-Uvh

rpm-Uvh

yumremovephp-common-y#删除系统自带php-common版本

php72

尤明斯high-yphp72wphp72w-opcachephp72w-xmlphp72w-mcryptphp72w-gdphp72w-develphp72w-mysqlphp72w-intlphp72w-mbstring

php56版本这个

yuminstall-yphp56wphp56w-opcachephp56w-xmlphp56w-mcryptphp56w-gdphp56w-develphp56w-mysqlphp56w-intlphp56w-mbstring#安装依赖包

查看php版本

php-v

安装phpfpm:

yuminstallphp72w-fpm

yumprovidesphp-fpm#因为我会搭建lnmp,所以安装ph