Error on using Chilkat.Zip2 - php

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

Related

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 GearmanClient not working on Ubuntu 16.04 LTS

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

How to setup a mongodb with php XAMPP?

I am a beginner to mongoDB, I want to learn mongoDB. So I read few tutorials and tried to configure mongoDB in my local machine, for that I have downloaded mondoDB's php_mongo.dll file and placed that on my local machine into the path "php/ext/php_mongo.dll" and after that I added this code "extension = php_mongo.dll" to php.ini file, after that I am trying run my XAMPP server but immediately it is showing the below error :
C:xampp\php\ext\php_mongo.dll is either not designed to run on Windows
or it contains an error. Try installing the program again using the
original installation media or contact your system administrator or
the software vendor for support.
after that somehow Apache server has been started And when I try to run the application on browser by URL http://localhost/mongoapp/index.php then it is throwing the following error:
Fatal error: Uncaught Error: Class 'MongoClient' not found in C:\xampp\htdocs\mongoapp\index.php:3 Stack trace: #0 {main} thrown in C:\xampp\htdocs\mongoapp\index.php on line 3
File: index.php
// connect to mongodb
$m = new MongoClient();
echo "Connection to database successfully";
// select a database
$db = $m->mydb;
echo "Database mydb selected";
My php version is "PHP Version 7.0.8". hope someone helps, Thanks in advance.
Check your phpinfo if mongodb is loaded.
Download mongodb from "https://www.mongodb.com/download-center?jmp=nav#community" and install.
Check your architecture in phpinfo match with mongodb.
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­

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.

PHP launching a Windows application

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

Categories