phpstudy环境安装和phpstorm使用中的一些踩坑
2022-11-24 加入收藏

1. phpstorm安装
IDE官网链接:https://www.jetbrains.com/phpstorm/
下载后只能免费试用30天。可以网上下载破解版。
2. phpstudy下载
官网链接:https://www.xp.cn/
3. phpstudy程序中mysql无法启动

出现原因:电脑本地已经下载了mysql,本地的mysql和phpstudy的mysql的端口号冲突,都是3306,所以启动失败。
解决方案:phpstudy的mysql修改下端口号,改为3307也行

4. phpstudy程序中phpmyadmin无法启动
找到phpmyadmin软件的下载路径:D:phpstudy_proWWWphpMyAdmin4.8.5librariesconfig.default.php 打开config.default.php配置文件 将
cfg[′Servers′][i][‘port’] = ‘’;
修改为
cfg[′Servers′][i][‘port’] = ‘3307’;
5. phpstudy新建一个网站
在电脑本地新建个文件夹
路径例如 D:/workspace_php/firstPhp
打开phpstudy 选择网站->创建网站

输入域名 例如:www.firstphp.com 根目录就是第一步的文件夹路径。最后点击确认,网站新建成功

网站新建成功

查看网站效果 点击管理->打开网站

会出现如下报错
6. 新建网站踩坑
Forbidden
You don’t have permission to access / on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
为什么出现这段报错呢。
因为网站的初始路径是index.php.
网站现在是空的,所以会报错。
打开phpstorm编辑器
文件->打开->选择D盘的 workspace_php/firstPhp新建php文件,取名index.php
输入echo ‘hello world’;
网站重新打开效果
7. PhpStorm中运行php出现502 Bad Gateway错误
解决步骤如下
文件->设置->构建、执行、部署->部署->点击【+】号->就地
2. 随便输个服务器的名字flyboat
3. web服务器填写新建的网站的域名地址 www.firstphp.com -> 点击确认-> 配置完成
选择浏览器 单机一下 正常运行 网站运行成功