I'm facing a very tough difficulty since a day ago, i still can't find any solutions regardless all my researches. My hosted website on bluehost has 2 databases, the first one is a mysql database which i connect to database easily and a sql database which i can't connect to it. I learn that i should have extension=php_pdo_sqlsrv_55_nts.dll, extension=php_sqlsrv_55_ts.dll in php.ini according my php version.
If my website is hosted how can i connect to the second sql database ?
My database file is like this :
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$active_group = 'default';
$query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'ausername',
'password' => 'apassword',
'database' => 'adatabase',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
$db['second_database'] = array(
'dsn' => '',
'hostname' => 'aaa.bbb-east-1.rds.amazonaws.com',
'port' => '14733',
'username' => 'aa',
'password' => 'apassword1',
'database' => 'adatabase1',
'dbdriver' => 'sqlsrv',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
When i load the page i have this error :
Fatal error: Call to undefined function sqlsrv_connect() in /home2/admedica/public_html/admedicall_v1/system/database/drivers/sqlsrv/sqlsrv_driver.php on line 144
Related
I want to connect to a postgresql database in CodeIgniter via the pdo-driver.
Doing it manually works without any Problems:
$gp = new PDO("pgsql:host=pdca.example.de;port=5432;sslmode=require;dbname=dssprod;",$techUser,$techPW);
$query = $gp->query('select * from table limit 10');
$result = $query->fetchAll( PDO::FETCH_ASSOC );
var_dump($result);
doing the same within CodeIgniter in config\database.php :
$active_group = 'default';
$db['default'] = array(
'dsn' => "pgsql:host=pdca.example.de;port=5432;sslmode=require;dbname=dssprod;",
'username' => $techUser,
'password' => $techPW,
'dbdriver' => 'pdo'
);
and then in a view:
$connect = $this -> load -> database();
var_dump($connect);
--> results in a bool(false)
I can't get a Connection to the db with CodeIgniter, any idea why?
--- edit ---
I tried a config without pdo, same result (false).
$active_group = 'default';
$db['default'] = array(
'hostname' => 'pdca.example.de',
'port' => 5432,
'sslmode' => 'require',
'username' => $techUser,
'password' => $techPW,
'database' => 'dssprod',
'dbdriver' => 'postgre',
'dbprefix' => '',
'pconnect' => FALSE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'save_queries' => FALSE
);
I always getting an error when sending an email. I already openned the open_ssl on php.ini . Currently i am using "guzzlehttp/guzzle": "~4.0" for the mail.
Here's my mail.php settings :
'driver' => 'smtp',
'host' => 'smtp.gmail.org',
'port' => 587,
'from' => array('address' => 'tokotonight456#gmail.com', 'name' => 'tonight'),
'encryption' => 'tls',
'username' => '', //i already set the username + pass correctly
'password' => '',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
Mail::send('mail', array('firstname'=>'budi'), function($message) {
$message->to('tokotonight456#gmail.com','lukas aa')->subject('Welcome to the Laravel 4 Auth App!');
});
Use Mandrill driver instead of smtp. Laravel ships with it.
in app/config/mail.php
change this line
'driver' => 'mandrill',
go to https://mandrillapp.com/settings
sign up and create an an api key
create an app/config/services.php configuration fileand add below configurations and mandrill api key
return array(
'mailgun' => array(
'domain' => '',
'secret' => '',
),
'mandrill' => array(
'secret' => 'enter your mandrill api key here',
),
'stripe' => array(
'model' => 'User',
'secret' => '',
),
);
It is working on my localhost . But on live server not working.
It shows following error
Connection could not be established with host smtp.gmail.com [Connection timed out #110]
How to solve it?
And my app/config/mail.php
<?php
return array(
'driver' => 'smtp',
'host' => 'smtp.gmail.com',
'port' => 465,
'from' => array('address' => 'myaddress', 'name' => 'Name'),
'encryption' => 'ssl',
'username' => 'myemail#gmail.com',
'password' => 'mypassword',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
);
Try this configuration:
return array(
'driver' => 'smtp',
'host' => 'smtp.gmail.com',
'port' => 587,
'from' => array('address' => 'myaddress', 'name' => 'Name'),
'encryption' => 'tls',
'username' => 'myemail#gmail.com',
'password' => 'mypassword',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
);
Hope this will work for both your local as well as live server.
It will work in laravel 5.1
In your .env file
change the follwoing
MAIL_DRIVER=mail
MAIL_HOST=www.yourhost.com
MAIL_PORT=587
MAIL_USERNAME=your email address
MAIL_PASSWORD=email password
MAIL_ENCRYPTION=null
change in config/mail.php
return [
'driver' => env('MAIL_DRIVER', 'mail'),
'host' => env('MAIL_HOST', 'www.yourhostname.com'),
'port' => env('MAIL_PORT', 587),
'from' => ['address' => 'youremail#domain.com', 'name' => 'any name'],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
];
I am using the getDefaultEntities() function which is run from my installer script. It mostly works, almost all of the attribute config keys reflect properly in the Attributes section of the admin. However the "visible," "visible_on_front" and some of the other properties do not work at all. My custom attribute is always set to not visible, not visible on front end. Can anyone spot what I am doing wrong?
class Ia_AdvancedShipping_Model_Resource_Eav_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup
{
/**
* #return array
*/
public function getDefaultEntities()
{
return array(
'catalog_product' => array(
'entity_model' => 'catalog/product',
'attribute_model' => 'catalog/resource_eav_attribute',
'table' => 'catalog/product',
'additional_attribute_table' => 'catalog/eav_attribute',
'entity_attribute_collection' => 'catalog/product_attribute_collection',
'attributes' => array(
'iaadvancedshipping_profile' => array(
'group' => 'Advanced Shipping',
'label' => 'Shipping Profiles',
'type' => 'varchar',
'input' => 'select',
'source' => 'iaadvancedshipping/product_attribute_source_profiles',
'default' => '0',
'class' => '',
'backend' => '',
'frontend' => '',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
'visible' => true,
'required' => false,
'user_defined' => false,
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => true,
'visible_in_advanced_search' => false,
'unique' => false
),
)
)
);
}
}
When looking for a way to provide a cakestrap application with Google Calendar, I came across an older post which mentioned this plugin:
http://www.neilcrookes.com/2009/09/27/get-google-analytics-data-in-your-cakephp/
While trying to add support for Google Calendar it turned out this plugin is not compatible with cakeStrap which I have to use.
I have allready refactored the models, views and controllers but I can't figure out how to convert the gdata-config so it can be used:
<?php
/**
* Coniguration options for Gdata API
*/
class GDATA_CONFIG {
var $analytics = array(
'datasource' => 'gdata',
'driver' => 'analytics',
'email' => '',
'passwd' => '',
'profileId' => '',
'source' => 'CakePHP',
);
var $youtube = array(
'datasource' => 'gdata',
'driver' => 'youtube',
'email' => '',
'passwd' => '',
'source' => 'CakePHP',
);
var $picasa = array(
'datasource' => 'gdata',
'driver' => 'picasa',
'email' => '',
'passwd' => '',
'source' => 'CakePHP',
'cache' => true,
'cacheDuration' => '+1 hours'
);
var $calendar = array(
'datasource' => 'gdata',
'driver' => 'calendar',
'email' => '',
'passwd' => '',
'source' => 'CakePHP',
);
}
?>
This is my first time working with cakePHP so any help is appreciated.
Custom configuration format (using PHP reader) is like:
<?php
$config = array('youtube' =>
'datasource' => 'gdata',
'driver' => 'youtube',
'email' => '',
'passwd' => '',
'source' => 'CakePHP'
));
You can use Configure::load('configuration_file_name.php') to load configuration file and Configuration::read('configuration_array_key') to read configuration variables.
See http://book.cakephp.org/2.0/en/development/configuration.html#configure-class for more information.