WAMP64 ssl for file_get_contents - php

I have a php file that i want to pars something from wiki.
The code is:
file_get_contents("https://en.wikipedia.org/w/api.php?format=json&action=parse");
I constantly get the error:
file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP?
By searchin google I finde a lot of commets telling "you have to activate or uncoment openssl_extension in wamp."
This is clearly activated:
SEE Screenshot that proofs this is activated
Can someone help me to get rid of this error?

Create a file called phpinfo.php and put this in it:
<?php phpinfo(); ?>
and then browse to that file. You'll see a big list of all your php settings and installed modules. Look for the openssl module and check that it's enabled. If it's not, you need to keep tweaking your WAMP environment until you can see that the module is appearing. Normally when changing Apache/php settings you need to restart Apache for the changes to be taken into account, so you may need restart your WAMP server.

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 enable CurlHttpClient for WAMP in PHP 7.4+?

I'm trying to open the index_dev.php file for a site on my Wampserver and I'm getting this error:
Internal Server Error - PHP Warning - Configure the "curl.cainfo", "openssl.cafile" or "openssl.capath" php.ini setting to enable the CurlHttpClient
I tried to do some research on how to enable curl on WAMP, but all of the info I was seeing was for PHP 5.x
As far as configuring, I don't have a clue what I should do to the "curl.cainfo", "openssl.cafile" or "openssl.capath" settings in my php.ini files.
Thanks in advance for your help!
Go to https://curl.se/docs/caextract.html and download the latest .pem file.
Copy the .pem file to ..... well I put mine in C:\wamp64\bin\php called cacert.pem
This contains a whole bunch of certificates and because the file is created by Mozilla we sort of trust it.
Now using the WAMPManager, edit your current php.ini file by
left click wampmanager -> PHP -> php.ini
Find this parameter, it will be commented out with a ;
;openssl.cafile=
Change it to
openssl.cafile="c:/wamp64/bin/php/cacert.pem"
Save the edit, and then restart Apache to activate the change

TestLink Installation script shows its source code instead of running

I'm trying to install TestLink 1.9.7 but the index.php script in the Install folder only shows the source code. I've read a question ticket on StackOverflow about a similar problem with PHPMyAdmin but the solution (enabling short tags in php.ini) didn't work for me. the file install/index.php still won't execute.
I've installed the following prior to testlink:
Apache 2.2.25,
PHP 5.3.27,
MySQL Server 5.6.12.2(Web Community)
This is all that the installation manual for testlink tells me to install. I believe something else is missing. Is there any setting in Apache that I should change, or any service I need to enable?
Edit: I've read the instructions on php.net on how to configure Apache to work with PHP, however the section about configuring it as handler cause the Apache server to fail to restart and the section about configuration as CGI contains insufficient instructions(like which files to copy over and how to edit them).

call to undefined function curl_init() in .bat file

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!!!!

Configure PHP to work with MySQL and phpMyAdmin

My purpose is to setup a forum in php just locally on my Windows 7 machine to test how it works.
I have installed Apache HTTP Server and PHP v5 successfully. Then I downloaded and extracted the phpbb-forum software and put it in my root folder. Then I realized that I needed some kind of database so I downloaded and installed MySQL. To configure my database I also downloaded and extracted phpMyAdmin but I can't get it to work. When I open my browser and navigate to my phpMyAdmin-folder I simply get this:
Screenshot: http://img836.imageshack.us/img836/5139/captureqb.png
I use my Apache server to preview my website where I'm using some php include functions so I know that I've a "working" PHP installation. The MySQL service is also running on my computer.
However, do you need to configure PHP and/or Apache in order to get phpMyAdmin to work properly? I'm a complete noob on this so I suppose it may be multiple shortcomings.
Thank you.. //Realiserad
The simpler way is to install WAMP server : it bundle Apache, PHP, MySQL and PHPMyAdmin preconficurated for work together.
You need to enable the MySQL extension to use MySQL from PHP.
The MySQL extension may or may not be bundled with your PHP distribution. (look for php_mysql.dll in the ext folder)
Assuming it's installed you can enable it by adding or uncommenting this line in your php.ini:
extension=php_mysql.dll
As other people have said it may be simpler to install WAMP Server
Have a look at: http://www.ricocheting.com/how-to-install-on-windows/mysql - Specifically, the 3rd step. It involves downloading the mySQL PHP Extention (which is a dll), and un-commenting a line of php.ini so that PHP Load's the extension.
While is may be simpler to install XAMPP or WAMP, I think that it's good to know how to fix your own problems - Scientia potentia est :D
not very familiar with windows, but it seems like you miss the php-mysql extension, which you can download from here (i think):
http://mysql2.mirrors-r-us.net/downloads/connector/php/index.html
would be alot easier for you to use a preconfigured wamp install like this one (available for win/mac/etc). google "xampp", i'm not allowed to post more than one link due to stackoverflows spam protection.
Configure PHP to Access MySQL
Open the c:\php\php.ini file with your favorite text editor.
Uncomment the following lines by removing the semicolon:
extension=php_mysqli.dll
extension=php_mbstring.dll
extension=php_mcrypt.dll
save and exit editor
After extracting the archive into phpmyadmin folder, you will have to configure phpmyadmin before you can connect to sql server.
you should create a configuration file. This file can be created manually (simply use a text editor),
During your first session you will see an error message.
To solve this problem you should create folder (C:\project\wwwroot\phpmyadmin\config). After that give full rights for IIS_IUSRS group and IUSR user.granting permission/image
Return to the config window. Visit localhost/phpmyadmin/setup/
To configure the connection settings click on the “New Server” button.
Enter the verbose name of the SQL server, and then the server hostname. If necessary, you can specify other settings.[setting up/image][2]
Save the settings and then the server will redirect us to the previous page. Choose:
the default language – English
the default server – 127.0.0.1
end of the line – Windows (\ r \ n)
Click Save, and then download. The received file (config.inc.php) you should save to the root directory (C:\project\wwwroot\phpmyadmin).
Open the authorization window (//localhost/phpmyadmin/) and login under root account. If you see a starting phpMyAdmin window, you can delete config folder.
For the correct work phpMyAdmin requires a database with the information. The script for creating database is already installed.

Categories