I installed Facebook php sdk as stated in facebook official doc. Moreover, I loaded application configuration into Facebook\Facebook service and replaced required paramters with my own:
$fb = new Facebook\Facebook([
'app_id' => '{app-id}',
'app_secret' => '{app-secret}',
'default_graph_version' => 'v2.8',
]);
However, when I run the project, I got following error:
Fatal error: Class 'Facebook\Facebook' not found in
C:\OpenServer\domains\localhost\blog\protected\controllers\PostController.php
on line 49
I do not know why it is happening. How can i solve it?
Related
So, I'm trying to test the register and login features on a Laravel 5.8 project, running on Homestead.
My problem is that I can't get the tests (for login and for register) to pass the assertAuthenticated() and assertAuthenticatedAs() functions.
I created the login feature using php artisan make:auth and didn't changed a lot, just created a "username" field to use instead of email.
When I test things like assertStatus(), $this->get(url), everything works fine but when I add the line $this->assertAuthenticatedAs($user) for example, the test crashes.
This is my actual passing function:
public function test_login_valid_user()
{
$user = factory(User::class)->create();
$response = $this->post('/login', [
'username' => $user->username,
'password' => 'secret'
]);
$response->assertStatus(302);
}
If I add the line $this->assertAuthenticatedAs($user) at the end, I get the following error:
There was 1 failure:
1) Tests\Feature\Auth\LoginTest::test_login_valid_user
The current user is not authenticated.
Failed asserting that null is not null.
/home/vagrant/code/my_project/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithAuthentication.php:89
/home/vagrant/code/my_project/tests/Feature/Auth/LoginTest.php:39
The same is happening on my register test, after the user is registered, when I try to check $this->assertAuthenticated() I get the same error.
So, I thought about session problems related to Vagrant/Homestead, but I just started to use them and couldn't find any hint about it. And I'm very new to PHPUnit and testing in general, I'm just starting to understand how it works.
The problem is connected with caches.
First of all file phpunit.xml must be read because you need: <server name="APP_ENV" value="testing"/>
Before your tests use command
php artisan config:clear
After that your dump(config('app.env')); will be testing (not local).
Then all works.
I'd been experiencing same problem. For unit tests CSRF token verification should be disabled, but only if you are running under APP_ENV=testing. I though phpunit.xml was overriding my "local" config so it was set to "testing". It was not, because PhpStorm was not reading this file.
If you are using PHPStorm don't forget to check path to default config file - phpunit.xml. (Settings -> Languages&Frameworks -> PHP -> Test frameworks)
I want to use laravel for building api.
I installed JWTAuth from installation guide on wiki page. When I want to use vendor:publish, I get this error:
After 3days searching on Google, I can not find a solution that working for me. How can I fix this?
For latest version. Please use following code in providers array in config file
For laravel
Tymon\JWTAuth\Providers\LaravelServiceProvider::class
For Lumen : open app/Providers/AppServiceProvider.php and add the following to the register() method.
$this->app->register(\Tymon\JWTAuth\Providers\LumenServiceProvider::class);
Hope this will help someone.
Simply means you have not added JWTAuthServiceProvider to list of Laravel Service providers.
Go to config/app.php and add JWTAuthServiceProvider to providers list
Like so:
'providers' => [
...
Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class,
...
]
Secondly since these error occurs only in console run:
composer update --no-scripts
composer update
add "tymon/jwt-auth": "^0.5.12" to composer.json and command
composer update
on app/config.php add this to providers
Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class,
and on app/config.php add this on aliases
'JWTAuth' => Tymon\JWTAuth\Facades\JWTAuth::class,
'JWTFactory' => Tymon\JWTAuth\Facades\JWTFactory::class,
tested on laravel 5.5 and tymon/jwt-auth": "^0.5.12"
trying to create an ACS server using Titanium Studio. Following the example of pixgrid (https://github.com/appcelerator/pixgrid/), but always get an error when trying to run locally; console output:
[INFO] Installing dependencies...
[INFO] Dependencies installed.
[INFO] socket.io started
[ERROR] Error occurred. TypeError: Cannot call method 'init' of undefined
at Object.start (/app.js:8:7)
app.js listing:
var ACS = require('acs').ACS,
logger = require('acs').logger,
express = require('express'),
partials = require('express-partials');
// initialize app (setup ACS library and logger)
function start(app) {
ACS.init('***', '***');
logger.setLevel('DEBUG');
//use connect.session
app.use(express.cookieParser());
app.use(express.session({ key: 'node.acs', secret: "secret" }));
//set favicon
app.use(express.favicon(__dirname + '/public/images/favicon.ico'));
//set to use express-partial for view
app.use(partials());
//Request body parsing middleware supporting JSON, urlencoded, and multipart
app.use(express.bodyParser());
}
// release resources
function stop() {
}
Ofcourse I have my OATH key and secret at the ***. Same when running from command line (acs run).
I am running Titanium Studio, build 3.4.1.201410281727.
I can however publish the service, and then run it from the cloud without any issues. For development this is not ideal, so want to run it locally (local node.ACS server).
I guess there must be something wrong with where things are installed (only used default), or permissions. Anyone that got a clue how to fix this? Have spent some hours now searching the internet, but seem to be the only one with this exact problem. No clue what else to try.
Thanks for reading this far. If you require more information to help me, let me know.
Ok, I found the problem. They changed the way to use ACS in the last upgrade.
Classic mode was:
var ACS = require('acs').ACS;
ACS.init('<ACS Key>', '<ACS secret');
Now they changed it and ACS is a "module", like any other one, so you must use the new way. In the package.json file add it as a dependecy:
"dependencies": {
"acs-node": ">=0.9.2"
}
Install it: npm install acs-node
Now you can use it in its new format, on the app.js file:
var ACS = require('acs-node');
ACS.init('<App Key>');
It's all explained here: http://docs.appcelerator.com/cloud/latest/#!/guide/node_acs
I am new to Impress Pages. Using version 4.2.7 ( Installed 4.2.6 and upgraded from within the CMS). I have the following issues;
Tried to add the "PHP" plugin and got error message
"Plugin signature verification failed" . Plugin is NOT ADDED
I tried to add a new theme and got the error message Unknown error. Please see logs.
Where are these logs ? I have tried /var/log/apache2/error_log , etc.
Update 1: The log within the cms shows ;
2014-11-01 17:00:44 Cron.finished array(0) { } 2014-11-01 17:00:44
Cron.started array(7) { 'firstTimeThisYear' => bool(false)
'firstTimeThisMonth' => bool(false) 'firstTimeThisWeek' => bool(false)
'firstTimeThisDay' => bool(false) 'firstTimeThisHour' => bool(true)
'lastTime' => int(1414828943) 'test' => NULL }
I dont see anything related to plugins or themes ? Is there another log ?
The error says that the signature of the file can't be verified. There may be two reasons for that:
Your server is missing some encryption lib. But I guess current implementation should not require any additional libs.
The downloaded file is not what had to be downloaded. That could be due to DNS errors, network error, etc.
Which case it is can be told only by debugging. You can always download plugins from market.impresspages.org and install them manually.
If you want to debug, first place to look at is file/secure/tmp dir. You should find the downloaded plugin there. Have a look if you can unzip it. If you can un-zip, you have the problem number 1, otherwise 2.
Most likely your server couldn't download files from Internet.
You can
I have problem with a Yiibooster sortable table rows. It is not working because of two errors.
The file "http://yii-cms.com/protected/extensions/bootstrap/assets/js/jquery.sortable.gridview.js" is not found by the system (404), although the rest of yiibooster files are working and I did installation according to the instructions.
The path to the "jquery.sortable.gridview.js" is generated by the system, I checked it and that file exists.
I installed Yiiboster by writing:
<?php
// main/config.php
Yii::setPathOfAlias('bootstrap', dirname(__FILE__).'/../extensions/bootstrap');
'preload'=>array('log', 'bootstrap'),
// autoloading model and component classes
'import'=>array(
'application.models.*',
'application.components.*',
'application.modules.admin.components',
'application.modules.admin.models.*',
'bootstrap.*',
),
// application components
'bootstrap' => array(
'class' => 'bootstrap.components.Bootstrap',
),
?>
The second error occurs in view file, near the 'afterSortableUpdate' property.
Uncaught TypeError: undefined is not a function
Please give me some advice. Thanks.
This looks like a bug of YiiBooster, try it with the newest version or you may report it here. Please mention your Yii version and YiiBooster version.
The assets need to be properly registered within Yii, so that they are cached in the assets folder. The protected folder is protected and requests to it are blocked.