Codeigniter A PHP Error was encountered, Filename: mysqli/mysqli_driver.php - codeigniter-3

I am using Codeigniter 3.0.0 and have just tested the program live online. The website is www.theloven.com.
The problem is like below
I could not fix the error.I need some help on this case
A PHP Error was encountered
Severity: Warning
Message: mysqli::real_connect(): (42000/1203): User ... already has more than 'max_user_connections' active connections
Filename: mysqli/mysqli_driver.php
Line Number: 135
Backtrace:
File: /home/.../public_html/index.php
Line: 292
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/theloven8/public_html/system/core/Exceptions.php:272)
Filename: Session/Session.php
Line Number: 140
Backtrace:
File: /home/.../public_html/index.php
Line: 292
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/theloven8/public_html/system/core/Exceptions.php:272)
Filename: Session/Session.php
Line Number: 168
Backtrace:
File: /home/.../public_html/index.php
Line: 292
Function: require_once

First you have specify local host user name and passwords in config > database.php
'hostname' => 'localhost',
'username' => 'uname',
'password' => 'password',
'database' => 'project',
'dbdriver' => 'mysqli',

Related

PHP imap library - how to get headers value

I fallow to:
https://github.com/ddeboer/imap/blob/master/src/Message/Headers.php
I try get:
'status' => $message->getHeaders()->get('reply_to'),
But I get issue:
`Severity: Notice
Message: Array to string conversion
Filename: database/DB_driver.php
Line Number: 1471
Error Number: 1054
Unknown column 'Array' in 'field list'
...
..
..
**Array**, 'new')`
How to correct get value reply_to ?
I need to check if this is new message or this is reply on message.

Execute some logic before and after quiz attempt

I am using "\mod_quiz\event\attempt_started" Event observers but i am not getting any result, php error messages or logs.
I am creating own local plugin for leader board functionality but I am stuck in Event observers call.
In events.php file
$observers = array(
array('eventname' => '\mod_quiz\event\attempt_started',
'includefile'=> '/local/leaderboard/locallib.php',
'callback' => 'quiz_attempt_started',
'internal' => 1
),
array('eventname' => '\mod_quiz\event\attempt_submitted',
'includefile' => '/local/leaderboard/locallib.php',
'callback' => 'quiz_submitted_start'
),
);
In locallib.php
function quiz_attempt_started($event) {
file_put_contents('/local/leaderboard/log.txt', $event);
//Logic Here
}
function quiz_submitted_start($event) {
file_put_contents('/local/leaderboard/log.txt', $event);
// Logic Here
}
With debugging on this is the error that moodle shows.
PHP Notice: Exception encountered in event observer 'quiz_attempt_submitted': Coding error detected, it must be fixed by a programmer: PHP catchable fatal error
- line 20 of \local\leaderboard\lib.php: call to default_error_handler()
- line ? of unknownfile: call to quiz_attempt_submitted()
- line 155 of \lib\classes\event\manager.php: call to call_user_func()
- line 89 of \lib\classes\event\manager.php: call to -
core\event\manager::process_buffers()
- line 2489 of \lib\dml\moodle_database.php: call to core\event\manager::database_transaction_commited()
- line 92 of \lib\dml\moodle_transaction.php: call to moodle_database->commit_delegated_transaction()
- line 2221 of \mod\quiz\attemptlib.php: call to moodle_transaction->allow_commit()
- line 88 of \mod\quiz\processattempt.php: call to quiz_attempt->process_attempt()
in E:\Moodle_Boost\03_Execution\04_Tech\03_Source Code\lms\lib\weblib.php on line 3096
Here noting to get error or result. Am I forgetting or doing something wrong here?

Laravel Mail::Send works on local apache but complains about mime on nginx

