doujuan9698 2015-02-27 14:09
浏览 86
已采纳

使用MAMP for Windows的命令行上的PHP版本

I run MAMP on my Mac at home, but on my work machine (Win7) I just started using MAMP for Windows so that I'm running the same (relatively speaking) software between the two machines. I was running some commands from the command line yesterday and noticed that the script was throwing errors because the mbstring extension wasn't loaded. I did some digging and am left scratching my head now...

In the browser, everything works fine. When I check the phpinfo, it's loading the configuration file just fine and mbstring is enabled. When I switch to the command line though, mbstring isn't in the list of modules (php -m). Also, when I do a php --ini, it tells me that no configuration file was loaded. I've added the correct PHP version to my PATH and running php -v gives me the version I expect, so I'm not really sure why PHP on the command line is acting differently from PHP in the browser.

Has anyone run into this before? How do I make PHP on the command line load the same configuration file that the browser is using?

  • 写回答

2条回答 默认 最新

  • donglan8999 2015-02-27 14:11
    关注

    Command line php (CLI) is a different executable to CGI PHP. It also uses typically a different php.ini file. You can however specify the location of the php.ini you would like to load when launching php cli:

    php -c <path to your php.ini>
    

    Have a look here.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