简体   繁体   English

如何在 Laravel 5 上为 WAMP 安装 sqlite?

[英]How do I install sqlite on Laravel 5 for WAMP?

I'm using Laravel 5 on my WAMP Server and I am trying to get sqlite to work on it so I can follow the tutorials properly.我在我的 WAMP 服务器上使用 Laravel 5,我正在尝试让 sqlite 使用它,以便我可以正确地遵循教程。 I've uncommented the following in php.ini and restarted the WAMP server.我在 php.ini 中取消了以下注释并重新启动了 WAMP 服务器。

  • extension=php_pdo_sqlite.dll扩展名=php_pdo_sqlite.dll
  • extension=php_sqlite.dll扩展名=php_sqlite.dll
  • extension=php_sqlite3.dll扩展名=php_sqlite3.dll

After restarting the server, I've created a script to test if sqlite3 is supported or not located in C:\\wamp2\\www\\laravel\\test\\test.php, and when I run it, the message says 'SQLite 3 supported.'重新启动服务器后,我创建了一个脚本来测试 SQLite3 是否受支持或不位于 C:\\wamp2\\www\\laravel\\test\\test.php,当我运行它时,消息显示“支持 SQLite 3”。 ' So I know that it is working as far as that is concerned.所以我知道它正在发挥作用。

<?php
$dbname='base';
if(!class_exists('SQLite3'))
  die("SQLite 3 NOT supported.");

$base=new SQLite3($dbname, 0666);
echo "SQLite 3 supported."; 
?>

However, when I go into my database.php at: C:\\wamp2\\www\\laravel\\test\\config\\database.php and change the default to,但是,当我进入我的 database.php 时: C:\\wamp2\\www\\laravel\\test\\config\\database.php 并将默认值更改为,

'default' => 'sqlite',

and then go into the cmd prompt to run the same command they do in the tutorial, which was: "C:\\wamp2\\www\\laravel\\test>sqlite3"然后进入 cmd 提示符运行他们在教程中执行的相同命令,即:“C:\\wamp2\\www\\laravel\\test>sqlite3”

I get the error message我收到错误消息

'sqlite3' is not recognized as an internal or external command, operable program or batch file. 'sqlite3' 不是内部或外部命令,也不是可运行的程序或批处理文件。

In git it says:在 git 中它说:

Joe@JOEALAI /C/wamp2/www/laravel/test Joe@JOEALAI /C/wamp2/www/laravel/test
$ sqlite3 $ sqlite3
sh: sqlite3: command not found sh:sqlite3:找不到命令

When my default was at 'mysql', it ran perfectly and I was able to connect and create tables no problem.当我的默认值是 'mysql' 时,它运行得很好,我可以毫无问题地连接和创建表。

I am completely stuck.我完全被困住了。 Is there anyone that has had this experience and can help me through this?有没有人有过这种经历并且可以帮助我度过难关?

The test.php is just testing if the PHP module is installed. test.php只是测试是否安装了 PHP 模块。

I never worked with WAMP before but I'm pretty sure you need the actual sqlite3 programm installed on your server for the PHP module to work.我以前从未使用过 WAMP,但我很确定您需要在服务器上安装实际的 sqlite3 程序才能使 PHP 模块正常工作。 Try downloading and installing the Precompiled Binaries for Windows from their website .尝试从他们的网站下载并安装适用于 Windows预编译二进制文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM