SSL error in cakaPHP with extensions=php_openssl uncomment - cakephp

I am using cakePHP and I am trying to get locally the profile picture in facebook after logging in using her/his facebook.
Saving is working fine, the only problem that I've been encountering is the SSL error,
Warning (2): file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed [APP\Controller\FacebookCpsController.php, line 98]
Warning (2): file_get_contents() [function.file-get-contents]: Failed to enable crypto [APP\Controller\FacebookCpsController.php, line 98]
Warning (2): file_get_contents(https://graph.facebook.com/10203572402389803/picture) [function.file-get-contents]: failed to open stream: operation failed [APP\Controller\FacebookCpsController.php, line 98]
Warning (2): file_put_contents(/files/user_profile) [function.file-put-contents]: failed to open stream: No such file or directory [APP\Controller\FacebookCpsController.php, line 99]
My controller name is FacebookCps.
and this is my line 98 and 99:
line 98: $image = file_get_contents('https://graph.facebook.com/'.$uid.'/picture');
line 99: file_put_contents('/files/user_profile', $image);
My extension=php_openssl is already uncomment in my php.ini (C:/xampp/php/phpini)
Thank you for any suggestion/help.

#Janelle Ann Lagatuz As the error says, ".... routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed ..." you should download a certificate bundle. Place it somewhere on web server where you can access it and giving the user permission to read the file. Then try this code:
$arrContextOptions=array(
"ssl"=>array(
"cafile" => "/path/to/bundle/ca-bundle.crt",
"verify_peer"=> true,
"verify_peer_name"=> true,
),
);
Their is another approach too, instead of passing the certificate, just put the verify_peer and verify_peer_name as false and pass it as follows (you can see the description of this method here: http://php.net/manual/en/migration56.openssl.php) :
<?php
$arrContextOptions=array(
"ssl"=>array(
"verify_peer"=>false,
"verify_peer_name"=>false,
),
);
$image = file_get_contents('https://graph.facebook.com/'.$uid.'/picture', false, stream_context_create($arrContextOptions));
echo $response; ?>
But remember, this is not good approach as you are not passing the certificate, this breaks SSL certification and is a security hole.

Related

Gatling check does not fail

I am trying to send a http request and fail if the request returns not 200:
exec(http("Get some html")
.get("${aggUrl}/somePath")
.check(status.is(200))
.check(regex("websocket=(.*?)&").saveAs("wsLink"))
)
The server sends the 401 response:
[HTTP/1.1 401 Unauthorized]{"errors":[{"code":"authentication.failure","message":"Failed to authenticate user details"}]}]
I expect in console something like "expecting code 200, but was 401"
But the actual error is:
[ERROR] i.g.c.a.b.SessionHookBuilder$$anon$1 - 'hook-38' crashed with 'j.u.NoSuchElementException: No attribute named 'wsLink' is defined', forwarding to the next one
[ERROR] i.g.h.a.HttpRequestAction - 'httpRequest-37' failed to execute: No attribute named 'wsLink' is defined
So I assume that the ".check(status.is(200))" is just ignored?
How then should I fail the test?
Thanks in advance,
Andrei Isakov
I think you're mistaken.
[ERROR] i.g.c.a.b.SessionHookBuilder$$anon$1 - 'hook-38' crashed with 'j.u.NoSuchElementException: No attribute named 'wsLink' is defined', forwarding to the next one
[ERROR] i.g.h.a.HttpRequestAction - 'httpRequest-37' failed to execute: No attribute named 'wsLink' is defined
Those errors happens happen AFTER the request you provided the code for, in an exec block you didn't mentioned where you're trying to inspect the Session's content and fetch the wsLink attribute that doesn't exist because the request failed.
Check failures are not logged with ERROR level. You have to either lower the logging level (see logback.xml) or check the HTML reports.

laravel $HTTP_RAW_POST_DATA

I am getting below error in Laravel Angularjs Application
Error: Expecting a token named "token" but instead got: "\nDeprecated: Automatically populating $HTTP_RAW_POST_DATA is
deprecated and will be removed in a future version. To avoid this
warning set 'always_populate_raw_post_data' to '-1' in php.ini and use
the php://input stream instead. in Unknown on line 0\n\nWarning: Cannot modify header information - headers
already sent in Unknown on line 0\n
i changed 'always_populate_raw_post_data' to '-1' this into 0,1 also command still same error how to fix that

DNN HTML Module on 9.1.1 throwing the following error

Since applying the latest critical security update, all pages that have the HTML module on them are throwing the following error resulting in a 404 page for the user. Please advise! Is there a good replacement module that we can use instead?
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0103: The name 'ModuleContext' does not exist in the current context
Source Error:
Line 41: {
Line 42: var wasReplacing = false;
Line 43: ModuleContext.Settings["MyTokensReplace"] = false;
Line 44: if (ModuleContext.Settings["TEXTHTML_ReplaceTokens"] != "") {
Line 45: if (Convert.ToBoolean(ModuleContext.Settings["TEXTHTML_ReplaceTokens"]) == true) {
This appears to be related to the MyTokens module. See the post on their website here:
https://www.dnnsharp.com/helpcenter/case/62435

Shibboleth Configuration

I am very (very) new to shibboleth, currently I am doing configuration by editing the shobboleth2.xml and I use shibboleth 2.4 but I am getting following error when I restart the shibboleth.
shibd error: unable to run config check as user
Restarting Shibboleth 2 daemon: 2013-03-04 13:15:27 ERROR XMLTooling.ParserPool : error on line 28, column 40, message: attribute 'homeUrl' is not declared for element 'ApplicationDefaults'
2013-03-04 13:15:27 ERROR Shibboleth.Config : error while loading resource (/etc/shibboleth/shibboleth2.xml): XML error(s) during parsing, check log for specifics
2013-03-04 13:15:27 FATAL Shibboleth.Config : caught exception while loading configuration: XML error(s) during parsing, check log for specifics
configuration is invalid, check console for specific problems
In my shibboleth2.xml I have already added the homeUrl.
<!-- The ApplicationDefaults element is where most of Shibboleth's SAML bits are defined. -->
<ApplicationDefaults id="default"
policyId="default"
entityID="https://somesite.com/shibboleth/default"
homeUrl="https://somesite.com/"
REMOTE_USER="eppn persistent-id targeted-id"
signing="false" encryption="false">
Remove the attribute "homeUrl" from your <ApplicationDefaults /> element.
<ApplicationDefaults id="default"
policyId="default"
entityID="https://somesite.com/shibboleth/default"
REMOTE_USER="eppn persistent-id targeted-id"
signing="false" encryption="false">

CakePHP "Warning: Cache not configured properly"

I am using CakePHP and getting the following error
Warning: Cache not configured properly. Please check Cache::config(); in APP/config/core.php in D:\PHP-SERVER\cheesecake\cake\libs\configure.php on line 663
Notice: Undefined variable: Route in D:\PHP-SERVER\cheesecake\app\config\routes.php on line 38
Fatal error: Call to a member function connect() on a non-object in D:\PHP-SERVER\cheesecake\app\config\routes.php on line 38
Any problem in the settings?
Which CakePHP version are you using?
The fatal error looks like a typo. Open the file D:\PHP-SERVER\cheesecake\app\config\routes.php and check what there is written on line 38. It looks like there is a letter missing.
It should be something along the lines of
Router::connect(...[whatever your route settings are]...);
and I guess in your file it says (note the missing r in Router)
Route::connect(...);
Did you do what the other error message said? Check the Cache::config call in app/config/core.php. You seem to have not properly set your cache configuration.
The default call looks like
Cache::config('default', array('engine' => 'File'));
If you changed that post the code-piece to figure out if something is wrong..

Resources