PHP Interpreter is not configured(configure PHP Interpreter)解决办法(转)

php这么流行,不能不研究一下。首先得找到好用的工具,见网上大神们都推荐神器phpStorm,那我也追追风,下载了一个phpStorm 7.1。平时工作都是在mac系统,所以这儿只介绍mac系统神器的配置。

安装我就不用多说了嘛。
安装成功后,接下来就运行。
运行后当然是创建一个了新工程,简单一点,我们创建一个空工程。 刚才都说了,是空工程,那接着我们给它加点料,新建一个php文件,暂且命名为index.

接着我们给它点点内容,那是那样吧,最简单的,用helloworld.

<span class="line-number" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; font-size: 13px; vertical-align: baseline; color: rgb(88, 110, 117) !important;">1</span>
<span class="line-number" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; font-size: 13px; vertical-align: baseline; color: rgb(88, 110, 117) !important;">2</span>
<span class="line-number" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; font-size: 13px; vertical-align: baseline; color: rgb(88, 110, 117) !important;">3</span>
<span class="line-number" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; font-size: 13px; vertical-align: baseline; color: rgb(88, 110, 117) !important;">4</span>
<span class="line-number" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; font-size: 13px; vertical-align: baseline; color: rgb(88, 110, 117) !important;">5</span>
<span class="line-number" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; font-size: 13px; vertical-align: baseline; color: rgb(88, 110, 117) !important;">6</span>
<span class="line-number" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; font-size: 13px; vertical-align: baseline; color: rgb(88, 110, 117) !important;">7</span>
<span class="line-number" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; font-size: 13px; vertical-align: baseline; color: rgb(88, 110, 117) !important;">8</span>
<html>
<head>
    <title>PHP 测试</title>
</head>
<body>
<?php echo '<p>Hello World</p>'; ?>
</body>
</html>

接着我们点击运行 

会出现一个对话框 

下面有一个error,是说没有找到php解释器。点击后面的Fix,会出现如下对话框: 

看到了吧,解释器设置。 mac系统是默认安装了php的,目录是在/usr/bin,那么我们点击后面的button,然后指定php解释器目录。

配置好后点击ok。

配置好后,就有解释器了。

理论上这样配置就已完成了,可是如果你点击下图右边中的chrome图标

你将会看502错误,

回到PhpStorm后,你会看到有一相警告,是说php-cgi没有找到

解决方法就是自己安装php,不用mac安装,这样就有php开发环境了。 安装很简单,直接运行一个命令, 需要几分钟,请慢慢等待。

<span class="line-number" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; font-size: 13px; vertical-align: baseline; color: rgb(88, 110, 117) !important;">1</span>
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.5

新安装的php目录是/usr/local/php5/bin,接下来在PhpStorm中设置新安装的php解释器: PhpStorm->Preferences->PHP 会来到解释器设置页

设置我们安装的php解释器:/usr/local/php5/bin

这下配置完成,把鼠标放到PhpStorm右边区域,然后点击你电脑上安装了的浏览器,就会打开浏览器显示index.php的内容

如果想从网页中触发进行调试,需要安装插件。我用的是chrome, 需要安装Xdebug helper

到此,神器PhpStorm for Mac已配置完成,可以开始你的php之旅了。

  • 5
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值