Accessing PHP extensions within CakePHP - php

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.

Related

PHP 5.3.19: Class 'DOTNET' not found

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.

Class 'httpRequest' not found PHP 5.3 windows

I am trying to install http request class for PHP in windows.
I have downloaded a file here:
http://downloads.php.net/pierre/
php_http-5.3-nts-svn20091125-vc6-x86.zip
However, when I try to enable the extension by adding
extension = php_http.dll to the php.ini, it does not show up in the phpinfo()
Has anyone had any success getting the httprequest class to work in windows.
This is what I am trying to do.
$url = 'http://example.com/';
//create the httprequest object
$httpRequest_OBJ = new httpRequest($url, HTTP_METH_POST);
My guess is that the extension is not in the correct folder, or you have yet to restart your webserver.
If you are using WAMP, make sure that you're editing the php.ini under the apache folder and not the php folder - the latter's php.ini is only used in the command line.
PHP extensions are usually called "php_*.dll" (where the star represents the name of the extension) and they are located under the "PHP\ext" ("PHP\extensions" in PHP 4) folder.
For future reference: http://php.net/manual/en/install.pecl.windows.php
Check the php.ini file under apache/apachex.x.xx/bin/php as well.
This is for those using IIS 7.
The trouble is, that not all of the dll for http request are compatible and therefore wont load. Fortunately I have found the correct one.
This is the httprequest dll, that you need to install for httprequest to work:
http://www.findthatzip-file.com/search-9898866-hZIP/winrar-winzip-download-php-http-5.3-nts-svn20091125-vc9-x86.zip.htm

PHP scws extention is not loaded by MAMP

I have a problem about loading extension of PHP in MAMP:
I have compiled and installed scws.so (PHP extension for Chinese words segmentation) into folder '/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions' together with other extensions like pgsql.so, etc.
Also, I've updated the php.ini under '/Applications/MAMP/bin/php/php5.3.6' by adding 'extension=scws.so'.
If I issue command '/Applications/MAMP/bin/php/php5.3.6/bin/php -m' in console, I can see 'scws' is in the output list. But it has not been loaded after starting MAMP, also, I can not see 'scws' is listed with function phpinfo().
Could anyone help me about how to force the load of the new PHP extension? Why it is listed by 'php -m', but actually not loaded by MAMP?
Thanks in advance!
The configuration for PHP called from web server is different from command line php. In phpinfo() check the path to the php.ini file that is being used and make sure that it is the same file that you edited to add the extensions.

GD2 library in PHP not installing

I'm having problems installing the GD library. I'm using an IIS server with PHP 5.2.14. I uncommented extension=php_gd2.dll in php.ini.
This is the error:
gd: Unable to initialize module
Module compiled with module API =20060613
PHP compiled with modlule API = 20090626
These options need to match
in Unknown on Line 0
I downloaded various PHP versions to try and get the correct DLL, including thread-safe 5.2.14. I would then restart my application pool and try to load a file that uses the GD library. Are there other files necessary for gd2 to work? Are there any quick ways to solve this without reinstalling PHP entirely?
first, iis7 was not configured properly for php - I searched for a guide that walked me through. Second the directory was incorrect, whenever I reset the iis server it originally would say one directory when ISAPI api was being used- but after 2 mins it would say extension_dir was in another directory when cgi/fastcgi is being used. So i created that directory that it wanted (which was different than any of my php.ini's). The one it was pulling from needed to be put in the C:/windows directory, but even though I had it set to go to "./ext" it wanted to go to Program files/PHP-- extremely weird. Third, I had to add IUSR to the permissions of any folder being used.

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