PHP 5.3.19: Class 'DOTNET' not found - php

When I try to load a DLL using the DOTNET() function I get the above error. However, I have .NET installed on my server (I can verify in IIS) and I have also enabled the php_com_dotnet.dll extension in my php.ini file.
This is what it looks like:
[PHP_COM_DOTNET]
extension=php_com_dotnet.dll
However I still get this error. (If it matters, I am not using one of windows's DLL's. It's a 3rd party one that I have obtained)

The reason why i was getting this error is because i was editing the WRONG php.ini file. If you develop PHP in visual studio with the php plugin, you have a separate ini file to work with. It is that one that i had to change to get this to work rather than the .ini file in IIS.

Related

PHP SOAP extension not working (PHP + IIS + SOAP Extension)

I'm having some issues trying to achieve a SOAP request to a web service by using PHP.
I have a really small project which only send some requests of a SOAP web service, parses them and show the results on a table, but it's not working. I've developed this using XAMPP and this is the very first time I deploy something on a IIS web server so I'm a newbie.
I'm not using any framework, it's just plain PHP.
The first problem I have is that php_soap.dll extension seems to be disabled since I check the configuration with php_info(); and I can't find SOAP extension in the result, but I've enabled it in my php.ini by removing the semicolon from that line and my extension folder is "ext" under my PHP folder. I have some other extensions running and they're just fine.
Doing some var_dump when I try to instatiate the SOAP class, it's not returning anything (not even null).
Some more info:
PHP Version: 7.3.25
IIS Version: 10.0.17763.1 running on Windows Server 2019
2022-09-05 Edit
I've found out that php_openssl.dll isn't working on my server. I don't know why. It's enbled in php.ini. However, phpinfo(); shows it as disabled.
On the other hand, when I run "php -m" command on my CMD, it shows that SOAP and OpenSSL are enabled:
The first thing you need to do is enable the php_soap extension in your php.ini file. You can do this by removing the semicolon from the line that says ;extension=php_soap.dll. Once you have done this, restart your web server.
Next, you need to make sure that the extension_dir setting in your php.ini file points to the directory where your PHP extensions are located. For example, if your extensions are in the c:\php\ext directory, then your extension_dir setting should look like this:
extension_dir = "c:\php\ext"
Once you have done this, restart your web server.
If you still cannot get the SOAP extension to work, please post a comment below and I will try to help you further.
I already solved my problem.
The problem was not in the PHP.ini file, that one was correctly configured.
The problem was that I hadn't installed an extension for PHP and IIS. Once I've installed PHP Manager For IIS and configured it by following this tutorial, it worked out correctly.

Difficulty loading additional extensions into php instance on Azure

Trying to load one new extension to php instance on Azure. After reading several articles and tutorials, I feel that I have everything set up properly. In addition to adding the dll, I'm also telling the file to change the location of the includes/ directory. In addition, I've tried both PHP7.2 and 7.3 for the application.
That change works, so the file is getting read. But teh .dll does not show up with phpinfo nor a dump of all the loaded extensions. The fact that the .ini file I'm using also specifies a new location for the includes directory show that the file is being read properly. That does not hold true for the dll though and I don't know it I'm using the wrong version of the dll, have a poor configuration or something else.
This is my first rodeo with Azure, so it's a steep learning curve so far.
I've tried multiple variations of the details but nothing has worked yet. Currently, I have an application setting with "PHP_INI_SCAN_DIR" that points to the directory in the D drive of d:\home\site\ext.
I have another .ini file for the actual extensions in the ini directory as well. The sole line in it points at the dll location - zend_extension="d:\home\sites\ext\php_xdebug-2.7.2-7.2-vc15-nts.dll"
The path is correct and, from what I can tell, everything is right - but the extension won't load. I've changed the location, changed the file name, changed build versions of the file, used 'zend_extension' and just plain 'extension' with similar results. Using 32bit nts extensions as well.
No error messages seen - either on screen on in the logs on Azure. I expect to see xdebug as a separate section after wddx using phpinfo() but nothing shows.
Any assistance would be greatly appreciated. Thanks in advance.
It sounds like you have read the related sections of the offical document Configure PHP in Azure App Service.
However, there are some important points I think which be necessary to pay attention to.
In section How to: Change the built-in PHP configurations, notice for these steps as below.]
Add a .user.ini file to your root directory.
Add configuration settings to the .user.ini file using the same syntax you would use in a php.ini file.
Restart the app. (Restarting is necessary because the frequency with which PHP reads .user.ini files is governed by the
user_ini.cache_ttl setting, which is a system level setting and is 300
seconds (5 minutes) by default. Restarting the app forces PHP to read
the new settings in the .user.ini file.)
Add an App Setting to your app with the key PHP_INI_SCAN_DIR and value d:\home\site\ini
Create an settings.ini file using Kudu Console
(http://.scm.azurewebsite.net) in the d:\home\site\ini
directory.
Add configuration settings to the settings.ini file using the same syntax you would use in a php.ini file.
To reload the changes, restart your app.
So it's important that to create .user.ini and settings.ini files in the correct path, and to restart your app is required for reloading the changes.
In sections How to: Enable extensions in the default PHP runtime and How to: Use a custom PHP runtime, for compatibility, please use an extension with VC9 and non-thread-safe (nts) compatible version, not VC15.
Put .dll extension files in the ext directory (for example, php_xdebug.dll). Make sure that the extensions are compatible with
default version of PHP and are VC9 and non-thread-safe (nts)
compatible.
Obtain a non-thread-safe, VC9 or VC11 compatible version of PHP for Windows. Recent releases of PHP for Windows can be found here:
https://windows.php.net/download/. Older releases can be found in the
archive here: https://windows.php.net/downloads/releases/archives/.
Hope it helps.

PHP version 5.5 doesn't recognize custom include_path set in php.ini file. Lower PHP version does

My website currently runs on PHP 5.2 on an Apache Linux server (according to my hosting providers info). I want to upgrade to at least PHP 5.5 since there is a feature I need available from that version and above. I am open to also use higher versions like 7, but every version above 5.2 brings the following problem:
When running in PHP 5.2 I successfully added a custom include_path additionally to the default one in the php.ini
php.ini:
[PHP]
include_path = ".:/usr/local/lib/php:/custom/include/path"
register_globals = Off
In the above php.ini code the default path which was already set is
/usr/local/lib/php
and the one I added is
/custom/include/path
(I removed personal information by changing path and file names).
I should mention that the additional include_path is not in the same folder structure. In fact, it is on a different domain. Still the same server, but a different domain, so for the additional path I have to go through the root path of my providers users/... path.
(The domains share the same website content, just in different languages. That is why I want both to be able to access and process a common main include_path since they use the same scripts).
In my website I include php files commonly just like this:
website.php:
<?php
require_once 'external_script_file.php';
?>
As I said, in PHP 5.2 everything runs smoothly. The file is loaded and processed. But as soon as I switch the PHP version up to let's say 5.5 I get this error:
Error in browser:
Warning: require_once(external_script_file.php): failed to open stream: No such file or directory in /[server_path]/website.php on line 7
Fatal error: require_once(): Failed opening required 'external_script_file.php' (include_path='.:/usr/local/lib/php') in /[server_path]/website.php on line 7
(I removed personal information by changing path and file names).
As you see in the error message, he seems to only be able to see the default include path, but not the added custom one.
Do I have to manage something differently regarding the php.ini settings file when operating in a higher PHP version? Or what else could be the issue?
Thanks a lot!
​
You can try using set_include_path() function in your code.
set_include_path('/usr/lib/pear');
Or ini_set()
ini_set('include_path', '/usr/lib/pear');
You didn't mentioned any information about the system you are trying to run PHP on (i.e. what OS, web server, etc), so this is a shot in the dark. If you have multiple PHP versions installed, it's possible that each version has its own php.ini file.
On the page you are trying to load, stick phpinfo();die; at the top of the file. Run the site in PHP 5.2, and see what the "Loaded Configuration File" value is. Then, switch to a newer PHP version, refresh the page, and check if the "Loaded Configuration File" value is the same or not.
Just an accident!
Either the php.ini generator I used, or just me copying back and forth created a space at the beginning of the php.ini file, right before the title [PHP]. Apparently PHP versions higher than 5.2 can't handle that.
So just make sure to not create any unneccessary spaces within, or especially at the beginning of the php.ini file.

Accessing PHP extensions within CakePHP

Our system uses a program called PDFlib TET for extracting data from PDF files. The software is installed as a PHP extension.
I have the software working fine outside of CakePHP, I can create a new TET object by calling:
$tet = new TET();
From any file - the extension I am including (php_tet.so) seems to simply work.
However, when I call this from within CakePHP I get the following error:
Class 'TET' not found.
Is there something basic I am missing here?
You have to include the extension in the php.ini file where you're executing the script. Mind that the command line version of PHP (CLI) uses a different php.ini than the webserver by default. E.g. on a recent Ubuntu Linux box, you have to make sure your
extension=php_tet.so
line is included both in /etc/php5/cli/php.ini and /etc/php5/apache2/php.ini.

PHP won't parse MySQL statements

I just installed Apache 2.2.15/PHP 5.3.2/MySQL 5.1.44 on Windows Vista. Apache is working fine, PHP is functional, and MySQL works on the CLI. However, when I try to access MySQL via PHP, I get an error (Fatal error: Call to undefined function mysql_connect()). extension=php_mysql.dll and extension=php_mbstring.dll are uncommented in the php.ini file, and PHP is in the system path. There is no libmysql.dll in either the top level PHP directory or the ext directory. There's a libmySQL.dll file in the MySQL bin directory (which is also in the system path); I tried renaming it, but that doesn't do anything
Also, in case anyone wants to know, I originally installed PHP using the MSI installer, but it was missing some DLLs, so I installed from the zip file.
I think I've exhausted all my options. Any help on this problem would be very appreciated.
Thanks in advance.
IIRC the msi installer sets some registry values that influence the php configuration, see http://docs.php.net/configuration.changes#configuration.changes.windows. That might change the location of the php.ini that is used. You might want to delete those registry keys. Anyway, you did edit the file that is shown in the output of phpinfo()?
Which build of php do you use? The one you can download from http://windows.php.net/download/? Then you probably have the new mysqlnd transport driver built into the php core dll and don't need libmysql.dll. The mysqlnd driver should show up in the output of phpinfo(). Does it?
It sounds like you do not have the MySQL mod for PHP properly installed or configured. I recommend using AMP on Linux, so sorry for not having any specific instructions for Windows.

Categories