PHP GearmanClient not working on Ubuntu 16.04 LTS - php

I have this simple code:
<?php
$client = new \GearmanClient();
$client->addServer();
This gives following error:
PHP Fatal error: Uncaught GearmanException: Failed to set exception option in /var/www/demo-admin/public-html/admin-generico/vendor/generico/components/tests/utils/test-gearman.php:4
Stack trace:
#0 /var/www/demo-admin/public-html/admin-generico/vendor/generico/components/tests/utils/test-gearman.php(4): GearmanClient->addServer()
#1 {main}
thrown in /var/www/demo-admin/public-html/admin-generico/vendor/generico/components/tests/utils/test-gearman.php on line 4
Gearman server is definitely running as confirmed by ps:
ps -A | grep gearman
25698 ? 00:00:00 gearmand
I installed php-gearman from ppa:ondrej/pkg-gearman
Gearman version is 1.1.17

The addServer() method requires a host parameter, even if the gearman server is running locally:
$client->addServer('127.0.0.1');
Even though the documentation says the default is the local server, I've found that it sometimes has to be specified to make that error go away.

The comment by #Kris Peeling gave an idea. I uninstalled everything gearman and installed again. Voila! Problem gone. I didn't have to use the localhost IP.
I referred this: https://www.patreon.com/posts/gearman-now-in-14627464

Related

PHPOffice: PHP Fatal error: Interface 'Psr\SimpleCache\CacheInterface' not found

