zoukankan      html  css  js  c++  java
  • php 开启socket配置

    我在Windows命令行输入命令:C:wampinphpphp5.2.6php.exe getXml.php以执行php文件。

    出现错误:Fatal error: Call to undefined function socket_create() in C:wampwwwgetXml.php on line 13

    网上搜了挺多论坛上的Q&A贴子,答案基本上是:
    1. 找到php.ini,看  extension=php_sockets.dll 扩展是否打开,将前面的注释删去。
    2. phpInfo()显示的内容里,socket模块是否为enable;

    还有说是少了一些dll文件,但是下了php4ts.dllphp5ts.dllphp_mime_magic.dll并将它们拷到目录C:/Windows/system32下,并确认php目录下的ext文件夹下存在php_sockets.dll文件,结果还是没有解决问题。

    解决方案: 这是在一个英文论坛上看到的方案,经过实践证明是可行的。

    原文是:

    The command prompt uses a different php.ini file to the apache server.

    The Apache php.ini file is accessible via the taskbar icon, and is located at:
    X:WAMP INSTALL DIRApache2inphp.ini

    The command prompt php.ini file is located at:
    X:WAMP INSTALL DIRphpphp.ini

    Once I’d enabled sockets in this file, by uncommenting the line:
    extension=php_sockets.dll
    and restarted the server, everything worked great.

    在两个目录下都有php.ini  我们使用wamp 的管理界面直接修改的php.ini是位于:

    C:wampinapacheapache2.2.8inphp.ini 下的(因个人安装的目录而不同),事实证明我确实在这个php.ini文件中修改了php_sockets.dll前面的注释符号”;”  ,但为什么没有用呢?

    那是因为在另外一个目录: C:wampinphpphp5.2.6php.ini(也因个人的安装而不同)中的扩展没有修改, 而我们只需修改它,就行了,  再拷一份修改后的php,ini文件到目录C:Windows目录下。

  • 相关阅读:
    [usaco3.2.5]msquare
    [usaco3.2.4]ratios
    [usaco3.2.3]spin
    [文献记录] Few-shot Learning for Named Entity Recognition in Medical Text 医学文本中命名实体识别的小样本学习
    计算机保研经验分享
    文本处理、词频统计与Simhash生成文档指纹
    [知乎live笔记]如何得到好的科研Idea
    POJ 2787:算24
    POJ 2964:日历问题 日期转换+闰年月份可放在一个month[2][12]数组里
    POJ-1835 宇航员 空间方向模拟+打表
  • 原文地址:https://www.cnblogs.com/mrcln/p/5639933.html
Copyright © 2011-2022 走看看