PlasmaPHP / driver-mysql

The plasma driver for MySQL / MariaDB.

Home Page:https://plasmaphp.github.io/driver-mysql/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fatal error:Non-static method Plasma\Drivers\MySQL\DriverFactory::__construct() cannot be called statically

Nereg opened this issue · comments

commented

Hello! I got this error :
PHP Fatal error: Uncaught Error: Non-static method Plasma\Drivers\MySQL\DriverFactory::__construct() cannot be called statically in /home/admin/web/mystat.pp.ua/public_html/main.php:5 Stack trace: #0 {main} thrown in /home/admin/web/mystat.pp.ua/public_html/main.php on line 5
when runing code from this gist :
https://gist.github.com/Nereg/6cd3ce648fb0b20ff688db39862b77a1
How I can fix it ? And code from README is not working

Replace __construct with create, that's where you went wrong (it's correct in the readme).

commented

Im tried that but :
Fatal error: Uncaught Error: Call to undefined method Plasma\Drivers\MySQL\DriverFactory::create() in /home/admin/web/mystat.pp.ua/public_html/main.php:5 Stack trace: #0 {main} thrown in /home/admin/web/mystat.pp.ua/public_html/main.php on line 5

You can simply create a new instance regularly (using new), I've change the readme to reflect this 784ed70. The create method was supposed to work, but I'm not sure currently why not, so simply using the regular constructor is the fastest way.

commented

No. Not working for me. I got this error:

Notice: Undefined variable: clients in /home/admin/web/mystat.pp.ua/public_html/main.php on line 18
PHP Fatal error: Uncaught TypeError: Argument 1 passed to CharlotteDunois\Livia\Providers\PlasmaProvider::__construct() must implement interface Plasma\ClientInterface, null given, called in /home/admin/web/mystat.pp.ua/public_html/main.php on line 18 and defined in /home/admin/web/mystat.pp.ua/public_html/vendor/charlottedunois/livia/src/Providers/PlasmaProvider.php:32
Stack trace:
#0 /home/admin/web/mystat.pp.ua/public_html/main.php(18): CharlotteDunois\Livia\Providers\PlasmaProvider->__construct(NULL)
#1 {main}
thrown in /home/admin/web/mystat.pp.ua/public_html/vendor/charlottedunois/livia/src/Providers/PlasmaProvider.php on line 32

Fatal error: Uncaught TypeError: Argument 1 passed to CharlotteDunois\Livia\Providers\PlasmaProvider::__construct() must implement interface Plasma\ClientInterface, null given, called in /home/admin/web/mystat.pp.ua/public_html/main.php on line 18 and defined in /home/admin/web/mystat.pp.ua/public_html/vendor/charlottedunois/livia/src/Providers/PlasmaProvider.php:32
Stack trace:
#0 /home/admin/web/mystat.pp.ua/public_html/main.php(18): CharlotteDunois\Livia\Providers\PlasmaProvider->__construct(NULL)
#1 {main}
thrown in /home/admin/web/mystat.pp.ua/public_html/vendor/charlottedunois/livia/src/Providers/PlasmaProvider.php on line 32

Please read and understand the error message. You seem to have written your variable wrong.

https://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php