symfony/silex csr.token_manager not defined - symfony

i have a project in silex that works perfectly on my Windows running xampp, but when i cloned it to my Ubuntu it threw the error "InvalidArgumentException in Container.php line 96:
Identifier "csrf.token_manager" is not defined."
I'm not using xampp or lamp on Ubuntu so i guess it could be some configuration of the apache2 or php.
I had an error before with csrf_provider and solved it with
$app['form.csrf_provider'] = null;
but if i try do do something like that it says it espects CsrfProviderInterface or CsrfTokenManagerInterface or null, or it just ignores if i'm logged in or not. I tried to find something around but i just found how to handle the token manager manually, i just want it to work as is. Thanks in advance.

Thanks to mTorres i solved it registering the CsrfTokenProvider
use Silex\Provider\CsrfServiceProvider;
$app->register(new CsrfServiceProvider());
No idea why it works on windows whitout it though.

Related

xampp v3.2.4 enabling sqlite3 (WINDOWS 10) 64bit

I've setup xampp on my windows machine, and I'm trying to use the sqlite3 module with php 7.4.3
I've edited my php.ini file and adjusted the extension=sqlite3 and restarted the service.
When i try and run this:
<?php
$db = new SQLite3('test.db');
?>
I get this error:
Fatal error: Uncaught Error: Class 'SQLite3' not found
I've also tried using pdo:
$db = new PDO("sqlite:".__DIR__."/test.db");
And with that i get this error instead:
Fatal error: Uncaught PDOException: could not find driver
Now I'm sure i have the sqlite3 ext because when i check the php/ext folder i can see the php_sqlite3.dll
I haven't changed anything else in the php.ini regarding the dir for the ext but im sure it's all setup correctly since all the other extensions are working just fine. Maybe I'm just being ignorant and I'm using sqlite3 incorrectly so please if someone knows the problem enlighten me.
Go in your XAMPP\php\php.ini, modify it with a text editor
Search for ;extension=sqlite3 with CTRL + F
Remove the ; to uncomment the line
Restart Apache to apply change
Now you are able to use Sqlite3 on XAMPP for Windows :D
Uncomment extension=sqlite3 in php.ini:
;extension=sqlite3
=>
extension=sqlite3
and restart Apache.
libsqlite3.dll isn't installed in the xampp\apache\bin folder.
you have to go into xampp\php copy libsqlite3.dll and paste into xampp\apache\bin.
easy fix, not sure why it isn't installed there in the first place ¯_( ͡° ͜ʖ ͡°)_/¯

When I writing php artisan serve 'Class 'reoute' not found'

It was working php artisan serve! After its not working! I didn't understand.Did you any suggest to look for it.
And giving error this
First of all you need to investigate why this error occurred. You have typo, Check your app\Http\routes.php and change reoute to Route
You have a typo in your source code. Use your editor (PHPStorm?) to find the word reoute in all your project files. It should be, probably route.
Also, make sure you did not modified any of the Laravel files (vendor/laravel/framework). It may be causing this error too.
I solve this! Because it was writing reoute::get('notes/{notes}/edit', 'NotesController#edit'); on web.php. I changed Route::get('notes/{notes}/edit', 'NotesController#edit');
In this error message shows the "reoute" class not found.Then first u should consider about the error message.go to app\Http\routes.php and you can find error.change class reout to Route
Something similar happened to me. I've created a laravel project. Until yesterday the php artisan serve command was working. Today, I ran the same command and the following error appeared:
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Illuminate\Database\Connectors\ConnectionFactory' not found
I solved it by deleting the vendor directory and executing the composer update command. After that I was able to execute the command php artisan serve.

Symfony - Manjaro Linux

Im using Symfony on Manjaro. And getting this error on default project;
Neither the property "ip" nor one of the methods "ip()", "getip()"/"isip()" or "__call()" exist and have public access in class "Symfony\Component\HttpKernel\Profiler\Profile" in #WebProfiler/Profiler/layout.html.twig at line 71
But i checked Profile file and ip(),getip(),isip() defined as ip,getIp(),isIp().
I think its caused by turkish letters.i was getting similar errors on ubuntu and export LC_ALL=C solves it.
But on manjaro this doesn't work. I tried export lang=en_US.UTF-8 or export LC_ALL=en_US.UTF-8 already.
Currently lang=tr_TR.UTF-8 , LC_ALL=tr_TR.UTF-8
Any suggestions with that?
Edit:I checked again and __call doesn't exist.Also im not getting any error on prod mode.(app.php)
Thanks
Its about policies of Turkish Republic. Set your clock back 1 hour and try again...

