Enabling cURL with PHP - php

(I'm running Apache 2.2 and PHP 5.4.14)
I'm having problems enabling cURL with PHP. I uncommented the extension=php_curl.dll line in php.ini and made sure that the dependencies libeay32.dll and ssleay32.dll exist in the path. I also restarted Apache. However, when I run phpinfo() I do not see a cURL header and trying to call a cURL function results in the following error:
Fatal error: Call to undefined function curl_init() in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\boxproject\php\lib\Box_Rest_Client.php on line 114
Does anyone see any problems with this process? Are there more ways to troubleshoot the problem? Thanks a lot for the help.

Step1: Uncomment the php_curl.dll from php.ini
Step2: Copy the following three files from php installed directory to the bin directory of Apache
libeay32.dll, libssh2.dll, ssleay32.dll
Step3: Restart apache.

Related

Call to undefined function Illuminate\Encryption\openssl_decrypt()

I am using xampp and windows along with laravel, everything was working fine, but when I finished work and turned of xampp and try to open my work today morning, this is what I get:
FatalThrowableError in Encrypter.php line 100:
Fatal error: Call to undefined function Illuminate\Encryption\openssl_decrypt()
Encrypter.php is a standard laravel file and I have not even touched it. My extension is turned on.
extension=php_openssl.dll
What might be wrong?
Just edit php.ini file and uncomment by removing ";" before this line --extension=openssl. in php.ini file. and it will start working properly.
If you have shut XAMPP down and restarted it, it may be worth running the composer install command again, or simply running composer update to ensure that all dependancies are being loaded correctly.
Modify php.ini and enable openssl extension in you php environment.
To find php installation path, run below command in terminal or cmd
php --ini
Output something like below:
Configuration File (php.ini) Path: C:\Windows
Loaded Configuration File: C:\php-7.3.8\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
here mine is
Loaded Configuration File is C:\php-7.3.8\php.ini
open php.ini with any editor using vim, nano, notepad++ or any editor.
find extension=openssl remove ;
from ;extension=openssl
to extension=openssl
save and restart server.
composer install
didn't fix the problem, but the following does:
composer update
This problem can also arise if incorrect php.ini file is loaded.
Make sure in your config php_module is defined in the httpd.conf
<IfModule php_module>
PHPINIDir "C:/xampp/php"
</IfModule>

Getting error while connecting postgres to php

Hi i am trying to connect postgres server with PHP onm windows with xaampp. I have enabled the extension php_pgsql.dll in php.ini. I have also give the libpq.dll path to httpd.conf.
But still i am getting error Fatal error: Call to undefined function pg_pconnect() Any solution
I used postgres9.2 bin folder and load the libpq.dll in httpd.conf It solved my problem. I think there is some version compatibility first i was using 9.4 postgre bin files which was not working.
I added this line to Loadfile "C:\Program Files\PostgreSQL\9.2\bin\libpq.dll" httpd.conf
And remove ; from extension=php_pgsql.dll
After restarted the sever solved my problem.

PHP ldap_connect() problems

I am trying to get ldap_connect to work properly. It will work fine via CLI, but not when I open my php file via browser.
Here is what I believe are the relevant details:
Error message: Fatal error: Call to undefined function ldap_connect() in F:\Websites\ldap.php on line 4
OS: Windows Server 2008 R2 x64
PHP Directory: C:\Program Files (x86)\PHP
libeay32.dll and ssleay32.dll have been added to both C:\Program Files (x86)\Apache Software Foundation\Apache2.2\bin and C:\Windows\System32. They were copied from C:\Program Files (x86)\PHP.
Lines added to httpd.conf:
LoadModule php5_module "C:/Program Files (x86)/PHP/php5apache2_2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/Program Files (x86)/PHP"
Things changed in php.ini:
extension_dir = "C:/Program Files (x86)/PHP/ext" (path set)
extension=php_ldap.dll (uncommented this line)
I'm pulling my hair out, so I am more than happy to try anything people suggest.
Your PHP installation uses two different ini files - one when running from the command line, and a different one when running through Apache. This is evidenced by the fact that it works from the CLI, but not in a browser.
You can find the paths to the two files using phpinfo() (in a browser) and by passing the -i flag to php from the command line. Near the top of both sets of output you will find the path to the ini file in use, and I would be mighty surprised if they were identical. From the command line you can get more detailed information by passing the --ini flag.
The fact that you are getting Call to undefined function ldap_connect() can only mean that the LDAP extension was not loaded, and this can only be true through Apache but not through the CLI if they use two different ini files.
I feel silly now. The problem was with adding my PHP directory to the PATH environment variable. I'm not 100% sure why it fixed the problem, but that was what ended up doing it. Thanks for the help, guys!

Problem with running php script using mysql on tomcat

I am using tomcat 6 with JavaBridge. I have stored my php script in the following location.
C:\Program Files\apache-tomcat-6.0.26\webapps\JavaBridge\project\test.php
In test.php I am using curl and mysql. The php.ini in JavaBridge is stored in the following location
C:\Program Files\apache-tomcat-6.0.26\webapps\JavaBridge\WEB-INF\cgi\php.ini
and its contents are -
extension_dir="C:\Program Files\apache-tomcat-6.0.26\webapps\JavaBridge\WEB-INF\cgi\x86-windows\ext"
include_path="C:\Program Files\apache-tomcat-6.0.26\webapps\JavaBridge\WEB-INF\pear;."
there is also a config file called mysql.ini whose contents are -
extension = php_mysql.dll
I had also installed wamp earlier so I copied all the dll's from C:\wamp\bin\php\php5.3.0\ext to C:\Program Files\apache-tomcat-6.0.26\webapps\JavaBridge\WEB-INF\cgi\x86-windows\ext
When I start tomcat and run my script I get the following error -
Fatal error: Call to undefined function mysqli_connect() in C:\Program Files\apache-tomcat-6.0.26\webapps\JavaBridge\project\test.php on line 534
Please help.
If not enabled you have to enable curl in php.ini by uncommenting:
extension=php_curl.dll
I solved the problem...actually my wamp has php 5.3.0 and the JavaBridge php.info() says its is 5.3.1. I copied the new dll's and it is working now. Now I get an error: undefined function curl_init(). For the benefit for someone who is also facing the same problem. I copied the following dll's -
libeay32.dll
ssleay32.dll
into C:\Program Files\apache-tomcat-6.0.26\webapps\JavaBridge\WEB-INF\cgi and wrote the following line into mysql.ini
extension = php_curl.dll
and copied php_curl.dll into C:\Program Files\apache-tomcat-6.0.26\webapps\JavaBridge\WEB-INF\cgi\x86-windows\ext

php cURL iis 6.0 windows server 2003

I am having an issue setting up cURL with IIS 6.0, Windows Server 2003, PHP 5.2.6
I have installed to C:\PHP
set PHPRC = C:\PHP\php.ini
copied ssleay32.dll and libeay32.dll to C:\PHP
in php.ini, uncommented the line
extension=php_curl.dll
extension_dir="C:\PHP\ext"
c:\php\ext has the dll php_curl.dll
C:\PHP is in PATH
still getting
Fatal error: Call to undefined function curl_init()
Make sure php_curl.dll is in the directory listed under "extension_dir" in php.ini. If it is already, try restarting IIS (Apache always needs a restart from me when making php.ini changes).
EDIT 1:
Try opening up a command prompt to c:\php and running:
php -c . -i | find /i "curl"
Does it come back with any output? If so, IIS is using the wrong php.ini file.
EDIT 2:
Is c:\php in your PATH? You can check with "echo %PATH%" from the command prompt.
i ended up doin a reinstall of php, then unistalling php. then i copied and extracted the thread safe php package into c:\php rather than using the non thread safe package
Maybe it's loading c:\windows\php.ini?
I take it you've restarted IIS since you changed the config... :)

Categories