首页 文章

PHP使用exec运行curl

提问于
浏览
0

我尝试使用exec方法在php中运行curl命令,它在我的Linux服务器上运行良好,但在我的Windows机器上运行不正常,我也检查了我的PHP配置文件,在那里启用了curl . 它可能无法正常工作的问题是什么?

我的命令是(一个用于Linux - 这个在那里成功运行)'curl -u admin:geoserver -XPUT -H 2766409 --data-binary @/opt/lampp/htdocs/PDAN_Dev/Admin/uploads/tif/' . $ data_set_name . ' . tif http://localhost:8080/geoedge/rest/workspaces/geoedge/coveragestores/ '.$data_set_name.' /file.geotiff'

我在Windows中运行的那个

exec(“curl -u admin:geoserver -XPUT -H Content-type:image / tiff --data-binary C:/Users/Developer/Desktop/geoedge-test12.tif http://107.167.186.125:8080/geoedge/rest/workspaces/geoedge/coverageStores/geoedge-test13/file.geotiff”)

当我在命令提示符下运行它时,它没有输出

2 回答

  • 0

    这意味着您还没有在Windows机器上安装curl . PHP卷曲与机器安装卷曲不同 . 当你检查php配置时,它会显示为php而不是机器安装的模块 .

  • 0

    您不应该使用 exec 函数运行curl,而应使用build in php functions .

    这不是因为安装了php curl扩展,这个库是在你的windows机器上全局安装的 .

相关问题