php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #77886 using host in dsn string
Submitted: 2019-04-13 16:19 UTC Modified: 2019-04-14 16:04 UTC
From: ch dot derenne at gmail dot com Assigned:
Status: Not a bug Package: PDO Firebird
PHP Version: 7.3.4 OS: fedora28
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ch dot derenne at gmail dot com
New email:
PHP Version: OS:

 

 [2019-04-13 16:19 UTC] ch dot derenne at gmail dot com
Description:
------------
---
From manual page: https://php.net/index
---
In all documentation of PDO we see that host is the database host and path is the local database path relative to the host

But using this with firebird issues that database file is not found (of course, if host is not localhost)
In fact, searching in firebirdsql.org website, we see that we don't care about host, we have to use a database patch like hostname:databasepath

So why not using same syntaxe whatever firebird, mysql or other database ?
Or best : detecting if we ar eusing the host variable or not ?

We've spent one hour to find what was wrong

Test script:
---------------
	
$host="10.1.15.2"
$databasepath="/var/lib/firebird/data/db.fdb";
$usn="SYSDBA";
$psw="masterke";
$str_conn="firebird:host=".$host.";dbname=".$host.":".$databasepath.";charset=ISO8859_1;role=".$role;
	try
	{
	$db = new PDO($str_conn, $usn, $psw);
	}
	catch(PDOException $e) 
	{
		die ('ERREUR PDO dans ' . $e->getFile() . ' L.' . $e->getLine() . ' : ' . $e->getMessage());
	}
echo "connexion ok"


Expected result:
----------------
connexion ok

Actual result:
--------------
PDO Error (file not found)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-04-13 16:45 UTC] salathe@php.net
-Status: Open +Status: Not a bug
 [2019-04-13 16:45 UTC] salathe@php.net
Details on the DSN for the Firebird PDO driver is available at https://www.php.net/manual/en/ref.pdo-firebird.connection.php
 [2019-04-14 16:04 UTC] ch dot derenne at gmail dot com
Why using two different syntax if the advantage of using pdo is to use one syntax whatever the SGBD is  ?

Or why not giving warning when we use host string in the dsn for firebird ?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 13 02:01:27 2024 UTC