I need to configure Laravel 5 to use ODBC accessing Visual FoxPro tables through Eloquent ORM.
I have tried inserting the following entry in the 'connections' list of 'database.php' file, but the application returns the error "Unsupported driver [odbc]":
'odbc' => [
'driver' => 'odbc',
'dsn' => 'Visual FoxPro Database',
'database' => '',
],
Is there a way to use ODBC to access VFP tables, like I did using PHP flat application? Every help will be appreciated.
Currently Laravel 5 indicates that it supports the following database systems: MySQL, Postgres, SQLite, and SQL Server.
https://laravel.com/docs/5.0/database
You could try installing the next library,
https://github.com/luads/php-xbase
Related
Can I generate database mysql from existing project developed in codeigniter framework?
Screenshot of the project structure is given below.
I think, you are trying to generate migrations and seeders in Laravel, Similar thing is not possible in Codeigniter,
Another better way to do this, create a PHP file for run the MySql, that you have wrote before
I will suggest you use Codeigniter Migrations. That is if you are not a newbie.
You can read on it here: https://www.codeigniter.com/user_guide/libraries/migration.html
Else another option is to export your current database into an *.sql file and then import as your new database project using your SQL manager like PhpMyadmin.
Then go to your application/config/database.php file and change these settings
'hostname' => DB_HOSTNAME,//to your database host e.g localhost
'username' => DB_USERNAME,//your username for the host
'password' => DB_PASSWORD,// your password for the username
'database' => DB_NAME,// your database name
I am trying to configure my Laravel app so all my Laravel Queue Failed Jobs goes to Redis instead of mysql.
Currenly my jobs are configured to use redis but failed_jobs still goes to MySql Database
Didn't find anything on StackOverflow/Laravel
Laravel 5.4
Redis
PHP 7.0
Please help!
Check your settings in config/queue.php, you should find following values:
'failed' => [
'database' => env('DB_CONNECTION', 'mysql'),
'table' => env('QUEUE_FAILED_TABLE', 'failed_jobs'),
]
Change the connection and table on whatever you need.
i am working on Redis to store data Everything is working fine in my local system. i have successfully installed redis also in laravel with this command composer require predis/predis also and Redis setup of window also installed. Now when i store data in Redis like this:-
Redis::set('first',"My first Test"); // put data in Redis key
echo Redis ::get('first'); // get data
Above code is working fine in my local system. when i try to use this code in live server it is showing the below error:-
Please help me to resolve this issue. We are using amazon-ec2 server Thanks in advance :)
I had the same issue. But I believe its related to php 7 rather than Larevel 5.4 because I'm using Laravel 5.1 and I still have the problem.
I came across 2 solutions
Use use Illuminate\Support\Facades\Redis; instead of use Redis; if you want to call the Redis methods statically.
Change to dynamic calling
$redis = new Redis();
$redis->set('boo','Have beer and relax!')
$redis->get('boo');
Just remove or comment out extension=php_redis.dll from your php.ini
Laravel and server Redis conflicts with name "Redis"
This will work
In Laravel database config you can define a client for your Redis handler.
As you have installed predis, your Redis database configuration should look like this
'redis' => [
'client' => 'predis',
'cluster' => false,
'default' => [
'host' => env('REDIS_HOST', 'localhost'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
],
PhpRedis extension and Laravel alias for Redis Facades are same which is creating the issue. In case you want to use the PhpRedis extension you need to change the alias keyword defined in app.php and client in the database config.
I have a Yii2 framework connected to an SQL Server 2012 database.
I have already configured the config/db.php file as follows:
return [
'class' => 'yii\db\Connection',
'dsn' => 'sqlsrv:Server=localhost;Database=Evaluators;MultipleActiveResultSets=true',
'username' => '_myUsername_',
'password' => '_myPassword_',
'charset' => 'utf8',
];
I have also installed the necessary extension files in the /ext directory.
I am using SQL Server 2012 instead of MySql.
When I try to Start Gii Model Generator I get the following error :
Database Exception – yii\db\Exception could not find driver
Caused by: PDOException could not find driver
Any ideas what should I change or do?
The issue can be from your php configuration.
In that case, I solved it by doing the following: uncomment extension=php_pdo_mysql.dll in your php.ini. (I am on MySQL instead of SQL server 2012)
More explanations here: https://www.jeffgeerling.com/blog/2018/installing-php-7-and-composer-on-windows-10
Since your using SQL server 2012, I cannot confirm for sure, but you should investigate this: https://www.php.net/manual/en/ref.pdo-sqlsrv.php
Good luck
This is my first time using ms sql with cakephp. Usually I use mysql. I've edited my database.php file:
class DATABASE_CONFIG {
var $default = array(
'driver' => 'mssql',
'persistent' => false,
'host' => 'jura',
'login' => 'sa',
'password' => '********',
'database' => 'clientportal',
'prefix' => '',
);
var $test = array(
'driver' => 'mssql',
'persistent' => false,
'host' => 'jura',
'login' => 'sa',
'password' => '********',
'database' => 'clientportal',
'prefix' => '',
);
}
However when I view the index page i get this error:
PHP SQL Server interface is not installed, cannot continue. For troubleshooting information, see http://php.net/mssql/
Fatal error: Call to undefined function mssql_min_message_severity() in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\clientportaladmin\cake\libs\model\datasources\dbo\dbo_mssql.php on line 123
It's coming from this constructor in the dbo_mssql.php file:
function __construct($config, $autoConnect = true) {
if ($autoConnect) {
if (!function_exists('mssql_min_message_severity')) {
trigger_error(__("PHP SQL Server interface is not installed, cannot continue. For troubleshooting information, see http://php.net/mssql/", true), E_USER_WARNING);
}
mssql_min_message_severity(15);
mssql_min_error_severity(2);
}
return parent::__construct($config, $autoConnect);
}
I have the mssql extension in the php ini file
extension=php_mssql.dll
I've been using mssql databases with PHP on my setup extensively but am wondering if its because the ini file in my php directory are php.ini file is called php.ini-development and php.ini-production but I actually use a php.ini file sitting on the root of C:
Has anyone had to deal with this before? Or anyone know what I need to do? Using W7 btw.
Jonesy
You can`t use extension=php_mssql.dll in php 5.3* versions.
You need to use MSSQL driver for phpMSSQL driver
Open php.ini ,just add this line
extension=php_sqlsrv_53_ts_vc9.dll
use proper extensions files depending upon your version of PHP, whether its Thread safe or not, what was the version of Visual C++ to build your PHP installation.
php_sqlsrv_53_ts_vc9.dll: for instance this driver is for PHP version 5.3 which is thread safe and build using Visual C++ 9, you should also ensure that you have proper php.dll in php installation dir like php5ts.dll for thread safe version of PHP 5.xx
I am using the SQLSRV drivers and the according dbo_sqlsrv.php datasource for CakePHP.
the DATABASE_CONFIG the looks like this
var $default = array(
'driver' => 'sqlsrv',
'connect' => 'sqlsrv',
'persistent' => false,
'host' => 'tcp:NAUFRAGADOS',
'login' => 'sa',
'password' => '********',
'database' => 'geotest',
'prefix' => 'cake_',
);
notice the 'tcp:' in the host definition. This was what I was tripping about till I've got it right
What's the version of CakePHP you're using ?
Another thing, please check about the extension at http://localhost/phpinfo.php.
You should find the extensions that are enabled and seen by the server.
The problem you have is in two parts. Firstly as others have pointed out you're using PHP 5.3 which has no mssql PHP extension. You need to use the Sqlsrv drivers, update the php.ini file and test that you can connect to SQL Server using the sqlsrv drivers.
The second problem you then have is getting CakePHP to use the sqlsrv drivers. Depending on the CakePHP version you have you might need to install the separate sqlsrv database driver. I'm still using CakePHP 1.2 and I believe certainly also in CakePHP 1.3 you need to install the sqlsrv database drivers separately. I don't know if they've included sqlsrv drivers in CakePHP 2 yet.
There is an offical source for CakePHP v1.3+ data sources which includes a sqlsrv data source.
I'm getting the same error on the server using the migrations plugin:
http://cakedc.com/eng/pierre_martin/2010/02/05/cakephp-migrations-plugin-easily-version-and-deploy-whole-applications
it works locally, and the site itself can access the MS SQL DB without problems. It's just the command line cake migration commands that give this error. I'm pretty much stuck with whatever the PHP configuration is on the server. It really would be handy to use this plugin, but I'm not sure where to start looking or tweaking to track this down, but I wonder if it's the same underlying issue?