发表文章

[PHP] 欢迎使用链接 (索引. php) links on welcome (index.php)[chemdb]

cambro 2017-10-9 56

在潜水之前... 欢迎页面加载良好, 但主页上的所有链接/欢迎掷404s。这些链接是所有窗体的 /index.php/projects

问题: 这些链接应该是窗体 /index.php/quartz_chem 吗?如果没有, 你知道他们为什么不正确吗?也许一个路径变量的地方?我很有信心, 在索引上没有建立与 db 的连接. php 负载, 因为 db/用户名/密码在配置/数据库中可以是正确或错误的. php, 它不影响索引. php 行为。

谢谢你的一个简单的机械问题。我已经分叉了 Macrostrat 的回购, 并在提交一拉你的考虑前调整。

原文:

Before diving into this... the welcome page is loading fine, but all links on the homepage/welcome throw 404s. The links are all of the form /index.php/projects.

Question: are these links supposed to be of the form /index.php/quartz_chem? If not, any idea why they are incorrect? Perhaps a path variable someplace? I'm quite confident that a connection to a DB is not being established on index.php load, as the db/username/password can be correct or wrong in the config/database.php and it doesn't affect index.php behavior at all.

Thanks for entertaining a simple mechanical question. I've forked repo at UW-Macrostrat and am tweaking there before submitting a pull for your consideration.

相关推荐
最新评论 (14)
zploskey 2017-10-9
1

您是否已在 app/config/config.php 中设置了 base_url?我相信那些链接是使用设置在那里产生的。

原文:

Have you set the base_url in app/config/config.php? I believe those those links are generated using what is set there.

zploskey 2017-10-9
2

登录页不访问数据库, 因此您需要访问另一个页来测试数据库设置。

原文:

The landing page does not access the database, so you will need to access another page to test your database settings.

cambro 2017-10-9
3

base_url 被设置好, 至少由事实表明, 索引. php 正在正确显示样式和链接的图像 (如果我改变了 base_url, 然后是样式和图像中断)。

"项目" 和 "管理项目" 的 URL 应该是什么?目前, 他们是/index.php/projects

原文:

The base_url is set fine, at least as indicated by the fact that index.php is displaying styling and linked images correctly (if I change the base_url then the styling and images break).

What should the URL be for "Projects" and "Manage Projects"? Presently they are /index.php/projects

zploskey 2017-10-9
4

正确的链接取决于您的 $config['base_url'] 设置, 但在我的本地设置中, base_url 设置为 http://localhost/chemdb/ 项目链接转到 http://localhost/chemdb/index.php/projects 。您是否可以共享您的 base_url 和不工作的链接的完整 url 的设置?

原文:

The correct link depends on your setting of $config['base_url'], but on my local setup with base_url set to http://localhost/chemdb/ the project links go to http://localhost/chemdb/index.php/projects. Can you share your setting for base_url and the complete URL of the links that are not working?

cambro 2017-10-9
5

这与我当前设置的相同。我有相同的 base_url 和相同的链接显示。但是, 返回404。

原文:

That is identical to my current set up. I have same base_url and the same links are shown. However, a 404 is returned.

zploskey 2017-10-9
6

我似乎无法重现此问题, 因此我没有足够的信息来重现它, 或者是您如何设置开发环境的问题。

您运行的是什么操作系统、web 服务器和 PHP 版本?

当您显示404时, 浏览器导航栏显示您处于 http://localhost/chemdb/index.php/projects ?这是一个404从应用程序 (我们有一些样式) 或404从您的 web 服务器?如果这是一个数据库配置错误, 我不会期望你得到一个 404, 更可能是一个例外, 从我们的数据库库。

权限都看起来 OK 的文件下的应用程序/, 特别是应用程序/视图和应用程序/控制器及其内容, 要阅读的 web 服务器?

我能想到的唯一的事情, 否则可能是一个问题是 URI 协议设置。您可以尝试设置 $config['uri_protocol'] = 'QUERY_STRING'; 在 app/配置/配置. php 中。

下面是此应用程序所基于的 CodeIgniter 文档的疑难解答部分, 可能有帮助: https://www.codeigniter.com/user_guide/installation/troubleshooting.html

原文:

I can't seem to reproduce this issue, so I either don't have enough information about how to reproduce it or it's some problem with how you have set up your development environment.

What operating system, web server and PHP versions are you running?