I have custom WordPress plugin where I giving option for admins to download export of survey. The plugin using package phpoffice
I have test hosting with PHP 7.3 where export goes well and the production hosting is on PHP 7.3.3 (before it was PHP 7.4) where the exactly same problem does not work.
I'm expecting to resolve this error and make the option for download exports working..
I've tried searching for google but I didn't find solution exactly for my problem.
I tried this stuffs:
Upgrade memory_limit from 256MB to 512MB
Tried to downgrade production hosting PHP version from 7.4 to 7.3.3
When production hosting PHP version was 7.4 it gived this error in PHP error log:
[22-Dec-2022 08:45:24 UTC] PHP Fatal error: Uncaught Error: Interface 'Psr\SimpleCache\CacheInterface' not found in /www/doc/www.digitalniagora.cz/www/wp-content/plugins/agora_survey/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/Memory.php:14
Stack trace:
#0 /www/doc/www.digitalniagora.cz/www/wp-content/plugins/agora_survey/vendor/composer/ClassLoader.php(571): include()
#1 /www/doc/www.digitalniagora.cz/www/wp-content/plugins/agora_survey/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile('/www/doc/www.di...')
#2 [internal function]: Composer\Autoload\ClassLoader->loadClass('PhpOffice\\PhpSp...')
#3 /www/doc/www.digitalniagora.cz/www/wp-content/plugins/agora_survey/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Settings.php(164): spl_autoload_call('PhpOffice\\PhpSp...')
#4 /www/doc/www.digitalniagora.cz/www/wp-content/plugins/agora_survey/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/CellsFactory.php(19): PhpOffice\PhpSpreadsheet\Settings::getCache()
#5 /www/doc/www.digitalniagora.cz/www/wp-content/ in /www/doc/www.digitalniagora.cz/www/wp-content/plugins/agora_survey/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/Memory.php on line 14
After I downgraded the PHP version to 7.3.3 (because I haven't option to downgrade to PHP 7.3) I getting just this error:
[27-Dec-2022 15:43:23 UTC] PHP Fatal error: Interface 'Psr\SimpleCache\CacheInterface' not found in /www/doc/www.digitalniagora.cz/www/wp-content/plugins/agora_survey/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/Memory.php on line 14
EDIT 29.12.2022:
I tried update PHP version on test hosting to the same version as production hosting is but on test version it working well and production version code does not work.
But the code is exactly same as on test hosting where everything works well and also the code is exactly same after downgrade PHP version..
Can anybody give me some hints to find the solution?

Laravel 8 undefined error Illuminate\\Support\\Collection::getArrayableItems()

Using laravel v8.7*
Using apache server and used deployer to deploy the Laravel application on the server.
Having issues once deployed to a server.
I get the following error:
PHP Fatal error: Uncaught Error: Call to undefined method Illuminate\Support\Collection::getArrayableItems() in /var/www/html/releases/2/vendor/laravel/framework/src/Illuminate/Collections/Collection.php:31\n
Stack trace:\n
#0 /var/www/html/releases/2/vendor/laravel/framework/src/Illuminate/Collections/helpers.php(15): Illuminate\Support\Collection->__construct(Array)\n#1 /var/www/html/releases/2/vendor/laravel/framework/src/Illuminate/Support/Traits/ReflectsClosures.php(49): collect(Array)\n
#2 /var/www/html/releases/2/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/ReportableHandler.php(62): Illuminate\Foundation\Exceptions\ReportableHandler->firstClosureParameterTypes(Object(Closure))\n
#3 /var/www/html/releases/2/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(234): Illuminate\Foundation\Exceptions\ReportableHandler->handles(Object(Symfony\Component\ErrorHandler\Error\FatalError))\n
#4 /var/www/html/releases/2/vendor/laravel/framework/src/Illuminate/Foundati in /var/www/html/releases/2/vendor/laravel/framework/src/Illuminate/Collections/Collection.php on line 31
Used the following instructions to deploy Note: using apache server over ngnix as apache is currently running other applications on the server.
Have you checked if the PHP version on the droplet is the same as the PHP version you have been using locally? This looks like an error that will occur if you change versions between PHP / Laravel.

How to repeat an example with Ratchet Push?

I would like to repeat the Ratchet Push example. Downloaded Composer. In the project folder via the console (CLI) I entered: php composer.phar require cboden/ratchet, after which the vendor folder and a pair of files from Composer appeared. I installed ZeroMQ and tried two installation options:
Downloaded the necessary files from
https://pecl.php.net/package/zmq/1.1.3/windows. - libzmq.dll unpacked in C:\xampp\php,- php_zmq.php in C:\xampp\php\ext.Added the C:\xampp\php\ext to system variable PATH,+ restarted the computer, + restarted the web server.
Downloaded the necessary files from
https://pecl.php.net/package/zmq/1.1.3/windows.- libzmq.dll unpacked
in C:\xampp\php\windowsXamppPhp,- php_zmq.php in C:\xampp\php\windowsXamppPhp\ext.Added the C:\xampp\php\windowsXamppPhp\ext to system variable PATH,+ restarted the computer,+ restarted the web server.
I also tried to throw the file libzmq.dll into the same folder as php_zmq.php.
The installation was guided by:https://wiki.zeromq.org/bindings:php+
https://superuser.com/questions/585291/installing-...
After all, started the xampp server, then in the console entered: php push-server.php, but the console throws an error :
> PHP Fatal error: Uncaught Error: Class 'React\ZMQ\Context' not found
> in C:\xampp\htdocs\test\push-server.php:9 Stack trace:
> #0 {main} thrown in C:\xampp\htdocs\test\push-server.php on line 9
>
> Fatal error: Uncaught Error: Class 'React\ZMQ\Context' not found in
> C:\xampp\htdocs\test\push-server.php:9 Stack trace:
> #0 {main} thrown in C:\xampp\htdocs\test\push-server.php on line 9
P.S.: I believe that something is wrong with the installation of ZeroMQ since the file was not working.
ОС: windows 10
Server: XAMPP
PHP version: 7.4.2

PHP PDOException: could not find driver but driver is installed?

I'm running PHP 7.1 on an IIS 10.0 server and trying to connect to a MSSQL database.
Trying to instantiate a connection like this:
$dbh = new PDO("sqlsrv:Server=#server#;Database=#dbname#", "#username#", "#passwd#");
Gives me this error:
Fatal error: Uncaught PDOException: could not find driver in C:\inetpub\wwwroot\projects\test.php:6 Stack trace: #0 C:\inetpub\wwwroot\projects\test.php(6): PDO->__construct('sqlsrv:Server=...', '#username', '#pwd...') #1 {main} thrown in C:\inetpub\wwwroot\projects\test.php on line 6
However, sqlsrv is activated in my php.ini:
extension=php_sqlsrv.dll
extension=php_pdo_sqlsrv.dll
It's uncommented, and it's the right php.ini (already checked with phpinfo()). Restarting the server also didn't do anything.
I really don't understand why this is happening when the driver is obviously installed :/
What makes it extra weird is that I have another application running on the same server that also connects to a MSSQL database and it works with no problems, it had an automatic installer though so I didn't have to configure anything myself. It also connects to a local db and right now I'm trying to connect to a remote one if that makes a difference.

Failed to create COM object `WScript.shell': CoInitialize has not been called

At sometime today, this error occurred and the script hanged:
[21-Aug-2013 08:35:06] PHP Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `WScript.shell': CoInitialize has not been called.
' in C:\path\to\my\script.php:357
Stack trace:
#0 C:\path\to\my\script.php(357): com->com('WScript.shell')
#1 {main}
thrown in C:\path\to\my\script.php on line 357
This is the line (running in a loop) causing the error:
$com = new Com('WScript.shell');
This line usually runs fine so I'm not missing any libraries. Why could this happen ?
Go to php.ini and add this line. After that, restart php server. Good luck to you
extension=php_com_dotnet.dll
That is most likely due to desktop heap allocation error. One way to verify is to go to Windows Event Log (system category) and search for "desktop heap allocation failed" error or warning. As an workaround, you can consider using shell_exec.
For more details about desktop heap allocation error, see KB 184802
Effectively include the library "extension = php_com_dotnet.dll" in php.ini can serve in executing $ command = new Com ('WScript.Shell');
in my case it worked with Apache / 2.2.29 server (Win64) PHP / 3.5.29 mod_ssl / 2.2.29
thanks a lot.

Categories