i want to connect to sqlserver
i have this
php -v
PHP 7.2.14-1+0~20190113100742.14+stretch~1.gbpd83c69 (cli) (built: Jan 13
2019 10:07:43) ( NTS )Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.14-1+0~20190113100742.14+stretch~1.gbpd83c69, Copyright (c) 1999-2018, by Zend Technologies
where i used sqlser
$conn = new PDO('sqlsrv:Server=xxx.xxx.xxx.xxx;Database=xxxx', 'user', 'pass');
i have this problem
SQLSTATE[01000]: [unixODBC][Driver Manager]Can't open lib '/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.2.so.0.1' : file not found
but this file is exite in path
and when i used DBLIB
$conn = new PDO( "dblib:host=$hostname;dbname=$dbname;", $username, $pw);
after many secand (2 minutes) i have this problem
SQLSTATE[HY000] Unable to connect: Adaptive Server is unavailable or does not exist (severity 9)
Related
I can connect to my interbase using IBConsole using the same user/pass as I use in php
php --version
PHP 5.6.13-0+deb8u1 (cli) (built: Sep 7 2015 13:38:37)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
Installed interbase: apt-get install libapache2-mod-php5 php5-interbase
phpinfo() returns:
Firebird/InterBase Support: dynamic
Compile-time Client Library Version: Firebird API version 25
Run-time Client Library Version LI-V6.3.3.26778: Firebird 2.5
PDO drivers enabled: firebird, mysql
PDO_Firebird, PDO Driver for Firebird: enabled
Firebird driver for PDO: Ard Biesheuvel
php test 1:
$host = 'MYSRV1:C:\folder\dbhms.ib';
$username = 'dbuser';
$password= 'dbpassword';
$conStr = "firebird:dbname={$host};User={$username};Password={$password};Port=3050;";
$DB = new PDO($conStr);
result:
PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [335544472] Your user name and password are not defined. Ask your database administrator to set up a Firebird login.' in /home/tr/ibase/test.php:29
php test 2:
print_r(PDO::getAvailableDrivers());
result:
;Array
(
[0] => firebird
[1] => mysql
)
Php documentation for PDO::getAvailableDrivers on http://php.net/manual/en/pdo.getavailabledrivers.php:
print_r(PDO::getAvailableDrivers());
result:
Array
(
[0] => mysql
[1] => sqlite
)
I notice that there is a leading ';' in my test 2 (;Array ) but it should not cause any trouble
What am I missing?
I'm using XAMPP and PHP CLI to test my PHP script locally. The problematic line (the line 98) in db.php is:
$this->mysqli = new mysqli($host, $user, $pass, $dbname, $port);
And the error is:
No such file or directory in /path/to/my/file/db.php on line 98
This problem only appears when I execute a PHP file that requires db.php in Terminal. It works fine when I run it in browser. How come?
The CLI command I use is:
php test.php
Well, that's a very simple command. Is there anything I missed?
Note: I'm using Mac OS X 10.10.1
PHP version:
PHP 5.5.14 (cli) (built: Sep 9 2014 19:09:25)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
I took a copy of my live Laravel 4 app and set it up on an AWS Ubuntu instance.
Here's the same route that works on live site, http://pixcel.com/archivecloud/786531 ,
and the same route with same code (I think) on the EC2 instance
54.186.47.148/archivecloud/786531
Error returned is: Controller method not found
Live site:
PHP 5.3.27 (cli) (built: Feb 21 2014 07:53:29)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd., and
with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies
Apache: not sure, it's shared hosting with site5
EC2:
PHP 5.4.25-1+sury.org~precise+2 (cli) (built: Feb 12 2014 10:45:30)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
Server version: Apache/2.2.22 (Ubuntu)
Relevant code:
Route LIVE:
Route::get('archivecloud/{id}', 'CloudHomeController#embed');
Route EC2: Route::get('archivecloud/{id}', 'CloudHomeController#embed');
Controller LIVE:
class CloudHomeController extends CloudBaseController {
public function embed($id){
$result = CloudFilm::getInstance()->getFilmByEmbedId($id);
$cliptype = "film";
}}
Controller EC2:
class CloudHomeController extends CloudBaseController {
public function embed($id){
$result = CloudFilm::getInstance()->getFilmByEmbedId($id);
$cliptype = "film";
}}
Looks like the Environment variables are empty. Will look this up.
I am using Mac, netbeans, x-debug, with Mongo PHP. I am trying to run a basic search like:
$results = $mongo->$col->find();
However during debug, the value for $results is slaveOkay = 0 and timeout = 30000. Why is this so? Some version information about the tools installed are:
PHP 5.4.20 (cli) (built: Sep 24 2013 10:10:10) (DEBUG) Copyright (c)
1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013
Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
MongoDB shell version: 2.4.6
Thanks.
Where does that $col variable come from?
And where does $mongo come from?
The correct way to query a collection is
<?php
$mongo = new MongoClient(...);
$collection = $mongo->databaseName->collectionName;
$results = $collection->find();
?>
Then you can iterate over $results like so:
foreach($results as $document) {
/* Do something with $document */
}
See http://php.net/mongocollection.find and http://php.net/mongo.queries for more details
$myapp = new COM("word.application");
// returns a fatal error: "Class 'COM' not found in c:/www/comConnector.php"
shell_exec("whoami");
//returns "NT authority/system"
My system setup
Win7 Pro
Apache Server version: Apache/2.2.23 (Win32)
PHP
PHP 5.3.16 (cli) (built: Aug 15 2012 20:06:57)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
Add COM support in php.ini:
[COM_DOT_NET]
extension=php_com_dotnet.dll
Since you are using PHP 5.3.16, make sure that you are pointing to the global namespace:
$myapp = new \COM("word.application");
Even though your PHP file might be in global namespace already, but it's a good practice.