I have installed a laravel package for user verification
https://github.com/jrean/laravel-user-verification
Register Controller needs to be changed to work like below.
public function register(Request $request)
{
$this->validator($request->all())->validate();
$user = $this->create($request->all());
$this->guard()->login($user);
UserVerification::generate($user);
UserVerification::send($user, 'Verification Mail from example.com');
return redirect()->intended('/home');
}
Used mailgun to send mails.It worked fine on local apache. sent mails successfully to gmail and others.
Installed on nginx production(ubuntu 16.04 VPS ). It throws following error.
FatalThrowableError in SimpleMessage.php line 33:
Type error: Argument 1 passed to Swift_Mime_SimpleMessage::__construct() must
be an instance of Swift_Mime_HeaderSet, none given, called in /var/www/example.com/
html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Message.php on line 48
To check if it is a package problem I have also done the following which works on local apache but throws the same error on nginx.
Route::get('/mailsend', function() {
$data = [
'title' => 'hello user',
'content' => 'Thanks for joining us'
];
Mail::send('mails.test', $data , function($message) {
$message->to('example#gmail.com','example')->subject('Testing from example');
});
});
The code as shown in error /Swift/Message.php in line 48 as follows
call_user_func_array(
array($this, 'Swift_Mime_SimpleMessage::__construct'),
Swift_DependencyContainer::getInstance()
->createDependenciesFor('mime.message')
);
Could not figure out the problem with nginx. Any help would be greatly appreciated.
Try uncomment line: extension=php_openssl.dll on php.ini
and check this https://laravel.io/forum/05-13-2014-smtp-mail-not-working-in-live-server

mblox soap api - php soap Payment Request not working

mblox soap api - php soap Payment Request not working and gives error.
I use as below code in subscribe.php file...
$client = new SoapClient("https://ngp.us.mblox.com/client-gateway/services?wsdl", array('trace' => 1, 'encoding' => 'UTF-8', 'soap_version' => SOAP_1_2));
$array = array(
'SecurityContext'=>array('userId'=>'aaaaaaaa','password'=>'bbbbbbbb'),
'ClientDetails'=>array('shortcode'=>'234242', 'brandName'=>'aaaaaaaaaa.com', 'programSponsor'=>'aaaaaaaaaa', 'originatingUrl'=>'www.aaaaaaaaaa.com', 'minPageUrl'=>'www.aaaaaaaaaa.com', 'successUrl'=>'www.aaaaaaaaaa.com/subscribConfirm.php', 'cancelUrl'=>'www.aaaaaaaaaa.com', 'tcUrl'=>'www.aaaaaaaaaa.com/terms.html', 'postBackUrl'=>'http://aaaaaaaaaa/subscribe.php'),
'paymentDetails'=>array('paymentType'=>'PSMS', 'amount'=>'9.99', 'currency'=>'USD', 'billingFrequency'=>'MONTHLY'),
'msisdn'=>'243233232',
'serviceId'=>'332',
'operatorId'=>'33343',
'productDescription'=>'Text test',
'optInBody'=>'aaaaaaaaaa',
'browserSessionId'=>'123456',
);
$result = $client->initiatePayment($array);
It shows error as below on last line => $result = $client->initiatePayment($array);
Fatal error: Uncaught SoapFault exception: [(null)] in
/aaaaaaaa/Source/developement/PHP/ver1/subscribe.php:97 Stack trace:
0 /aaaaaaaa/Source/developement/PHP/ver1/subscribe.php(97): SoapClient->__call('initiatePayment', Array) #1
/aaaaaaaa/Source/developement/PHP/ver1/subscribe.php(97):
SoapClient->initiatePayment(Array) #2 {main} thrown in
/aaaaaaaa/Source/developement/PHP/ver1/subscribe.php on line 97
I got things working using curl,
I use This
as a reference and code working.
Thankx

