Yii Database connection error - postgresql

I am using an application in Yii and Postgres database. When I run the application on live server(not local system) I am getting this error
CDbConnection failed to open the DB connection: SQLSTATE[08006] [7] could not connect to server: No buffer space available (0x00002747/10055) Is the server running on host "localhost" and accepting TCP/IP connections on port 5432?"
When I contact with server support team they told to close the db connection after each transaction. I would like to know how to close database connection after each transaction in yii with PostgreSQL?
This is my database connection code in main.php
'db'=>array( 'class'=>'CDbConnection', 'connectionString' => 'pgsql:host=localhost;port=5432;dbname=crescent_6', 'emulatePrepare' => true, 'username' => 'postgres', 'password' => 'root', 'charset' => 'utf8', ), 'cache' => array ( 'class' => 'system.caching.CDbCache', ),

Related

TYPO3 v9 using Microsoft SQL Server 2016

PHP 7.3
pdo_sqlserver_73_nts (installed)
sqlserver_73_nts (installed)
I'm trying to connect a new install of TYPO3 (v9.5.7) to an instance of SQL Server 2016 running on the same box.
I'm able to establish a connection to the database, using the example from php.net: https://www.php.net/manual/en/function.sqlsrv-connect.php so I'm confident the server is accessible.
A similar question has been asked for v8 here Install TYPO3 8.7.7 with SQL Server on IIS and it's recommend that you ammend the DB settings in LocalConfiguration when the installer is at stage 2 and essentially "trick" the installer to connect to SQL Server.
I've done that and for some reason it won't connect,
'DB' => [
'Connections' => [
'Default' => [
'charset' => 'utf-8',
'dbname' => 'typo3_db',
'driver' => 'sqlsrv',
'host' => 'localhost',
'password' => 'password',
'port' => 1433,
'user' => 'username',
],
],
],
Is there anything wrong with this connection string? I can't seem to find any other working example.
Thanks as always,
i had the same problem.
Try to set the full name of your mssql server:
'host' => 'COMPUTERNAME/DBNAME',

Connection could not be established with host with swift mailer in laravel 5.6

I have implemented swiftmailer in laravel 5.6. It was working fine last 2 months. But last 2 days it is not working.
It says:
Connection could not be established with host mail.zinismart.com.bd
[php_network_getaddresses: getaddrinfo failed: Temporary failure in
name resolution #0]
I can't find out what is my problem.
Here is my code:
// mail driver = sendmail
$transport = new \Swift_SmtpTransport('mail.zinismart.com.bd', '587', 'tls');
$transport->setUsername('test#zinismart.com.bd');
$transport->setPassword('password');
$transport->setStreamOptions(array('' => array('allow_self_signed' => true,"verify_peer_name"=>false, 'verify_peer' => false)));

Php PEAR and outlook.office365.com imap

I am trying to connect to outlook application of office365 using the php PEAR framework. Below are the details of imap
IMAP Host: outlook.office365.com
IMAP Port: 993
Encryption: SSL
IMAP Username: (my Office365 username)
IMAP Password: (my Office365 password)
But i am unable to establish connection to it. Firewall for the port 993 is already opened from the server i am trying. Can someone help me where i am going wrong.
Error:
(
[0] => Array
(
[code] => 1
[params] =>
[package] => Mail_IMAPv2
[level] => error
[time] => 1543397738.02
[context] => Array
(
[file] => /app/lib/PEAR/Mail/IMAPv2.php
[line] => 713
[function] => connect
[class] => Mail_IMAPv2
)
[message] => Unable to build a connection to the specified mail server.
)
)
Our old Imap connection looks like this
imap://{$user}:{$pass}#hostname:port/{$Folder}#notls
We have replaced this format using php inbuilt function
imap_open("{hostname:port/imap/ssl/novalidate-cert/authuser=$user/user=$user}", $user ,$pass);
It is working for us now.

How to send email with Zend FrameWork 2 and Hostgator

I've got a code I made myself for sending email using Zend Framework2 via gmail SMTP, my code works flawlessly in local host and in some free hosting sites but when running from Hostgator I get this:
File: vendor/zendframework/zendframework/library/Zend/Mail/Protocol/AbstractProtocol.php:225
Message: Connection refused
This is my Code:
use Zend\Mail\Transport\SmtpOptions;
use Zend\Mail\Message;
use Zend\Mail\Transport\Smtp;
$options = new SmtpOptions(array(
'name' => 'Gmail.com',
'host' => 'smtp.gmail.com',
'port'=> 587,
'connection_class' => 'login',
'connection_config' => array(
'username' => 'user#gmail.com',
'password' => 'password',
'ssl'=> 'tls',
),
));
$message = new Message();
$message->addTo('him#gmail.com')
->addFrom('user#gmail.com')
->setEncoding("UTF-8")
->setSubject('test')
->setBody('test');
$transport = new Smtp();
$transport->setOptions($options);
$transport->send($message);
I contacted Hostgator support and they solved my problem, the thing is hostgator servers does not allow smtp relay, so you just have to use an email account that exists within the hostgator server (one created for your domain I suggest). And thats all the problem was about :)

not able to ssh to remote machine

Not able to login to machine... but using the same credential i can log in to the machine
my $ssh = Net::SSH::Expect->new (host => "9.118.46.36", password=> 'test01', user => 'root', raw_pty => 1, timeout => 20);
# establishes the ssh connection,
# authenticating with that user and password
$ssh->login();
SSHAuthenticationError Login timed out. The input stream currently has the contents bellow: root#9.118.46.36's password: at /usr/local/share/perl/5.14.2/Expect.pm line 828
I increased the timeout to 30 and it works...
Is there any way to check what should be the time out.
As system load increase timeout 30 also may not work.