When you're shown a 404 the browser navigation bar shows you are at http://localhost/chemdb/index.php/projects? Is this a 404 from the application (our has some styling) or a 404 from your web server? If this were a database configuration error I would not expect you to get a 404, more likely an exception from our database library.

Permissions all look OK for files under app/, particularly app/views and app/controllers and their contents, to be read by the web server?

The only thing I can think of that might otherwise be an issue is the URI protocol setting. You might try setting $config['uri_protocol'] = 'QUERY_STRING'; in app/config/config.php.

Here is the troubleshooting section of the CodeIgniter documentation on which this application is based which may be helpful: https://www.codeigniter.com/user_guide/installation/troubleshooting.html

cambro 2017-10-9
7

$config['index_page'] = 'index.php?';
这是

原文:

$config['index_page'] = 'index.php?';
this did it

zploskey 2017-10-9
8

棒.这是不必要的, 当运行在 Apache, 这是我们所有的安装使用, 我知道。如果这是你会在生产中使用你可能只需要添加?在当前的安装过程中进行开发。

原文:

Awesome. This is not necessary when running on Apache, which is what all of our installs use that I am aware of. If that is what you would use in production you probably will only need to add the ? while doing development in your current setup.

cambro 2017-10-9
9

现在开始配置原则以使用 unix 套接字连接 (我不认为此配置在 $db['default'] 选项/配置/数据库. php 中)。

原文:

Now on to configuring doctrine to use unix socket connections (I don't think this configuration is accounted for in the $db['default'] options in /config/database.php).

zploskey 2017-10-9
10

我认为使用套接字连接的适当方法是将您的主机名设置为 unix(/path/to/socket) , 基于http://doctrine1.readthedocs.io/en/latest/en/manual/introduction-to-connections.html。正在生成的 DSN 字符串有梨型, 请参见http://pear.php.net/manual/en/package.database.db.intro-dsn.php

原文:

I think the appropriate way to use a socket connection is to set your hostname to unix(/path/to/socket), based on http://doctrine1.readthedocs.io/en/latest/en/manual/introduction-to-connections.html. The DSN string being built there is the PEAR style, see http://pear.php.net/manual/en/package.database.db.intro-dsn.php.

cambro 2017-10-9
11

是的, 这是正确的!
但事实证明, 这是没有必要的。一个捷径是有和标准的 mysql 连接工作。

供参考, mysqli 作为 dbdriver/配置/数据库. php 抛出了这个错误:
Message: Couldn't locate driver named mysqli
没有任何意义, 因为 mysqli 被列为有效的驱动程序。但是, 无论如何, 我简化了 mysql, 让 php 处理插座, 它是所有好的。

原文:

Yes, that is correct!
But it turns out that it wasn't necessary. A shortcut was had and the standard mysql connection worked.

FYI, mysqli as dbdriver in /config/database.php threw this error:
Message: Couldn't locate driver named mysqli
Doesn't make any sense as mysqli is listed as a valid driver. But, in any case, I simplified to mysql and let php.ini handle the socket and it was all good.

zploskey 2017-10-9
12

是的, 代码中的一些文档是不正确的, 因为它是从 CodeIgniter 数据库文档中遗留下来的, 而我们在很久以前就转而使用教条了。教条就叫它 mysql。我会考虑改善那里的评论。

原文:

Yeah some of the documentation in that code is not correct as it's a holdover from the CodeIgniter database documentation, while we switched to using Doctrine a long time ago. Doctrine just calls it mysql. I'll look into improving the comments there.

cambro 2017-10-9
13

但我没有得到的是, 这两个被描述为支持这里:
http://doctrine.readthedocs.io/en/latest/en/manual/introduction-to-connections.html

不值得担心的太多, 虽然..。

原文:

But what I don't get is that both are described as supported here:
http://doctrine.readthedocs.io/en/latest/en/manual/introduction-to-connections.html

Not worth worrying too much about though...

zploskey 2017-10-9
14

教条1是不受支持的这些天, 我希望最终迁移到其他的东西。我的知识 mysqli 从来没有工作过, 但如果你把它设置为 mysql 它使用 mysql 驱动程序为 PDO, 所以它不是旧的 PHP mysql 驱动程序。

原文:

Doctrine 1 is unsupported these days and I expect to migrate to something else eventually. To my knowledge mysqli never worked, but if you set it to mysql it uses the mysql driver for PDO, so it's not the old PHP mysql driver.

返回
发表文章
cambro
文章数
1
评论数
6
注册排名
60833