简体   繁体   English

主义1.2,如何在虚拟主机上建立数据库?

[英]Doctrine 1.2, How to build database on web host?

I have my website ready on the localhost and use doctrine 1.2 for the database, I want to upload the website to a web host to try it so I changed the parameters (Database, User, Password, Host) of the DNS in the config.php file, but I don't know how to build it since I used to run this command in the CMD: 我已经在localhost上准备好了网站,并使用了教义1.2作为数据库,我想将网站上传到Web主机上进行尝试,因此我在配置中更改了DNS的参数(数据库,用户,密码,主机) config.php文件,但由于我曾经在CMD中运行以下命令,因此我不知道如何构建它:

php doctrine build-all-reload

and I can't use the exec() command or it's alternatives on a shared host. 而且我不能在共享主机上使用exec()命令或它的替代方法。

I use PHP in my website. 我在网站上使用PHP。

So how can I build my database ? 那么如何建立数据库?

Dump your database on localhost and load it on your webhost using whatever means you have available (phpMyAdmin for example) 将数据库转储到localhost上,并使用任何可用的方式将其加载到Webhost上(例如phpMyAdmin)

Migrations will be worse. 迁移会更糟。

If you have a yml file you can create a php script and run the following to create the db from your yml. 如果您有yml文件,则可以创建一个php脚本,然后运行以下命令从yml创建数据库。

$options = array(
'packagesPrefix' => 'Plugin',
'baseClassName'  => 'MyDoctrineRecord',
'suffix' => '.php'
);

Doctrine_Core::generateModelsFromYaml('/path/to/yaml', '/path/to/model', $options);

In general Doctrine_Core has a few methods to create, drop and insert to db after you have set up the connection. 通常,在建立连接后,Doctrine_Core具有几种创建,删除和插入db的方法。 It is pretty straight forward. 这很简单。

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

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