I need to use the functions of a dll using php. I have read that through the COM class I can call their methods and access their properties in php. This is my code for test:
<?php
$obj = new COM("myfile.dll");
$output = $obj->Initial(); // Call the "Initial" method in the dll
But show this error:
error: Failed to create COM object `CyTconnect': Sintaxis no v�lida
I use windows, Apache, Php 7.1.12, activate the php com_dotnet extension, and register the dll with REGSVR32. Any suggestion?
Related
When making call to sodium_crypto_pwhash_str I get the following in my Apache error log file.
PHP Fatal error: Uncaught Error: Call to undefined function
sodium_crypto_pwhash_str()
My php version, as noted is 7.3.17 running on an Amazon EC2 instance.
My php-info() does not return any relevant libsodium information other than module author info:
Sodium Frank Denis
Given the above author information references a module author am I supposed to enable the sodium module? If the answer is yes is it referenced in the php.ini file? Such as:
extension=sodium
or perhaps:
extension=libsodium
What am I missing here?
Am I not supposed to use the documented function sodium_crypto_pwhash_str?
Am I supposed to use some other method of accessing the desired functionality?
Yes normally it's included in PHP 7.2+ but when you use the AWS EC2 instances this is a bit minimalistic and not everything is included.
https://www.php.net/manual/de/sodium.installation.php
Here you can see that you have to enable it during the compiling with --with-sodium[=DIR]. So you can compile it on your own or you try another distro to get it from your package manager or you use another lib to make it work.
https://forums.aws.amazon.com/thread.jspa?threadID=293187
I have a project with PHP 7.3, under Windows 10. I use the PHP from Xampp.
I get the following error:
Fatal error: Uncaught Error: Class 'SplEnum' not found in [...]
for
class BanLevel extends SplEnum { ... }
It seems I am misunderstanding the docu:
https://www.php.net/manual/en/class.splenum.php
https://www.php.net/manual/en/spl.installation.php
This gives me the idea it should be included in my PHP artefact.
What am I missing?
UPDATE:
The class.splenum.php page has gone offline. It is still available in Romanian, though: https://www.php.net/manual/ro/class.splenum.php, or here: https://php-legacy-docs.zend.com/manual/php5/en/class.splenum
It seems I checked the wrong documentation,
this is the right one:
https://www.php.net/manual/en/spl-types.installation.php
It clarifies:
This PECL extension is not bundled with PHP.
A DLL for this PECL extension is currently unavailable.
So I can't use SPLEnum under Windows, except I compile it into PHP.
UPDATE:
The spl-types.installation.php page does not exist on php.net anymore, but it is still available here:
https://php-legacy-docs.zend.com/manual/php5/en/spl-types.installation
I want to use C++ extension in yii. I have already compile .so file and successfully used in php script. But when I used it in yii framework, it occurs that "class not found",anyone knows why?
The C++ extension is rdkafka.so : https://github.com/arnaud-lb/php-rdkafka
$conf = new RdKafka\Conf();
$conf->set("ssl.key.location","./conf/client.key");
$conf->set("ssl.certificate.location","./conf/client.pem");
$conf->set("ssl.ca.location","./conf/ca.pem");
$conf->set("security.protocol","SSL");
If you are running this code in a namespaced file, you need to either import the class, or prefix it with a \:
$conf = new \RdKafka\Conf();
I am playing around with parsing spreadsheets and found the spreadsheet-reader class. I installed and have a very simple program written to open and parse an ".ODS" spreadsheet file. When I run it I get the error:
PHP Fatal error: Class 'XMLReader' not found in...
The line in question:
$ss = new SpreadsheetReader("test.ods");
So I google around and find out the version of PHP on that system needs to be at least 5.1 for it to use the version of XMLReader built into the core of PHP. I am using 5.4.12 there. I check with php -i and find PHP was compiled with: '--enable-xmlreader=shared'. According to the docs nothing needs to be configured at runtime to enable it.
Where else can I check and what am I doing wrong?
The solution is because PHP was built with a shared object file you DO need to modify php.ini: extension=xmlreader.so.
I just try to integrate ImageMagick into my PHP project. I installed and just execute the sample files that they provided with the imagick-3.0.0RC1 zip file. But it shows
Fatal error: Class 'Imagick' not found in C:\wamp\www\imagick-3.0.0RC1\imagick-3.0.0RC1\examples\watermark.php on line 9
this kind of an error how can I avoid that. I cant see any class including section on that page. How to include the class files.
You need to install the ImageMagick PHP extension. According to the manual there is no prebuilt extension for Windows so you'll probably have to configure and compile it yourself.