Parse error when on production

I have developed a Symfony2 project (v2.2.2) and it was working all fine locally.
When I deploy it on my server I meet 2 issues:
the folder /bin does not transfer through Filezilla (impossible to start transfer)
i encounter a parse error when trying to access web/app.php/ in debug mode (see below)
First I do not understand why it would work in local but not on production.
I also guessed these errors where linked but I do not know what is /bin used for (contains only 2 files doctrine and doctrine.php) and if I remove it locally it keeps working ...
Parse error is the following :
"FatalErrorException: Parse: syntax error, unexpected '[' in /home/colocall/twinkler/src/Tk/ExpenseBundle/Services/Expenses.php line 21"
Expenses.php line 15->25:
public function getAllExpenses($member, $group)
{
$all_expenses_col = $group->getExpenses();
$all_expenses = array();
foreach($all_expenses_col as $expense){
$all_expenses[] = [$expense, $this->forYou($member, $expense)];
}
return $all_expenses;
}
Maybe linked to : The parse error also happen when i try to update my database through ssh connection.
If someone would know the reason why I can't make it working it would save my day that i have already lost ...
Thank you in advance,
Jules
Your error is produced by using the short array syntax [] in your code.
It is not available in PHP 5.3.10 aka on your production server. The short syntax was introduced in PHP 5.4 which explains why your code is working in your dev-environment.
change ...
$all_expenses[] = [$expense, $this->forYou($member, $expense)];
...to
$all_expenses[] = array($expense, $this->forYou($member, $expense));
... or update your server's php version and it will work :)

Error Loading Zend Gdata framework into Wordpress

I am trying to use the Zend Gdata framework with wordpress but I am having some issues.
Now everything works perfectly fine when I test on localhost with XAMPP. However on my web server my code breaks down.
Here is my code to include the framework.
`set_include_path(TEMPLATEPATH . '/includes/');
require_once ('Zend/Loader.php');
Zend_Loader::loadClass('Zend_Gdata_Youtube');`
That code produces the following error.
Warning: Zend_Loader::include_once(Zend/Gdata/Youtube.php) [zend-loader.include-once]: failed to open stream: No such file or directory in /home/damain/public_html/mysite.com/wp-content/themes/mysite/includes/Zend/Loader.php on line 146
Warning: Zend_Loader::include_once() [function.include]: Failed opening 'Zend/Gdata/Youtube.php' for inclusion (include_path='/home/damain/public_html/mysite.com/wp-content/themes/mysite/includes/') in /home/damain/public_html/mysite.com/wp-content/themes/mysite/includes/Zend/Loader.php on line 146
Fatal error: Uncaught exception 'Zend_Exception' with message 'File "Zend/Gdata/Youtube.php" does not exist or class "Zend_Gdata_Youtube" was not found in the file' in /home/damain/public_html/mysite.com/wp-content/themes/mysite/includes/Zend/Loader.php:99 Stack trace: #0 /home/damain/public_html/mysite.com/wp-content/themes/mysite/includes/modules/yt_link_checker.php(19): Zend_Loader::loadClass('Zend_Gdata_Yout...') #1 /home/damain/public_html/mysite.com/wp-includes/plugin.php(405): load_zend_gdata('') #2 /home/damain/public_html/mysite.com/wp-admin/admin.php(111): do_action('load_zend_gdata', Array) #3 /home/damain/public_html/mysite.com/wp-admin/index.php(10): require_once('/home/damain/...') #4 {main} thrown in /home/damain/public_html/mysite.com/wp-content/themes/mysite/includes/Zend/Loader.php on line 99
I cannot seem to figure this issue out. Can anyone help?
The best solution in this case is to run the script requiring the Zend Loader and use var_dump(get_include_path()) to see what the server says the path is. Then keep modifying the php.ini include_path until the script finds it.
In your case, I'm not sure if 'damain' is supposed to be 'domain'. My include path which finally worked was:
/home2/thelove6/public_html/zf/ZendGdata/library" thelove6 being the username.
Did you look to see if those files exist in those directories? (/mysite/includes/Zend/Loader.php) and they have the correct permissions? It sounds like that could very well be the issue. The other thing to check with a simple phpinfo() would be that you have all of the libraries install on the live server.
Ok, the possible reason is: You're not using the proper case for the classname. For the version 1.11.11, it will be Zend_Gdata_YouTube rather than Zend_Gdata_Youtube.
Windows OS is ignoring the case, whereas the Linux server does not. Hope this will solve your problem, just look at the proper case of the Class or filenames.

Resources