Php 从其他文件夹重定向时,条带API停止工作

Php 从其他文件夹重定向时,条带API停止工作,php,regex,apache,.htaccess,stripe-payments,Php,Regex,Apache,.htaccess,Stripe Payments,不知道发生了什么,但当我将一个条带结账应用程序下载到我的计算机并通过我的终端运行时,它工作了。我的stripe dashboard上的日志获取多个事件,没有错误 php -S localhost:4242 我安装了stripe CLI来测试Webhook,但后来遇到了这个问题。不管怎样,它都帮了我一点调试 stripe listen --forward-to=localhost:4242 当我转到localhost:4242/index.html并单击启动“订阅”过程的按钮时,条带日志: 我

不知道发生了什么,但当我将一个条带结账应用程序下载到我的计算机并通过我的终端运行时,它工作了。我的stripe dashboard上的日志获取多个事件,没有错误

php -S localhost:4242
我安装了stripe CLI来测试Webhook,但后来遇到了这个问题。不管怎样,它都帮了我一点调试

stripe listen --forward-to=localhost:4242
当我转到localhost:4242/index.html并单击启动“订阅”过程的按钮时,条带日志:

我在root/index.php中添加了一个简单的链接,该链接重定向到root/stripe_test/index.html,使其成为一个“选择计划”页面。我应该提到我在xampp中托管根目录,localhost:8080,这更奇怪。因为从localhost:4242打开条带html页面可以使其按预期工作。简言之:

  • localhost:8080/stripe_test/index.html-不起作用(通过xampp)
  • localhost:4242/index.html-工作(通过终端:php-S localhost:4242)
我检查了我的apache错误日志,点击按钮后显示如下:

[Tue Apr 13 15:51:35.411737 2021] [core:warn] [pid 8520:tid 588] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Tue Apr 13 15:51:35.432756 2021] [mpm_winnt:notice] [pid 8520:tid 588] AH00455: Apache/2.4.46 (Win64) OpenSSL/1.1.1h PHP/8.0.2 configured -- resuming normal operations
[Tue Apr 13 15:51:35.432756 2021] [mpm_winnt:notice] [pid 8520:tid 588] AH00456: Apache Lounge VS16 Server built: Oct  2 2020 11:45:39
[Tue Apr 13 15:51:35.432756 2021] [core:notice] [pid 8520:tid 588] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Tue Apr 13 15:51:35.434758 2021] [mpm_winnt:notice] [pid 8520:tid 588] AH00418: Parent: Created child process 11816
[Tue Apr 13 15:51:35.724020 2021] [mpm_winnt:notice] [pid 11816:tid 700] AH00354: Child: Starting 150 worker threads.
[Tue Apr 13 15:51:44.120877 2021] [php:warn] [pid 11816:tid 1840] [client ::1:58891] PHP Warning:  require_once(shared.php): Failed to open stream: No such file or directory in C:\\xampp\\root\\config.php on line 3, referer: http://localhost:8080/stripe_test/index.html
[Tue Apr 13 15:51:44.120877 2021] [php:error] [pid 11816:tid 1840] [client ::1:58891] PHP Fatal error:  Uncaught Error: Failed opening required 'shared.php' (include_path='C:\\xampp\\php\\PEAR') in C:\\xampp\\root\\config.php:3\nStack trace:\n#0 {main}\n  thrown in C:\\xampp\\root\\config.php on line 3, referer: http://localhost:8080/stripe_test/index.html
我不知道为什么目录有两个反斜杠,但它可能与.htaccess文件和标题中的有关。以下是htaccess指令:

Options -MultiViews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteRule ^profile/([\w-]+)/?$ profile.php?userid=$1 [L,QSA,NC]
RewriteRule ^([\w-]+)/([\w-]+)/?$ city_page.php?state=$1&city=$2 [L,QSA]

有人能解释一下这是怎么回事吗?我认为主要的问题是htaccess和base href,因为当我在终端中针对实际的文件夹stripe_测试并直接从该目录运行服务器时,它会起作用。当我使用我的xampp运行服务器时,它会使用那些.htaccess指令和base href,此时error.log会显示奇怪的路径。

C:\\xampp\\root\\config.php中没有文件。它位于
C:\\xampp\\root\\stripe\u test\\config.php

我猜出来了。显然,这是由两件事引起的:

  • 不正确的定向目标
  • 存储JS缓存的Chrome目录目标不正确
  • 我打开chrome控制台,检查它弄乱了哪个部分,然后开始摆弄文件名,即从config.php到asdffwefconfig.php,并在文件本身添加无效代码,如dfianfinf

    事实证明,在控制台中,它仍然从缓存解析为root/config.php。所以我试着在一个不知名的窗口中完成整个过程:

  • 在本地主机8080上使用根目录启动xampp
  • 单击我的本地站点中的一组链接到达localhost:8080/stripe\u test/index.html
  • 单击“订阅”按钮以启动条带中的创建会话
  • 我之前被停在#3,但由于不知名,它正在推进并将日志发送到我的stripe仪表板。所以我清除了我的浏览器缓存,你知道吗,它在我的常规浏览器窗口中工作


    对于所有试图调查此事的人,感谢你们抽出时间。将此标记为解决方案。

    是否最好先注释掉所有重写规则来调试此问题?是的,我意识到这一点。但是,当我简单地更改过程时,为什么会解析为C:\\xampp\\root\\config.php?例如,我从root启动xampp/然后单击一组链接以root/stripe_test/index.html结束,而不是直接从root/stripe_test启动服务器,然后打开index.html。
    [Tue Apr 13 15:51:35.411737 2021] [core:warn] [pid 8520:tid 588] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
    [Tue Apr 13 15:51:35.432756 2021] [mpm_winnt:notice] [pid 8520:tid 588] AH00455: Apache/2.4.46 (Win64) OpenSSL/1.1.1h PHP/8.0.2 configured -- resuming normal operations
    [Tue Apr 13 15:51:35.432756 2021] [mpm_winnt:notice] [pid 8520:tid 588] AH00456: Apache Lounge VS16 Server built: Oct  2 2020 11:45:39
    [Tue Apr 13 15:51:35.432756 2021] [core:notice] [pid 8520:tid 588] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
    [Tue Apr 13 15:51:35.434758 2021] [mpm_winnt:notice] [pid 8520:tid 588] AH00418: Parent: Created child process 11816
    [Tue Apr 13 15:51:35.724020 2021] [mpm_winnt:notice] [pid 11816:tid 700] AH00354: Child: Starting 150 worker threads.
    [Tue Apr 13 15:51:44.120877 2021] [php:warn] [pid 11816:tid 1840] [client ::1:58891] PHP Warning:  require_once(shared.php): Failed to open stream: No such file or directory in C:\\xampp\\root\\config.php on line 3, referer: http://localhost:8080/stripe_test/index.html
    [Tue Apr 13 15:51:44.120877 2021] [php:error] [pid 11816:tid 1840] [client ::1:58891] PHP Fatal error:  Uncaught Error: Failed opening required 'shared.php' (include_path='C:\\xampp\\php\\PEAR') in C:\\xampp\\root\\config.php:3\nStack trace:\n#0 {main}\n  thrown in C:\\xampp\\root\\config.php on line 3, referer: http://localhost:8080/stripe_test/index.html
    
    Options -MultiViews
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^ - [L]
    RewriteRule ^profile/([\w-]+)/?$ profile.php?userid=$1 [L,QSA,NC]
    RewriteRule ^([\w-]+)/([\w-]+)/?$ city_page.php?state=$1&city=$2 [L,QSA]