call to undefined function curl_init() in .bat file - php

I created my php file as .bat file using
#ECHO OFF
php -f D:\wamp\www\scrapper\scrapper5.php
I used cURL in scrapper5.php, when i run .bet file manually i got and error
call to undefined function curl_init() in your file
I researched and i got cURL is not working in CLI mode.
I just follow below step but can't get success.
Run a php script as a background process in wamp server
How can i run batch file with cURL?
Can anybody give me solution?

From the error you have posted, it looks like you do not have cURL installed. Perhaps look at you CLI config for PHP and see if the curl module is active

Wamp may not have cURL installed by default - have a look at options for installing it on your system.
If i remember correctly, you should have a menu (right click on the wamp icon) for enabling/disabling apache modules. Have a look there for cURL and enable it. (sorry if this is a bit vague, I'm on a mac at the moment and on Windows it has been several years since I moved form WAMP to XAMPP)
If that doesn't work, some forums seem to mention downloading the cURL extension (on windows this is a .dll file) from here: http://www.anindya.com/php-5-4-3-and-php-5-3-13-x64-64-bit-for-windows/ and putting that in your ext folder under the WAMP instal directory. Just make sure to get your versions correct to ensure stability.

I think you have to enable cUrl feature in wamp server. Follow those steps may it will help you:
1. Go to wamp Server Tray icon which is placed in the task bar.
2.Open PHP Tab.
3.PHP Extensions.
4.Then make sure PHP_CURL is selected.
5.Then restart wamp server.
I hope it will help you!!!!

Related

PHP SOAP extension not working (PHP + IIS + SOAP Extension)

I'm having some issues trying to achieve a SOAP request to a web service by using PHP.
I have a really small project which only send some requests of a SOAP web service, parses them and show the results on a table, but it's not working. I've developed this using XAMPP and this is the very first time I deploy something on a IIS web server so I'm a newbie.
I'm not using any framework, it's just plain PHP.
The first problem I have is that php_soap.dll extension seems to be disabled since I check the configuration with php_info(); and I can't find SOAP extension in the result, but I've enabled it in my php.ini by removing the semicolon from that line and my extension folder is "ext" under my PHP folder. I have some other extensions running and they're just fine.
Doing some var_dump when I try to instatiate the SOAP class, it's not returning anything (not even null).
Some more info:
PHP Version: 7.3.25
IIS Version: 10.0.17763.1 running on Windows Server 2019
2022-09-05 Edit
I've found out that php_openssl.dll isn't working on my server. I don't know why. It's enbled in php.ini. However, phpinfo(); shows it as disabled.
On the other hand, when I run "php -m" command on my CMD, it shows that SOAP and OpenSSL are enabled:
The first thing you need to do is enable the php_soap extension in your php.ini file. You can do this by removing the semicolon from the line that says ;extension=php_soap.dll. Once you have done this, restart your web server.
Next, you need to make sure that the extension_dir setting in your php.ini file points to the directory where your PHP extensions are located. For example, if your extensions are in the c:\php\ext directory, then your extension_dir setting should look like this:
extension_dir = "c:\php\ext"
Once you have done this, restart your web server.
If you still cannot get the SOAP extension to work, please post a comment below and I will try to help you further.
I already solved my problem.
The problem was not in the PHP.ini file, that one was correctly configured.
The problem was that I hadn't installed an extension for PHP and IIS. Once I've installed PHP Manager For IIS and configured it by following this tutorial, it worked out correctly.

How to launch PHP on Atom?

While changing file from .html to .php extension it shows me message that there is no PHP interpreter found at php. And it is not about script support it is should launch on the browser. Clicking the "the set PHP" button it shows me the ide-php package. And I see no way how to set the Path.
Atom settings.PHP settings
you cant run php without a server, you need to install XAMPP (in case of windows you could use WAMP or in case of mac you could use MAMP).
you can download XAMPP from the link below:
https://www.apachefriends.org/download.html

configuring curl extension for php in windows

I am using the Xampp server with php5 . I have been trying to get the curl extension working. But, unable to do it. I uncommented the php_curl.dll line in php.ini. I dont see curl enabled in phpinfo() . I also copied the ssleay32.dll and libeay32.dll files to both syswow64 and system32 directories. Do i have to install anything on the server? Has anyone used xampp server before with curl ? thanks
To be honest I did not used XAMPP but couple of times I've faced problems with WAMP extensions on Windows.
Almost always reason was one of the following:
There aren't required file in /ext directory,
Extension line in php.ini is commented,
I forgot to restart server.
Also, this looks interesting (from link #1 below):
There’s a straight-forward XAMPP FAQ
Entry about their php.ini stucture.
For those looking for the easy fix,
ignore everything but the
/apache/bin/php.ini file. That’s the
only one that counts, regardless of
which PHP version you’re currently
using.
What about all the .dll files you
need? Well, you don’t need them.
Everything you need to run CURL on a
XAMPP install is included in the
download. Stop downloading extra crap
and sticking it all over your system.
XAMPP knows what it needs, where it’s
at, and how to use it. End of story.
If above steps doesn't help, read following articles (and comments):
Using CURL in XAMPP
Enable CURL with XAMPP on Windows XP
Enable Curl on Xampp
Getting cURL to Work in XAMPP
Be aware of multiple php.ini files in XAMPP. Be sure that you have edited right one.
P.S. I've just tried to enable cURL in Wamp/XP. I've removed leading semicolon ; from line ;extension=php_curl.dll and restarted server. Now I can see cURL support: enabled in phpinfo() page. I guess that's easy in XAMPP too.

curl_init() isn't functioning

Anyone faced the same thing before? I've tried the same script on a XAMPP, it worked. And I'm trying to do on a WAMP, it reported call to undefined function curl_init(). I've enabled and double-checked on my WAMP php.ini on line:
extension=php_curl.dll
The commenting was removed alright.
Could the reason be CakePHP ? I'm developing the App on Cake. Or something I need to do with WAMP...
You have to edit both these files:
wamp\bin\php\your php version\php.ini
wamp\bin\Apache\your php version\bin\php.ini
To get this problem where the side by side configuration is correct, but its still not working in wamp php 5.4.3 fixed. Follow: http://www.morningtime.com/kb/188
The php_curl.dll library is bugged and must be replaced. See attachment below. Replace the old php_curl.dll file (in your wampserver/bin/php/{version}/ext/ folder) with the new one attached. Restart Apache and you are set.
link that is currently working: http://www.morningtime.com/sites/default/files/attachments/book/188/php_curl-5.4.3-VC9-x64.zip
worked for me.
Thanks for pinpointing to checking out phpinfo() sometimes you just get too tired to test the basic. Well, after that I googled and found the solution. It seems that for a WAMP server, we need to enable both php.ini on folder PHP/..bin and Apache/..bin
I restarted after confirming both were enabled and here in phpinfo() I got curl enabled. I guess it should be working now.
or did you restart your wamp apache or what ever server you have?
EDIT:
maybe this helps. also notice the updates on top of the 1st post
How to get CURL to work with PHP on Windows? (WAMP)

PostgreSQL trouble on windows PHP

I'm using WAMP on windows, which installs PHP, Apache and MySQL.
I'm now working on something new that requires PostgreSQL. The current install won't do it for me, as I keep getting these errors:
Call to undefined function pg_query()
Always
undefined function
I've installed PostgreSQL 8.3.7-1 for windows, added php_pgsql.dll,php_pdo_pgsql.dll and even libpq.dll, which a note on the PHP page for postgreSQL says Windows users need starting from PHP 5.2.6
Still, I keep getting these errors...
Can someone advise the best course of action? Or should I just uninstall apache and everything else, and do a fresh install of each component seperatly?
xampp doesn't "tell" apache/php which php.ini to use. Therefore php uses its default lookup strategy to find the .ini file. If you haven't changed anything this will be the one in the directory where the apache binary is located, xampp/apache/bin/php.ini. Did you edit this file and removed the semicolon before extension=php_pgsql.dll ?
When in doubt askecho 'php.ini: ', get_cfg_var('cfg_file_path');which file you have to edit.
xampp installs php as a module by default and you have to restart the apache in order to get php to read the php.ini again.
After thatecho extension_loaded('pgsql') ? 'yes':'no';should print yes. If it doesn't stop the apache service, open a command shell, go to your xampp directory and enterapache_start.batThis will start the apache as a console application and you can see startup errors in this console (instead of windows' event manager). If a dll is missing you will get a message box.
Did you enable it in the php ini file?
What does a call to phpinfo() say is installed for extensions?
Depending on what kind of errors you see in the Apache's error.log the answers on this question might be helpful.
I did the same as you did and got rid of the issue.But mine was for xampp. Probably you should re-install your wamp.

Categories