What is the name space of curl in symfony2? It gives Fatal error: Call to undefined function curl_init()
It would seem that curl support is not enabled - check your php.ini
PHP invoke CURL with simple functions. If you have enabled the 'php_curl' extension in your php.ini, you should have no trouble invoking curl normally. But for certain configurations of PHP (I don't remember what) I was advised to use backslash before [like \curl_init();]
There are two php.ini files for bowser and for console. Make sure that you have enabled php_curl in both. This happened to me when developing a console script. This must work for sure.
Related
I'm using PHP in combination with Xampp and have installed the extension stats for Windows (https://pecl.php.net/package/stats/2.0.3/windows). Phpinfo says everything works fine. Stats is enabled. Nevertheless I am getting the error message
Uncaught Error: Call to undefined function stats_rand_gen_ibinomial(),
when I am using the function stats_rand_gen_ibinomial, which is documented here https://www.php.net/manual/en/function.stats-rand-gen-ibinomial.php.
Have you got experiences with these extension?
In php.ini i have added the following line: extension=stats
My first thought was that you need to restart the apache but the output in the screen seems to be be ok, then I executed ">php -m" and the extension was listed but when I run a script calling stats_rand_gen_ibinomial() it fails(exactly what you describe).
I download the source code 2.0.3 and 2.0.0 and the method is not included!!, the same with 1.0.5 and 1.0.4. The last version when the method does exist is : 1.0.3.
You can download all the versions here https://pecl.php.net/package/stats and look for the last one with that method definition. But the conclusion is that for some reason that method is not included . I ignore the reason.
I have read numerous posts regarding enabling sockets on WAMP.
I have uncommented the extensions from both php.ini files that exist, and also checked that it is indeed enabled by left clicking wamp icon > PHP > PHP Extensions and making sure that php_sockets is checked ( and it is ).
Also if I view load phpinfo in my browser I see that web sockets is enabled.
However, when I try to execute a script from the command line, I get the following error:
PHP Fatal error: Call to undefined function socket_create() in /cygdrive/c/wamp/www/chat/websockets.php on line 20
Also, I read somewhere that I should see web sockets in the list if I do the following in the command line: php -me, however when I do that I DO NOT see sockets in the list, I guess this might be the problem but don't know what to do about it, since I have enabled everything I found.
I know that xDebug can be enabled (if configured so) to be enabled when a certain cookie is sent along.
I have the case now that a PHP script is being called through a remote server (webhook). Is it possible to enable xDebug through a PHP function call that I can place at the beginning of the PHP file to be called by the webhook?
Or is there any other possibility to enable xDebug for that webhook?
Okay, figured something out.
One can simply append the GET parameter "XDEBUG_SESSION_START" to the URL being called by the webhook to enable xDebug.
Alternatively, assuming you're running Xdebug 3 (which you most likely will be in 2023), and you have access to the xdebug configuration, you can enable start_with_request.
In my setup (IndigoStack) the file is at conf.d/20-xdebug.ini. You need to add the following line:
xdebug.start_with_request=yes
Read more here: https://xdebug.org/docs/upgrade_guide
I am receiving this error when I try to access my newsletter plugin, I have uncomment the curl extension in both php\php.ini and apache\php.ini, and also in configuration file of php. Even I restarted my server after changes but still I am getting error. How can I solve this issue ??
I have tried these extensions (extesnions link here) according to my php version and it worked!
Cheers
Start the Curl extension of PHP directly by changing PHP.ini file or by clicking wamp and then scroll to PHP->extensions
trying to enable curl in xampp 3.0.12 in windows environment.
Updated the php.ini in the php folder to enable curl, and there is no php.ini file in the apache/bin folder.
phpinfo() says:
loaded configuration file: C:\xampp\php\php.ini
curl support:enbaled
curl information: 7.24.0
and when i try to run a http_get() command php says:
Fatal error: Call to undefined function http_get()
Restarted both windows and xampp several times to update the changes.
Would be grateful for some advice, as I searched through similar topics on the web but can't get any further.
Note that the function http_get() belongs to the pecl http extension and not to the curl extension. Refer to the documentation of the curl extension to learn how you can use it to retrieve documents via http. You'll also find a lot of posts on stackoverflow
Also note, that the function file_get_contents() can be used to get documents over http in a very simple way. Although it is limited it will fit in much cases. To retrieve a page you can issue:
file_get_contents('http://www.server.com/page.html');