Call to undefined function curl_init() in wampp - php

I am getting an error. I have done the following:
Find file php.ini and uncomment in wamp apache folder
Find file php.ini and uncomment in wamp php folder
checked in wamp extensions
download file and replace php_curl-5.3.13-nts-VC9-x64.zip
restart wamp.
But I still get error
Fatal error: Call to undefined function curl_init() in C:\wamp\www\wordpress\wp-content\plugins\test\curl_http_client.php on line 66

Call to undefined function curl_init
You either edit wrong php.ini file or something is missing on your system, preventing curl extension from loading. You shall check with phpinfo() where is proper php.ini, then check if you got extension entry for cURL really enabled. If so and it is still not working then next step should be checking Apache's error.log looking for detailed error messages from PHP.

Related

PHP: mysqli extension doesn't load

I try to use MySQL with PHP and I have this error:
Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in 'file_name Stack trace: #0 {main} thrown in 'file_name'`
When doing print_r( get_defined_functions()), I see that the MySQLi extension isn't there, but it is "loaded" in the php.ini file (I mean this is not in a commentary).
I specify that the PHP directory is in the PATH (I'm under windows) and MySQL, PHP and Apache are on my C: disk.
I don't know where is the problem, this is probably a small thing but I can't see which one so.
My versions are:
Apache 2.4.47
PHP 7.1.7
MySQL 5.7
Windows 7
PS : php_mysqli.dll do only 97k. I don't know if it's normal.
HOW I SOLVED THIS : I have just added extension_dir="path_to_php\ext" under the lines who load extentions, in the php.ini file. This line is used to indicate where are the extentions in your hard disk. Don't forget to restart your server, it will reload the php.ini file.
First of all, run phpinfo() to make sure you are looking at the correct php.ini.
If your php.ini file has extension=php_mysqli.dll uncommented check your extension directory. You may need to set it explicitly, like:
extension_dir="C:\xampp\php\ext"
If the problem persists check the apache error log, you should find more info there.

PHP Fatal error: Call to undefined function mysql_connect() in IIS

The same code works in Xampp. But if try to run it on IIS below error occurs.
"PHP Fatal error: Call to undefined function mysql_connect()"
I'm stuck with this error from couple of days.
I tried changing my php.in . My phpinfo.php points to correct .ini file
Please suggest me a way.
part of my php.ini file:
extension=php_mbstring.dll
extension=php_exif.dll
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_mysql_libmysql.dll

Fatal error: Call to undefined function mysql_connect() and The mysqli extension is missing

I have below two in my php.ini file
extension=php_mysql.dll
extension=php_mysqli.dll
from the php.info(), can see below is correct.
Loaded Configuration File C:\Program Files (x86)\PHP\v5.3\php.ini
I have only one version php installed.
What else should I try?
The strange thing is, if I load my application the error is
Fatal error: Call to undefined function mysql_connect()
but if I load phpMyAdmin, after login the error is
The mysqli extension is missing. Please check your PHP configuration.
<img class="icon" src="./themes/pmahomme/img/b_help.png" width="11" height="11" alt="Documentation" title="Documentation" />
Make sure the path to php.ini is set and is visible in
at loaded configuration file.
if you are using windows.. make sure the use of / and \
in apache httpd.conf
it should be
PHPIniDir "C:/php/5.5/"

phpwebsocket - Undefined Function socket_create() - Have php_sockets enabled on Windows/WAMP

I checked out the PhpWebSockets project from here:
https://code.google.com/p/phpwebsocket/
It's in its own project on my localhost (Windows 7 64-bit) box, inside of a WAMP server. I issue the following command in Windows Command Line to run the server.php file:
C:\wamp\bin\php\php5.4.12\php.exe C:\wamp\www\phpwebsocket\server.php
But it results in the following error message:
PHP Fatal error: Call to undefined function socket_create() in C:\wamp\www\phpwebsocket\server.php on line 58
My WAMP instance DOES have the php_sockets extension enabled (since I saw this similar question who had that problem).
Anyone know what I could possibly be doing wrong?
Found the answer in another thread:
Error with PHP Websocket and Wamp Server
Turns out running the file on the command line means it uses a different php.ini file than the WAMP server does. Seems stupid, but turned out php_sockets wasn't uncommented in that php.ini file, and removing it removed the error with it.

Fatal error: Call to undefined function printer_open()

I'm trying to print some string using PHP, i'm using the PHP print functions:
$printer = ("HP LaserJet Professional P1102");
$handler= printer_open($printer);
$content="Test Content";
printer_write($handler, $content);
printer_close($handler);
but I got that error :
Fatal error: Call to undefined function printer_open() in C:\xampp\htdocs\print.php on line 12
after googling it i found that i must add the php_printer.dll to the extensions file in php and add it's extension to the php.ini file, then restarting the server services, all of that accomplished but still getting that error.
p.s. I've tried it on WAMP and XAMPP
I think solution would be extension location.php_printer extension should be stored in c:\xampp\php\ext and not in c:\xampp\php. So move it to the ext-folder, and restart Apache.
Can you look into the error_log, which tells you, if it fails to load the module. You should also run a phpinfo(), which shows up all loaded modules, you must find the printer extensions there.
I hope it may resolve your issue.

Categories