In first point. I am absolutely a noob in PHP and PEAR. For exercising I have worked with PHP, Pear and Mondial DB of Oracle offline, but now I wanted to connect to my Database on 1and1.com.
Following I have tried:
$dsn = 'mysql://dbo5235xxxxx#10.24.xxx/db5235xxxxx'; //Have it tried with password too and many other variations
$sql = "SELECT * FROM Vereine";
$db = MDB2_Util::connect($dsn);
If I upload this file on my webserver and when I try to call this page, I get an error.
Fehler beim Verbindungsaufbau mit [mysql://dbo5235xxxxx#10.24.xxx/db5235xxxxx] : MDB2 Error: not found
The error Message:
"Fehler beim Verbindungsaubau" is an own deinied Message in MDB2_Util.
If I try to connect with MDB2::connect, then the Message calls only:
MDB2 Error: not found
What can be the Error? Why it doesnt show the real Error or a helpful hint. Can I debug? If yes, how?
Best Regards Benny
This can occur even if you have installed an MDB2 driver, but PHP can't find or can't read it.
As a practical example, I experienced this problem on a system on which the UMASK value had been changed from 022 to 027. Even though the MDB2 driver had been installed (with root privileges), the user under whom php-fpm was running lacked access to the library's files.
Related
If I create php file and open it in browser with following content:
<?php
var_dump(function_exists("mysqli_connect"));
I receive:
bool(true)
but when I do it from ssh command line
php -r 'var_dump(function_exists("mysqli_connect"));'
I receive:
bool(false)
Why is that? I can use mysqli_connect / mysql_connect while operating my websites from browser, but can't on ssh.
I wanted to update my phpbb 3.0 to phpbb 3.1 via the command line:
php ./bin/phpbbcli.php db:migrate --safe-mode
but as you see, I can't. The output is:
PHP Fatal error: SQL ERROR [ mysqli ]<br /><br />mysqli_connect function does not exist, is mysqli extension installed? []<br /><br />An sql error occurred while fetching this page. Please contact an administrator if this problem persists. in /zzzzzzzzz/phpbb/db/driver/driver.php on line 855
Of course my phpbb 3.0 board works well on mysqli. Could somebody help me?
I don't know if you solved this or not, but try putting the full path to the php file like so
/Applications/MAMP/bin/php/php5.5.38/bin/php bin/phpbbcli.php db:migrate --safe-mode
as you might be executing a php version different from the one you have configured with mysql
Hope this helps someone
it has been days (weeks ?) since I try to connect to an Informix SQL database with PHP but I can't make it work.
I'm stuck with this error :
SQLSTATE=HY000, SQLDriverConnect: -329 [Random characters, ex :`�%]
sqlerrm(systables)
I can make the link with Windows ODBC utility http://i.stack.imgur.com/1ChAL.png
But impossible on PHP.
I installed the informix drivers and the informix dll extension for php and run it like this:
putenv("INFORMIXDIR=C:\\informix");
try {
$db = new PDO("informix:host=iat-----; service=sqlexec; database=sige---; server=iat-----; protocol=sesoctcp;", "if----", "pass---");
} catch (Exception $e) {
echo('Erreur : ' . $e->getMessage() . '<br>');
}
Thank you for your kind help.
Error message -329 is:
Database not found or no system permission
It means that despite your best efforts, something is astray with the environment. Either you've misspelled the database name or the server name, or the database is not set up to allow the user access to the database, or something along those lines.
Much more than that, I can't help you with. You're on Windows, and I'm not. You can look at the SETNET32 settings, but the fact that you can connect via the Windows ODBC utility suggests that most of what you need should be OK.
To fix this, you must restart the services for apache and php. If you are in linux, you can use the command "/etc/init.d/httpd restart"
This will fix the following error message:
Ocurrió un error ConexionPDOSQLSTATE=HY000, SQLDriverConnect: -11005 [Informix][Informix ODBC Driver]Unspecified System Error...
this is something I've really been losing sleep over, so I'd be very thankful if anyone could help me.
So, I'm trying to set up a launcher for a game. I have a Login.php on my web server and the launcher in Visual Studio. When pressing "Start" it connects to Login.php where it checks if the game login credentials are correct, if they are, it should return a string of random letters (a token) to the Launcher. The Login.php tries to connect to my database in SQL Server 2008.
Now to the problem, I get
Fatal error: Call to undefined function mssql_connect() in C:\inetpub\wwwroot\Login.php on line 12
when trying to go to the website manually (By entering 127.0.0.1/Login.php into the browser.). And when I try to run the program and press start, it returns a 500 Internal Error.
I have googled the mssql error and found out that the mssql functions have been removed from the newer versions of PHP, so I downloaded the drivers from Microsoft and enabled them in the PHP Manager on IIS 7.5.
The version of PHP I use is 5.4.25 and I enabled these drivers:
php_pdo_sqlsrv_54_nts.dll
php_sqlsrv_54_nts.dll
And here are the first 13 lines of the Login.php:
<?php
$conf['db_host'] = "GERA044\SQLEXPRESS";
$conf['db_user'] = "sa";
$conf['db_pass'] = "L4sfa445AdxDDLfor95";
$conf['db_name'] = "Account";
$user = sql_clean($_GET['Username']);
$passhash = sql_clean($_GET['Password']);
$con = mssql_connect($conf['db_host'],$conf['db_user'],$conf['db_pass']) or die('Database connect Fail.');
$db = mssql_select_db($conf['db_name'], $con) or die('Database Init Fail.');
In short: I still get an mssql error even though I have the drivers.
Hopefully someone can find a solution to the problem here,
Thank you!
php_sqlsrv_54_nts.dll is the SQLSRV extension, not the MSSQL one. You should use the sqlsrv_* family of functions instead of the mssql_* one.
I'm having heavy issues trying to connect to my MSSQL 2012 Express database, with PHP5 running on an Apache.
I have as a test setup just installed a XAMPP with PHP 5.4.4 and Apache running on a Windows 7 machine.
My PHP code (phpmssql_genxml.php):
$connection = mssql_connect('192.168.40.150', $username, $password);
if (!$connection) { die('Not connected : ' . mssql_get_last_message());}
$db_selected = mssql_select_db($database, $connection);
if (!$db_selected) {
die ('Can\'t use db : ' . mssql_get_last_message());
}
$query = "SELECT * FROM Cust WHERE 1";
$result = mssql_query($query);
if (!$result) {
die('Invalid query: ' . mssql_get_last_message());
}
Output when trying to enter the site:
Fatal error: Call to undefined function mssql_connect() in C:\xampp\htdocs\phpmssql_genxml.php on line 13
Even if I try to hardcode the username and password into the string, I still get the same result.
Have search a lot on google, but havn't found that post that fixed my issue yet :/
Have enable TCP/IP for the DB instance pipe, even try'd to assign a specific TCP port for it. Have created a rule in the Win7 firewall allowing all traffic to the standard port 1433. Still no luck.
any1 have an idea?? What does the 'Fatal error' part means? Is it the Apache error, PHP or a Database error when trying to connect to it??
You are missing MSSQL driver from your PHP setup. Download it from here, assuming you have the required system configuration mentioned on the page.
Setting up, from their instructions:
Download SQLSRV30.EXE to a temporary directory
Run SQLSRV30.EXE
When prompted, enter the path to the PHP extensions directory
After extracting the files, read the Installation section of the SQLSRV30_Readme.htm file for next steps
I would also recommend using standard Apache + PHP installation, if you plan to work with MSSQL, instead of any *AMP package.
You don't need to use SQLSRV30 as this was not the solution that I needed though some may find it useful. I have a local dev environment running XAMPP + php5.5.9 + MSSQL2012 and I needed to use mssql functions because thats what we use at work on our servers. So I use freetds and "luckily" found this:
https://moodle.org/mod/forum/discuss.php?d=232844
where one of the users already compiled the php_dblib.dll TS and NTS for my php version suffice to say I have everything working and using all the MSSQL functions that our dev team is used to. The extension for mssql support can always be compiled.
I just finished to install Ingres on my server(only the client part, to connect to an existing ingres server), I just added the php_ingres module.
Now php recognize my module, so I tried to connect my self to several existing servers, but I always a
Unable to connect to database (Hostname here)
But with this I can't find what is wrong?? ingres error? Php driver? Credentials? ...?
What can I do to isolate these problem?
Most likely it's a user credentials issue. To see the actual error message use the following code:
$connection = ingres_connect(.....);
if (!is_resource($connection))
{
trigger_error(ingres_errno()." - ". ingres_error(),E_USER_ERROR);
}
You might also want to take a look at http://community.ingres.com/wiki/Ingres_with_Apache_on_Debian_Etch which outlines the setup steps for Ingres, PHP, Apache and Debian/Ubuntu.