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.
Related
Octane is installed with roadrunner while following the official guide, on the Ubuntu 18.04 server. Each step works as expected until the server is started:
php artisan octane:start --server=roadrunner --port=8181
Then, an error is received and the command exits. The complete stacktrace is attached:
INFO Server running…
Local: http://127.0.0.1:8181
Press Ctrl+C to stop the server
INFO [INFO] RoadRunner server started; version: 2.6.3, buildtime: 2021-12-03T11:37:00+0000
PHP Warning: require(/path/vendor/bin/bootstrap.php): Failed to open stream: No such file or directory in /path/vendor/bin/roadrunner-worker on line 18
PHP Fatal error: Uncaught Error: Failed opening required '/path/vendor/bin/bootstrap.php' (include_path='.:/usr/share/php') in /path/vendor/bin/roadrunner-worker:18
Stack trace:
#0 {main}
thrown in /path/vendor/bin/roadrunner-worker on line 18
INFO error occurred: WorkerAllocate:
INFO goridge_frame_receive: EOF, plugin: http.Plugin
ERROR 2021-12-07T12:01:53.048Z ERROR container/poller.go:16 vertex got an error {"id": "http.Plugin", "error": "WorkerAllocate:\n\tgoridge_frame_receive: EOF"}
ERROR github.com/spiral/endure/pkg/container.(*Endure).poll.func1
ERROR github.com/spiral/endure#v1.0.10/pkg/container/poller.go:16
ERROR handle_serve_command: WorkerAllocate:
ERROR goridge_frame_receive: EOF
Since roadrunner is based on go, I don't have much insights on how to navigate through the error. Please let me know if anyone has solved this issue before, thanks.
You should fix all warnings like this one: PHP Warning: require(/path/vendor/bin/bootstrap.php): Failed to open stream: No such file or directory in /path/vendor/bin/roadrunner-worker on line 18
These warnings appear in the stdout, but stdout is used as a process fd to communicate with the RR. That means if some data is sent to the stdout (like PHP warning) before RR initializes all processes (aka worker), RR will stop allocating the workers and exit with code 1.
I'm trying to run this simple code on both PHP 7 and 8:
$loop = \React\EventLoop\Factory::create();
$filesystem = \React\Filesystem\Filesystem::create($loop);
$file = $filesystem->file('test.txt');
$file->getContents()->then(function ($contents) {
echo $contents . PHP_EOL;
});
$loop->run();
After installing via composer, and yet it tells me that adapter is missing
Error:
PHP Fatal error: Uncaught RuntimeException: No supported adapter found for this installation in \root\src\Filesystem.php:31
Stack trace:
#0 \root\try.php(6): React\Filesystem\Filesystem::create()
#1 {main}
thrown in \root\vendor\react\filesystem\src\Filesystem.php on line 31
Just look where and why the exception originated. (I will use react/filesystem:0.1.2 in code examples.)
The exception was thrown in React\Filesystem\Filesystem::create(). List of supported adapters is obtained from React\Filesystem\Filesystem::getSupportedAdapters().
This way you will come to methods which define whether given adapter is available on your platform:
Method Eio\Adapter::isSupported():
return substr(strtolower(PHP_OS), 0, 3) !== 'win' && function_exists('proc_open');
This means your platform must not be Windows and proc_open() function must exist (i.e. it must not be disabled for security reasons by disable_functions directive).
Method ChildProcess\Adapter::isSupported():
return extension_loaded('eio');
This means eio PHP extension must be installed, see installation instructions.
For me it also does not work as I am on Windows. For development with ReactPHP, it is generally a good idea to run PHP on Linux virtual machine for better compatibility.
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
I want to launch a bat file or exe
I tried
system("C:\\PATH\\TO\\FOLDER\\script.bat")
system("CMD.EXE C:\\PATH\\TO\\FOLDER\\script.bat")
system("C:\\PATH\\TO\\FOLDER\\exefile.exe /S nameOfFileToCreate.txt")
system("CMD.EXE C:\\PATH\\TO\\FOLDER\\exefile.exe /S nameOfFileToCreate.txt")
system("START C:\\PATH\\TO\\FOLDER\\script.bat")
system("START C:\\PATH\\TO\\FOLDER\\exefile.exe /S nameOfFileToCreate.txt")
With START, I get this error message. The others attempts result in the page loading forever!
Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> WshShell.Exec<br/><b>Description:</b> The system cannot find the file specified. ' in C:\xampp\htdocs\upload.php:95 Stack trace: #0 C:\xampp\htdocs\upload.php(95): com->Exec('START C:\PROGRA...') #1 {main} thrown in C:\xampp\htdocs\upload.php on line 95
Try the exec function:
http://us2.php.net/function.exec
this didnt work. For whatever reason, I can't launch the app. I decided to create a simple VBS script and I restart the PC with PHP as a temp solution
Can anybody please let me know, i have used the below code to access COM object...
$zip = new COM("Chilkat.Zip2");
echo $zip;
but, which shows an like this...
Fatal error: Uncaught exception 'com_exception' with message 'Failed
to create COM object `ZipActiveX': Invalid syntax ' in
D:\xampp\htdocs\test\testscript1.php:2 Stack trace: #0 D:\xampp\htdocs\test\testscript1.php(2): com->com('ZipActiveX')
#1 {main} thrown in D:\xampp\htdocs\test\testscript1.php on line 1
please advice me, that do i need to change anything in my php.ini file to access COM?
shut down apache and start in administrator mode if using windows vista or 7.
edited:
chillkat zip activex is for windows server. you can download and install from this url http://www.chilkatsoft.com/download/ZipActiveX.msi
run webserver in windows using xampp adn run locally
xampp download url: http://www.apachefriends.org/en/xampp.html