In remote host: Connection could not be established with host smtp.gmail.com [Connection timed out #110]

after deploying I gettin this error below when i try to send an mail:
500 | Internal Server Error | Swift_TransportException
Connection could not be established with host smtp.gmail.com [Connection timed out #110]
stack trace
* at ()
in SF_ROOT_DIR/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/StreamBuffer.php line 235 ...
232. }
233. if (!$this->_stream = fsockopen($host, $this->_params['port'], $errno, $errstr, $timeout))
234. {
235. throw new Swift_TransportException(
236. 'Connection could not be established with host ' . $this->_params['host'] .
237. ' [' . $errstr . ' #' . $errno . ']'
238. );
* at Swift_Transport_StreamBuffer->_establishSocketConnection()
in SF_ROOT_DIR/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/StreamBuffer.php line 70 ...
67. break;
68. case self::TYPE_SOCKET:
69. default:
70. $this->_establishSocketConnection();
71. break;
72. }
73. }
* at Swift_Transport_StreamBuffer->initialize(array('protocol' => 'ssl', 'host' => 'smtp.gmail.com', 'port' => 465, 'timeout' => 30, 'blocking' => 1, 'type' => 1))
in SF_ROOT_DIR/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/AbstractSmtpTransport.php line 101 ...
98.
99. try
100. {
101. $this->_buffer->initialize($this->_getBufferParams());
102. }
103. catch (Swift_TransportException $e)
104. {
* at Swift_Transport_AbstractSmtpTransport->start()
in SF_ROOT_DIR/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mailer.php line 74 ...
71.
72. if (!$this->_transport->isStarted())
73. {
74. $this->_transport->start();
75. }
76.
77. return $this->_transport->send($message, $failedRecipients);
* at Swift_Mailer->send(object('Swift_Message'), array())
in SF_ROOT_DIR/lib/vendor/symfony/lib/mailer/sfMailer.class.php line 300 ...
297. return $this->realtimeTransport->send($message, $failedRecipients);
298. }
299.
300. return parent::send($message, $failedRecipients);
301. }
302.
303. /**
* at sfMailer->send(object('Swift_Message'))
in SF_ROOT_DIR/lib/vendor/symfony/lib/mailer/sfMailer.class.php line 263 ...
260. */
261. public function composeAndSend($from, $to, $subject, $body)
262. {
263. return $this->send($this->compose($from, $to, $subject, $body));
264. }
265.
266. /**
* at sfMailer->composeAndSend('tirengar#gmail.com', 'tirengarfio#hotmail.com', 'Confirm Registration', 'Hello fjklsdjf,<br/><br/> Click here to confirm your registration<br/><br/> Your login information can be found below:<br/><br/> Username: fjklsdjf<br/> Password: m')
in SF_ROOT_DIR/plugins/sfDoctrineGuardExtraPlugin/modules/sfGuardRegister/lib/BasesfGuardRegisterActions.class.php line 89 ...
86. $user->getEmailAddress(),
87. 'Confirm Registration',
88. $message
89. );
90. }
91.
92. /**
* at BasesfGuardRegisterActions->sendRegisterConfirmMail(object('sfGuardUser'), 'm')
in SF_ROOT_DIR/plugins/sfDoctrineGuardExtraPlugin/modules/sfGuardRegister/lib/BasesfGuard
This is my configuration in factories.yml.
all:
mailer:
param:
delivery_strategy: realtime
transport:
class: Swift_SmtpTransport
param:
host: smtp.gmail.com
port: 465
encryption: ssl
username: tirengarfio
password: XXXX
The port 465 is open the my remote host. No problem in localhost.
Any idea?
--
Javi
Ubuntu 8.04
I have taken these instructions directly from gmail site.
you have to use #gmail.com in your username.
Outgoing Mail (SMTP) Server - requires TLS: smtp.gmail.com (use authentication)
Use Authentication: Yes
Use STARTTLS: Yes (some clients call this SSL)
Port: 465 or 587
Account Name: your full email address (including #gmail.com)
Google Apps users, please enter username#your_domain.com
Password: your Gmail password
You need to open 465 on firewall
On CSF firewall you need to add 465 on TCP_OUT =
I don't know if this helps, buy I've run with the same problem on my local machine (Windows). For resolving this I had to copy two dlls on the php directory to system32(ssleay.dll and libeay.dll) and unncoment the extension php_openssl.dll on my apache configuration. There might be a similar solution for linux. I suggest you contact the hosting because it's quite possible that you cannot perform this solution on a shared hosting.
Well, I had the same problem for a while, replacing: smtp.gmail.com with 173.194.65.108 actually worked for me!
If you get this constantly without any luck, then check the settings again.
I was overlooking my settings and later found the host was wrong.
I used,
smtp.google.com
instead of
smtp.gmail.com
Too silly, but it happened to me.