操作系统: Ubuntu 16.10
服务器: Nginx
DB: PostgreSQL 9.5.4
Laravel 5.4
尝试执行数据库迁移,但TableColumn<A, A> c1;
c1.setCellValueFactory(c -> new ReadOnlyObjectWrapper<>(c.getValue()));
CellFactory implements Callback<TableColumn<A, A>, TableCell<A, A>> {
@Override
public TableCell<A, A> call(final TableColumn<A, A> param) {
return new TableCell<A, A>() {
@Override
protected void updateItem(final A item, final boolean empty) {
super.updateItem(item, empty);
if (empty || this.getTableRow() == null) {
setText(null);
setStyle("");
setGraphic(null);
} else {
TableView nestedTable = buildTable();
setGraphic(nestedTable);
}
}
};
}
}
会引发以下错误:
[照亮\数据库\ QueryException] 找不到驱动程序:(SQL select * from information_schema.tables where tables_schema = username和table_name = migrations)
接着是第二条消息,说明
[PDOException]
无法找到驱动程序
我做了以下事情:
目前,当我运行php artisan migrate
时,我获得的PDO部分的输出是
PDO支持=&gt;启用
PDO drivers =&gt;的pgsql
pdo_pgsql部分产生
PostgreSQL(libpq)Version =&gt; 9.5.4
模块版本=&gt; 7.0.15-0ubuntu0.16.10.4
pgsql部分返回
PostgreSQL(libpq)Version = 9.5.4
PostgreSQL(libpq)=&gt; x86_64-pc-linux-gnu上的PostgreSQL 9.5.4,由gcc编译(Ubuntu 6.1.1-11ubuntu12)6.1.1 20160805,64位多字节字符 support =&gt;启用
SSL支持=&gt;启用
Active Persistent Links =&gt; 0
Active Links =&gt; 0
但是尽管如此,仍然会得到同样的错误。我认为它有可能是权限问题,但以root或www-data运行命令会产生相同的结果。
答案 0 :(得分:4)
您应该安装PHP pdo
sudo apt upgrade
sudo apt install php-pgsql
答案 1 :(得分:0)
您需要定义.env文件
在your.env文件中,您需要指定您使用的数据库(MySQL,SQLite,Postgres)并指定您的数据库用户名和密码
APP_ENV=local
APP_KEY=base64:gqaCpjbEfukDr5As7EnrqRzi5PSho1rOS/q2H0E+HOs=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=YOUR_DB_NAME
DB_USERNAME=YOUR_USERNAME
DB_PASSWORD=YOUR_PASSWORD
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
使用迁移时运行这些命令总是好的
composer dump-autoload
php artisan cache:clear
php artisan view:clear
答案 2 :(得分:0)
我经历过同样的情况, 依次尝试以下操作,
obj.temporary
登录到psql shell:
1) install the postgre extensions for php, those are:
php-(YOUR_VERSION)-pgsql, and php-pgsql.
2) enable pgsql extensions in your php.ini file, basically,
uncomment the the extensions.
3) restart the apache server(or nginx).
4) check that extensions are enable using phpinfo() or any else tool.
5) set a password for (in instance) the postgres user in postgreSQL
server, this is a very important step.
输入密码并确认。
现在,设置您的.env文件,然后重试。
答案 3 :(得分:-1)
<强>解决:强>
在此方案中确保您已运行
package com.example.user.navigationdrawer;
import android.app.Fragment;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
public class FirstFragment extends Fragment {
View myView;
static final String url = "https://www.website.org/";
ArrayList<String> outPut = new ArrayList<>();
LinearLayout diaryLayout;
final int N = 3; // total number of textviews to add
TextView[] myTextViews; // create an empty array;
TextView rowTextView;
//ArrayList<String> h4 = new ArrayList<>();
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
myView = inflater.inflate(R.layout.first_layout, container, false);
diaryLayout = (LinearLayout) myView.findViewById(R.id.connections);
new Ann().execute();
return myView;
}
private class Ann extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
try {
// Connect to the web site
Document document = Jsoup.connect(url).get();
// Get the html document title
Elements notificationWall = document.select("div[class=flex_column av_one_fifth flex_column_table_cell av-equal-height-column av-align-top av-zero-column-padding " +
"avia-builder-el-11 el_after_av_one_fifth el_before_av_one_third]"); //Connect to website.The Notification wall.
Elements sectionTag = notificationWall.select("section"); //Get section tag.
Elements contentTitles = sectionTag.select("h4"); // Get H4
Elements bodyText = sectionTag.select("p"); //Get P
Elements linkTag = sectionTag.select("a"); //Get links
Elements images = sectionTag.select("img"); // get image.
for (int section = 0; section < sectionTag.size(); section++) {
outPut.add(sectionTag.get(section).text());
}
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void result) {
// Set title into TextView
//here.
//The problem is here!!!
myTextViews = new TextView[N];
for (int i = 0; i < N; i++) {
// create a new textview
myTextViews[i] = new TextView(diaryLayout.getContext());
// set some properties of rowTextView or something
myTextViews[i].setText("This is row #" + i );
myTextViews[i].setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT));
myTextViews[i].setTextSize(14);
myTextViews[i].setPadding(100,1000,100,100);
myTextViews[i].setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL);
// add the textview to the linearlayout
diaryLayout.addView(myTextViews[i]);
}
}
}
}
我认为我已经在每个关键步骤完成了这项工作,但是再次运行这两个命令可以让我进行迁移并使网站正常运行。但是,感谢lewis4u的帮助。