PHP脚本替换cgi脚本

发布于 2024-08-30 22:58:27 字数 325 浏览 3 评论 0原文

我有一个 CGI 脚本,它使用不再受支持的旧数据库驱动程序。我认为用 php 重写它会更容易,而不是苦苦挣扎这个旧的 cgi 脚本。它现在作为 php 脚本运行,但我需要从同一个网址提供它。当用户访问 http://somesite.com/myscript.cgi 时,我希望它运行php 脚本。我尝试用 .cgi 重命名 php 脚本,但这不起作用。这是在由 Dreamhost 托管的 Apache 服务器上。有什么建议吗?

  • 布里杰·麦克斯韦

I have a CGI script that uses an old database driver that is no longer supported. Instead of struggling with this old cgi script, I thought it would be easier to rewrite it in php. It works now as a php script, but I need it to be served from the same web address. When a user accesses http://somesite.com/myscript.cgi, I want it to run the php script. I tried just renaming the php script with .cgi, but that didn't work. This is on an Apache server hosted by Dreamhost. Any advice?

  • Bridger Maxwell

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不知在何时 2024-09-06 22:58:27

创建包含内容的 .htaccess 文件

RewriteEngine On
RewriteRule ^myscript.cgi  /myscript.php

阅读有关 Mod_rewrite示例

create .htaccess file with content

RewriteEngine On
RewriteRule ^myscript.cgi  /myscript.php

Read more about Mod_rewrite and examples

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文