是否有不使用会话的 PHP/MySQL 数据库管理员?
我正在一个网站上进行开发工作,该网站设置了一个奇怪的服务器,其中会话基本上不起作用。这是一个很长的故事,但主要的症结在于它是每隔几分钟从 FTP 服务器同步一次的服务器集群。例如,用 PHP 写入文件系统的任何内容都会在 5 分钟内被删除。
所以这意味着会话不起作用,并且我在 phpMyAdmin 中遇到一些奇怪的问题,比如它忘记了我所在的表格的哪一页 - 我单击“下一页”,然后又回到开头。
我也尝试过 SQL Buddy,但遇到了类似的问题。
是否有不使用会话的等效项?不需要像PMA那样功能齐全,它主要用于添加/编辑一些东西。
I am doing development work on a site with a strange server set up where sessions basically don't work. It's kind of a long story, but the main crux is it's a cluster of servers that are syncronized from an FTP server every few minutes. And for example, anything written to the filesystem in PHP gets deleted within 5 minutes.
So this means sessions don't work and I get some strange problems in phpMyAdmin, like it forgetting which page of a table I was on - I click 'next page' and end up back at the start again.
I've also tried SQL Buddy and am getting similar problems.
Are there any equivalents that don't use sessions? Doesn't need to be as full-featured as PMA, it's mainly for adding/editing some stuff.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
总有 MySQL GUI 工具。
There's always the MySQL GUI Tools.
您可以让 phpmyadmin 使用其他身份验证方法:
http://www.phpmyadmin.net/documentation/#authentication_modes取决于
您需要多少安全性以及您受到的限制程度,但使用自定义 .htaccess 的“配置”身份验证模式听起来可能适合您。
You can make phpmyadmin use other authentication methods:
http://www.phpmyadmin.net/documentation/#authentication_modes
Depends how much security you need and how restricted you are, but 'config' authentication mode with a custom .htaccess sounds like it might work for you.
我不知道将其插入 phpMyAdmin 有多难,但是 PHP 有一个功能,允许以除使用文件之外的其他方式存储会话。
就您而言,显然您已经有一个数据库服务器,所以也许您可以创建一个“技术”数据库,并用它来存储会话?这样,您仍然可以使用 phpMyAdmin (这是一个相当好的工具),但您的问题应该得到解决。
为此,您需要知道的 PHP 函数是
session_set_save_handler
:有几个示例(查看页面底部的评论:有些可能会有所帮助)
例如,默认情况下,Drupal 使用此解决方案将会话存储到数据库而不是文件中。
另一种解决方案是使用 memcached 来存储会话——当然,如果您没有可供使用的 memcached 服务器,这可能比将它们存储在数据库中要困难一些 ^^
或者,当然,如果您可以通过网络访问数据库服务器,则可以在本地计算机上安装 phpMyAdmin,或使用类似 MySQL GUI 工具 及其 MySQL 查询浏览器。
I don't know how hard it would be to plug this into phpMyAdmin, but PHP has a functionnality that allows sessions to be stored in another way than using files.
In your case, you already have a database server, obviously, so maybe you could create a "technical" database, and use it to store sessions ? This way, you would still be able use phpMyAdmin (which is quite a good tool), but your problem should be solved.
The PHP function you need to know to do that is
session_set_save_handler
:There are a couple of examples (take a look at the comments at the bottom of the page : some might be helpful)
For instance, Drupal uses this solution to store sessions into DB instead of files, by default.
Another solution would be to use memcached to store your sessions -- of course, if you don't have a memcached server at your disposal, this might be a bit harder than storing them in DB ^^
Or, of course, if you have access to your DB server via the network, you could install phpMyAdmin on your local computer, or use a tool like MySQL GUI Tools and its MySQL Query Browser.
我找到了一个巧妙的解决方案! SQLBuddy 有一个功能,您可以将密码放在配置文件中,它会自动使用它,而无需登录。
显然,默认情况下这是不安全的,但加上
.htaccess
和.htpasswd
(它确实在服务器上工作)我现在已经获得了安全登录。I found a neat solution! SQLBuddy has a feature where you can put the password in the config file and it will use it automatically without a need to log in.
Obviously this is insecure by default, but coupled with a
.htaccess
and.htpasswd
(which does work on the server) I've now got a secure login.