donglu3087 2016-07-04 09:35
浏览 68

cURL,Google App Engine和命名空间

I'm trying to port a PHP-based API over from shared hosting to Google App Engine. I've downloaded the PHP SDK, created a new application in the launcher, enabled cURL in php.ini (using extension=curl.so), and now I'm getting this error:

Fatal error: Call to undefined function MyNamespace\curl_init() in C:\Users\David\Desktop\GAE\mysampleapp\classes\myclass.php on line 56

If I add a backslash to curl_init() (to tell it not to use MyNamespace), I get this:

Fatal error: Call to undefined function curl_init() in C:\Users\David\Desktop\GAE\mysampleapp\classes\myclass.php on line 56

Short of enabling cURL_lite() (which I might tackle later, because that doesn't support the cURL options i need), how can i resolve this?

EDIT: My question differs from the suggested duplicate, because I'm following Google's own instructions for enabling cURL

EDIT 2: I was able to get this running on the app engine SDK / launcher by changing the extension to php_curl.dll.

  • 写回答

1条回答 默认 最新

  • dowb58485 2016-07-04 13:27
    关注

    So GiamPy's comment got me thinking, so I enabled phpinfo() in php.ini and found that cURL wasn't being loaded at all.

    I changed the extension to php_curl.dll and it now works. A rookie mistake (I've been writing PHP apps for 10+ years), but this answer didn't fix cURL on the actual App Engine, until I saw an answer in another question, stating that removing the quotes in the extension line worked for them.

    So now my local php.ini is:

    extension="php_curl.dll"

    While my GAE php.ini is:

    extension=curl.so

    And now I can use both.

    评论

报告相同问题?

悬赏问题

  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥15 Oracle触发器记录修改前后的字段值
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题