db2_connect to as400 with php and wamp server - php

I have been trying to connect to a ibm db2 database but it seems impposible. The as400 is in a different server than the one running php.
Everytime I do a db2_connect I get the following error:
Fatal error: Call to undefined function db2_connect()
How can I make this function work?
Tip: I've already tried with odbc and it was a lost of time, but I'm open to suggestions on that path as well.
[EDIT]
I finally changed to java... it was impossible with php...

Check your php.ini file and make sure it has the DB2 extension enabled. http://www.php.net/manual/en/install.pecl.php

Try this link:
http://www.theregister.co.uk/2006/08/09/db2_udb_part2/
Deals with:
Installing the PHP DB2 extension,
Creating a connection,
Obtaining a result set
Also gives as an alternative the PDO option.
But as for DB2 on the AS400, am not sure if something still needs to be installed on the
AS400 for this to work?
Anyway, have used the ODBC Client Access with no problems at all. What difficulty did you run into?

Related

Call to undefined function mysql_connect() on Heroku. (PHP works fine locally but not on heroku- why?)

Thanks for your help in advance. I have been working on this bug for more than 12 hours now.
There is an AJAX signup form in my Heroku site which runs on MySQL and is connected to ClearDB Database. I can successfully send data to the database on my local server (MAMP). However, I cannot do the same on the server.
The requests cannot get send to the database and gets stuck at loading. Upon inspection I realise it is a PHP 500 Error.
I found the key problem in the Heroku logs. 2014-11-24T15:02:31.238493+00:00 app[web.1]: [24-Nov-2014 15:02:30 UTC] PHP Fatal error: Call to undefined function mysql_connect() in /app/index.php on line 5
Line 5 of the index.php is mysql_connect('hostname', 'username, 'password');
I have tried running php_getinfo(); and found that there is no MySQL support in the server. On a side note, I have MySQL support in my localhost.
The server php.ini paths are as such: Configuration File (php.ini) Path /app/.heroku/php/etc/php & Loaded Configuration File /app/vendor/heroku/heroku-buildpack-php/conf/php/php.ini
What should I do?
mysql_* functions are deprecated and actually removed in the next PHP version. Check out mysqli.
Worth noting that you can enable mysql_* on Heroku via composer.json. This is documented in Heroku's devcenter docs on PHP support.
Also recommend you consider using a more modern MySQL library, though :)

Using PHP 5.4 and Freetds

I keep getting the following message when trying to connect to a ms sql database via PHP
Fatal error: Call to undefined function mssql_connect()
I need to do it using FREETDS, I have followed the instructions: http://docs.moodle.org/24/en/Installing_MSSQL_for_PHP
I am using WAMP with php 5.4 the extension is ticked in my extension list in wamp toolbar. One thing I wonder is whether it's something to do with freetds.conf under a standard wamp install where should this go? I have it sitting in the root of c and under bin/php/php5.4.16. The only info I have changed in it is the IP address of the server I want to connect to, is this correct?

How to connect to Sybase via PHP

I'm trying to connect to a Sybase database with PHP5. I believe I've successfully compiled PHP with PDO_DBLIB, as phpinfo() lists dblib under PDO drivers, and freetds as the pdo_dblib flavour.
However, when I try to test a connection, I get an error reading:
'PDOException' with message 'could not find driver'
I'm trying to connect to a server on my LAN with this code:
$dbh = new PDO("sybase:host=192.168.1.xxx;dbname=[database-name]", '[user]', '[pass]');
Any suggestions would be greatly appreciated!
You should use dblib instead of sybase, like this:
$dbh = new PDO("dblib:host=192.168.1.xxx;dbname=[database-name]", '[user]', '[pass]');
PDO wouldn't work, or at least there is no PDO Sybase support for php. On Windows, you can use ODBC, and PDO_SQLSRV or PDO_ODBC, it might sound weird, but it should work.
Second option and I would recommend it, is to connect directly to Sybase (SqlAnywhere), but you need to install SQL Anywhere PHP Module
If you are using Ubuntu you can put the LD_LIBRARY_PATH inside envvars and it seems to read... still trying to find a way to get it to stick on RHEL based systems... Windows I am not too sure about I would hope you could set a system wide variable under
my computer -> properties -> advanced options
If are using RHEL based systems it might be better to include the:
export LD_LIBRARY_PATH=/path/to/library/ in the httpd restart script (check to see if it loads /etc/sysconfig/httpd and if so add the line in there - now restart apache and you should see some activity.

Using SQL Server in Cake PHP: PHP SQL Server interface is not installed

I inherited an old Cakephp site that was using adodb as a driver to connect to an MSSQL database and it turns out this is no longer supported in the new version of cake (1.3, we are in 1.2) so I'm trying to change the driver so I can upgrade. We're using IIS and a sql server 2005 database on a different server, php 5.2.17. However using driver "mssql" gives me the following errors:
PHP SQL Server interface is not installed. For troubleshooting information, see http://php.net/mssql/
Call to undefined function mssql_min_message_severity()
The top error leads me to a page regarding the old php_mssql.dll, which according to this question: ( CakePHP: error when trying to use mssql datasource ) will become a problem when I switch to PHP 5.3 so I'm trying to use the php_sqlsrv*.dll for my php version but I still get the error. Could never get the mssql.dll one to work either. I do however see "sqlsrv support enable" in phpinfo.php and the whole sqlsrv section is intact there.
In cake php I'm using "driver => 'mssql'", is this the correct driver for the new sqlsrv dll? Is there something I'm missing? For kicks I tried 'driver' => 'sqlsrv', that fixes the php SQL Server interface error but I still get
"Fatal error: Call to undefined function sqlsrv_min_message_severity() in C:\Inetpub\wwwroot\riverstone-dev\www\cake\libs\model\datasources\dbo\dbo_sqlsrv.php on line 107"
Installing the latest SQL Native Client set from Microsoft and reenabling the extension in PHP has worked, albeit on a different server. Please try the drivers below if having a similar problem:
http://www.microsoft.com/download/en/details.aspx?id=20098

sqlite : Fatal error: Call to undefined function sqlite_escape_string()

I use a script who recquires SQLITE,
on my previous hoster, it works,
on local it works,
on my new dedicaced server, it doesn't, i use PHP5 of course, on this link, you have a phpinfo() of the server.
http://bit.ly/bXlLT1
Could you tell me what/how (apt get?) to install correctly sqlite to avoid this fatal error?
Thanks
sqlite installed : problem fixed.

Categories