studio
studio copied to clipboard
php_curl missing and curl_exec deactivated
Quick summary
After installing the Podlove plugin, I get the error message, that php_curl is not installed and curl_exec is deactivated.
Steps to reproduce
Install Podlove and reload the window - https://wordpress.org/plugins/podlove-podcasting-plugin-for-wordpress/
What you expected to happen
Expected php_curl to be installed.
What actually happened
Impact
All
Available workarounds?
No but the app is still usable
Platform
Mac Silicon M1
Logs or notes
No response
📌 REPRODUCTION RESULTS – Replicated
📌 ACTIONS – Kept priority
- Related to https://github.com/Automattic/studio/issues/61
- Discussed in p1716879810244969/1716879787.384059-slack-C06DRMD6VPZ and p1714654185889809/1714653771.175899-slack-C06DRMD6VPZ
We have another request on 8302777-zd-a8c
This one was for the WPVivid plugin, which requires curl PHP extension.
Support References
This comment is automatically generated. Please do not edit it.
- [ ] 8302777-zen
- [ ] 8350827-zen
- [ ] 8428094-zen
- [ ] 8518441-zen
Another report here: 8350827-zd-a8c
The user was trying to use the WPVivid plugin as well, which requires curl.
Recommended the AIOWPM plugin in the meantime for exporting from Studio.
Another request here: 8428094-zd-a8c
They want to be able to use the Starter Templates Plugin, but we aren't sure yet from the messaging whether cURL is required or just suggested.
Bumping this to high priority because it's a pretty egregious issue.
In this case, they are looking to develop a local plugin that uses cURL to extract data from an external CRM before deploying it to production.
8518441-zd-a8c
Upstream issue about supporting libcurl in php-wasm: https://github.com/seanmorris/php-wasm/issues/32
I changed the status to "Needs core / 3rd party fix" as we're blocked here.
According to @adamziel in https://github.com/WordPress/wordpress-playground/issues/1008 curl is currently only available in the CLI.
@mpkelly Curl support was added for @php-wasm/node in (this PR)[https://github.com/WordPress/wordpress-playground/pull/1273] and included in the v0.7.2 release.
wp-now is currently using @php-wasm/node v0.6.16, which is not built with the curl extension.
@sejas has already created a draft PR for upgrading wp-now to a newer @php-wasm/node release, saying:
It will fix WEBP images, support curl and other fixes features introduced in these versions.
It's not a straightforward upgrade as various API have been changed and, in some cases, consolidated.
A couple of options are:
- Consider migrating Studio to using the Playground CLI if possible
- Update wp-now to use the latest
@php-wasm/nodeAPIs
If updating wp-now, some useful reference points are:
- Playground CLI initialization
- The implementation of Playground's bootWordPress() function which ties together PHP runtime management and creation of the PHPRequestHandler
@mpkelly Curl support was added for
@php-wasm/nodein (this PR)[https://github.com/WordPress/wordpress-playground/pull/1273] and included in the v0.7.2 release.wp-now is currently using @php-wasm/node v0.6.16, which is not built with the curl extension.
@sejas has already created a draft PR for upgrading wp-now to a newer @php-wasm/node release, saying:
It will fix WBEP images, support curl and other fixes features introduced in these versions.
It's not a straightforward upgrade as various API have been changed and, in some cases, consolidated.
A couple of options are:
- Consider migrating Studio to using the Playground CLI if possible
- Update wp-now to use the latest
@php-wasm/nodeAPIsIf updating wp-now, some useful reference points are:
- Playground CLI initialization
- The implementation of Playground's bootWordPress() function which ties together PHP runtime management and creation of the PHPRequestHandler
Thank you very much for your comment!!!
I already found that, and started working on upgrading wp-now.
I tested also spinning a site with playground-cli and found that the problem isn't there. ( And this is what made me trying to start upgrading wp-now. )
Problem is, that studio's wp-now has changes in comparison to what we have in wordpress/playground-tools repo, so it will be easier to just apply how playground-cli handle things in our wp-now version, as it's a relative small part that will be affected ( startWPNow function and how php instantiation is happening in there.).
Finally, I think that updating wp-now it will be good, as it will benefit wp-now in playground-tools repo as well ( we will apply the changes in there as well )
cc: @wojtekn
Finally, I think that updating wp-now it will be good, as it will benefit wp-now in playground-tools repo as well ( we will apply the changes in there as well )
Thanks for mentioning and working on this! That will be great for existing wp-now users.
CURL was fixed by upgrading the Playground dependencies on https://github.com/Automattic/studio/pull/491 🥳 It will be included in Studio in the next version.
I tested it in trunk with the following code:
function sendCurlRequest($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Curl error: ' . curl_error($ch);
}
curl_close($ch);
return $response;
}
$url = "https://api.wordpress.org/stats/wordpress/1.0/";
$response = sendCurlRequest($url);
echo $response;
It's fixed in 1.1.1.
hi,
I get this error if I try to run curl against localhost:
cURL error 55: Send failure: Socket not connected
@countfak thanks for the report. Would you mind sharing the code snippet? Did you try with 127.0.0.1 instead of localhost?
@wojtekn I'm getting the same error with 127.0.0.1
this is the code I'm using
$handle = curl_init('http://localhost:3000/'); // tried with 127.0.0.1 too
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_NOBODY, true);
curl_exec($handle);
echo curl_error($handle); // I see the error if I print this
curl_close($handle);
@countfak thanks for sharing the snippet!
I tested it, and I couldn't reproduce the issue with your snippet on Studio 1.1.2. It didn't show an error either for localhost or 127.0.0.1.
I also tried displaying downloaded content using another snippet, and it worked fine for me for both domain and IP:
$handle = curl_init('http://localhost:8884/license.txt'); // tried with 127.0.0.1 too
$body = curl_exec($handle);
var_dump($body);
curl_close($handle);
die;
I see your snippet uses the http://localhost:3000/ URL. It's not a Studio site URL. Is anything server under that port?
hey @wojtekn thanks for your help. I'm running Vite which starts its server on port 3000 (it's just a random port). I'm using it to bundle dependencies, code and assets and serve them accordingly on development. Basically what's explained over here: https://github.com/andrefelipe/vite-php-setup
maybe Studio is not able to access what lives "outside" of it?
@countfak I've checked another snippet to fetch the license file in the Studio site from the site served by Local, and it worked fine:
$handle = curl_init('http://test-api.local/license.txt');
$body = curl_exec($handle);
var_dump($body);
curl_close($handle);
die;
This remains a mystery.
I always get cURL error 55: Send failure: Socket not connected if I try to use curl to get something on localhost that is not served by Studio.
In my case, since I just need to return true or false whether I'm on localhost or not, I ended up doing a simple check on $_SERVER['HTTP_HOST'].