How to install and use SmallFry framework.
I downloaded it from https://github.com/maniator/SmallFry
Extracted it under htdocs and placed all content in folder: smallfry (C:\xampp\htdocs\smallfry).
Set Doc root to define('DOCROOT', 'C:/xampp/htdocs'); in Autoloader.php.
Changed db info to following settings---
$CONFIG->set('DB_INFO', array(
'host' => 'localhost',
'login' => 'root',
'password' => '',
'database' => 'smallfry',
));
Still getting the following error --
let me know what else need to be change as i m very new to this framework.
Apparently, the framework is a bit out-dated, as assigning the return vlaue of new by reference is indeed deprecated. You should look for $x =& new Obj; calls and remove the &.
The Fatal error should be fixed after fixing the other issues. According to the documentation, that method should exist.
Fatal error occurs due to first two errors.
Because of Deprecated warnings Config class wasn't loaded correctly.
Related
I'm trying to use Standalone Twig to send emails with Swiftmailer. I'm following for the instructions at the "With a pure Swiftmailer/Twig" section.
This is my code:
require_once('/var/www/folder/includes/vendor/autoload.php');
$loader = new Twig_Loader_Filesystem(array('/var/www/templates/utilities/test'));
$twig = new Twig_Environment($loader, array(
'cache' => '/var/www/templates/cached',
'auto_reload' => true, // set to false to improve performance (Note: You have to clear the cache manually whenever a template is changed)
'debug' => true,
'use_strict_variables' => false,
));
$twig->addExtension(new Twig_Extension_Debug());
$swiftMailerTemplateHelper = new \WMC\SwiftmailerTwigBundle\TwigSwiftHelper($twig, '/var/www/templates/utilities/test');
// I'm not exactly sure what the value for the second parameter is supposed to be.
//The instructions referenced just list a variable called $web_directory.
//I'm assuming they just mean a path to where the templates are stored.
echo "hello world";
This is the error I'm getting:
PHP Fatal error: Class
'WMC\SwiftmailerTwigBundle\TwigSwiftHelper' not found in
/var/www/apps_mymea/utilities/test/email.php on line 16
The namespace in the referenced documentation is incorrect.
The correct syntax is:
$swiftMailerTemplateHelper = new \WMC\SwiftmailerTwigBundle\Mailer\TwigSwiftHelper($twig, '/var/www/templates/utilities/test');
//It was missing the \Mailer\ in the class path.
I'm somewhat lost what I've done here. My app was functioning for a while, and at some point I changed something that caused this error. I've cleared my dev cache. At some point I wonder if I updated my composer and caused something because I wasn't even touching the php side of my app when I broke it.
Here's the full error:
UndefinedMethodException in appDevDebugProjectContainer.php line 1606:
Attempted to call an undefined method named "AddAthlete" of class "FOS\RestBundle\Util\FormatNegotiator".
That particular function looks like this:
protected function getFosRest_ExceptionFormatNegotiatorService()
{
$this->services['fos_rest.exception_format_negotiator'] = $instance = new \FOS\RestBundle\Util\FormatNegotiator();
$instance->AddAthlete($this->get('fos_rest.request_matcher.0dfc4cce134bee15f08405cb5cea4845b13ff7d8c8f779004218432a2c552bd0cd9f9d27'), array('priorities' => array(0 => 'html', 1 => 'json', 2 => 'xml'), 'fallback_format' => NULL, 'prefer_extension' => '2.0', 'methods' => NULL, 'stop' => false));
return $instance;
}
I'm not particularly familiar with how this gets generated. Could someone help? If needed, here's a link to my bundle on github
Turns out I must have had some composer issues because when I pulled the repo down to my other machine, it worked fine (with the exception of new bugs, yay!)
I'm trying to build a project with Propel these days. I did the basic 'bookstore' tutorial on propelorm.org/documentation/02-buildtime.html, but when I'm trying to finally insert the generated sql code via propel, to fill the database, the following error is thrown:
[Exception] Unable to parse contents of "/sqldb.map".
Unfortunately I've got no idea what went wrong; I followed the tutorial as precisely as possible.
Information about my installation and what I've done so far:
1) Localhost installation (Mac OS 10.8.5) with PHP 5.4.27 (DOM Module, PDO and SPL enabled) and MySQL 5.6.19.
2) successfully parsed Composer.json with:
{
"require": {
"propel/propel": "~2.0#dev"
},
"autoload": {
"classmap": ["bookstoreDb/generated-classes/"]
}
}
3) created a schema.xml with foreign keys, exactly like in the tutorial (propelorm.org/documentation/02-buildtime.html).
4) created a config file, propel.yaml, in subfolder 'conf', again like in the tutorial.
5) used the propel scripts to generate the necessary sql (propel sql:build), model (propel model:build) and configuration files (propel config:convert). The result of these commands are as indicated as in the tutorial.
6) created the database 'bookstore' successfully via terminal.
7) trying to insert the sql code via propel sql:insert. Now the error as described above is thrown:
[Exception] Unable to parse contents of "/sqldb.map".
Here is the index.php of the project:
// setup the autoloading
require_once 'vendor/autoload.php';
// setup Propel
require_once 'bookstoreDb/generated-conf/config.php';
// Here I get the parse error: parse error in ../bookstore/bookstoreDb/generated-classes/Base/Author.php on line 138
$author = new Author();
$author->setFirstName('Jane');
$author->setLastName('Austen');
$author->save();
And here the config.php:
$serviceContainer = \Propel\Runtime\Propel::getServiceContainer();
$serviceContainer->checkVersion('2.0.0-dev');
$serviceContainer->setAdapterClass('bookstore', 'mysql');
$manager = new \Propel\Runtime\Connection\ConnectionManagerSingle();
$manager->setConfiguration(array (
'classname' => 'Propel\\Runtime\\Connection\\ConnectionWrapper',
'dsn' => 'mysql:host=localhost;dbname=bookstore',
'user' => 'root',
'password' => 'password',
'attributes' =>
array (
'ATTR_EMULATE_PREPARES' => false,
),
));
$manager->setName('bookstore');
$serviceContainer->setConnectionManager('bookstore', $manager);
$serviceContainer->setDefaultDatasource('bookstore');
Where may be the problem? And is there some other way to setup a basic project? I'd appreciate every help! Thanks!
I submitted an issue for this: https://github.com/propelorm/Propel2/issues/694
SqlBuildCommand uses configured sql-dir
$manager->setWorkingDirectory($generatorConfig->getSection('paths')['sqlDir'])
SqlInsertCommand only uses the command line option
$manager->setWorkingDirectory($input->getOption('sql-dir'));
adding --sql-dir option with correct sql dir to propel sql:insert does work
fix is submitted https://github.com/propelorm/Propel2/pull/695 but not merged yet
I'm going to implement login functionality using zend framework 2.
My code as follows.
$dbAdapter = new DbAdapter(array(
'driver' => 'Mysqli',
'database' => 'db',
'username' => 'root',
'password' => 'password'
));
$authAdapter = new AuthAdapter($dbAdapter);
$authAdapter
->setTableName('admin_users')
->setIdentityColumn('user_name')
->setCredentialColumn('password')
;
$authAdapter
->setIdentity($username)
->setCredential($password)
;
$result = $authAdapter->authenticate();
It gives error message as follows.
The supplied parameters to DbTable failed to produce a valid sql statement, please check table and column names for validity.
I checked database configurations and column names. But they are correct. Can anyone give me a clue to check this out please.
Thanks.
There's no need to re-invent the wheel and struggle with this yourself. ZF2 has been created with modularity in mind so that plug in modules for this kind of thing can be written.
There are a few such modules available already at the ZF-Commons site. The one you are looking for is ZfcUser. Just follow the instructions to install and use it. There is even an excellent tutorial written by the author of the module that will take you through the whole process step by step. http://blog.evan.pro/getting-started-with-the-zf2-skeleton-and-zfcuser
There is also an excellent how-to page to tell you how to modify it for your own use.
Here is a snippet of the code I got from some tutorial blog:
<?php
class PersonalBlogController extends AppController {
var $name = 'PersonalBlog';
var $uses = array('PersonalBlog');
function index(){
//ini_set('max_execution_time', 300);
debug($this->PersonalBlog->findAll());
//debug($this->PersonalBlog->find('all'));
}
}?>
I have seen some other cases in max time limit fatal error from other posts. But mine is probably the most disgusting. The fatal 30 secs time limit error keeps coming even after I change the max_execution_time variable in php.ini. Even after changing it to 60 or 300 seconds, the error message stays the same. It says 30 seconds time limit is exceeded.
I then followed alternative solution from a similar question, which is to do this instead:ini_set('max_execution_time', 300); (See my commented code above).
The error is gone. However what happens after that is this:
Warning (2): PDO::__construct(): [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) [CORE\cake\libs\model\datasources\dbo\dbo_mysql.php, line 155]
.....
.....blablabla...
Fatal error: Call to a member function getAttribute() on a non-object in C:\Server\www\myserver.dev\public_html\cakephp-cakephp-7fbf7a4\cake\libs\model\datasources\dbo\dbo_mysql.php on line 259
So I realized that I actually have two MySQL server installed. The newest one (5.5.11) is on port 3307 not on port 3306! That is why I then changed my driver setting in the dbo_mysql.php:
/**
* Base configuration settings for MySQL driver
*
* #var array
*/
protected $_baseConfig = array(
'persistent' => true,
'host' => 'localhost',
'login' => 'root',
'password' => 'mysqlpassword',
'database' => 'personal_blog',
'port' => '3307'
);
Every other setting is normal; I have the same database setting for app>config>database file as you can see here:
public $default = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'root',
'password' => 'mysqlpassword',
'database' => 'personal_blog',
'port' => 3307,
'prefix' => '',
);
After those changes, the warning still appears...I really feel like I want to throw up right now
Any help would be appreciated.thx
You shouldn't have to edit the dbo_config to manage the port setting. All of those keys are available for use in the database.php file in your app/config/ folder.
You actually shouldn't have your personal defaults in the dbo file at all -- nothing you are doing should ever edit any core files.
Once you have your port setting in ONLY the database.php file and your dbo driver is back to the one that shipped with cake you should delete all of the files in /tmp/cache and set your debug > 0 in app/config/core.php
Refresh and if the error is still occurring we know that something is messed up at the php.ini / .htaccess or ini_set level. Try adjusting the value and then loading a view that contains
<?php
phpinfo( );
?>
and see if the max execution time setting is actually being read by the php interpreter. If it isn't you might want to try the ini set method or htaccess methods of playing with that value. Also make sure the php.ini you are editing is the right one ( the path to the ini should be in the php info dump ) - you might find you have 2 versions of php loaded as well as your two versions of mysql.
If that doesn't solve or at least pinpoint the issue then post back here and let us know.