【问题标题】:How to run php mysql code in cpanel [closed]如何在cpanel中运行php mysql代码[关闭]
【发布时间】:2018-04-23 06:09:39
【问题描述】:

请检查我的错误日志和.htaccess 文件。我的 Cpanel 不支持 MySql 代码;它显示内部服务器 500 错误。我认为问题出在.htaccess 文件中。

错误日志文件:

[Thu Nov 09 22:46:34.530795 2017] [core:alert] [pid 6050:tid 140489065998080] [client 49.207.9.94:64454] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here, referer: http://houseofindiapa.com/submit.php
[Thu Nov 09 22:46:34.530687 2017] [core:alert] [pid 6050:tid 140489065998080] [client 49.207.9.94:64454] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here, referer: http://houseofindiapa.com/submit.php
[Thu Nov 09 22:46:34.166873 2017] [core:alert] [pid 1602:tid 140489086977792] [client 49.207.9.94:64445] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here
[Thu Nov 09 22:46:34.166703 2017] [core:alert] [pid 1602:tid 140489086977792] [client 49.207.9.94:64445] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here
[Thu Nov 09 22:46:31.934927 2017] [core:alert] [pid 21299:tid 140489013548800] [client 49.207.9.94:64418] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here, referer: http://houseofindiapa.com/submit.php
[Thu Nov 09 22:46:31.934809 2017] [core:alert] [pid 21299:tid 140489013548800] [client 49.207.9.94:64418] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here, referer: http://houseofindiapa.com/submit.php
[Thu Nov 09 22:46:31.573282 2017] [core:alert] [pid 6191:tid 140489045018368] [client 49.207.9.94:64419] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here
[Thu Nov 09 22:46:31.573169 2017] [core:alert] [pid 6191:tid 140489045018368] [client 49.207.9.94:64419] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here
[Thu Nov 09 22:46:30.623233 2017] [core:alert] [pid 6050:tid 140488961099520] [client 49.207.9.94:63629] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here, referer: http://houseofindiapa.com/submit.php
[Thu Nov 09 22:46:30.623046 2017] [core:alert] [pid 6050:tid 140488961099520] [client 49.207.9.94:63629] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here, referer: http://houseofindiapa.com/submit.php
[Thu Nov 09 22:46:24.250987 2017] [core:alert] [pid 6050:tid 140488971589376] [client 49.207.9.94:63631] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here, referer: http://houseofindiapa.com/
[Thu Nov 09 22:46:24.250817 2017] [core:alert] [pid 6050:tid 140488971589376] [client 49.207.9.94:63631] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here, referer: http://houseofindiapa.com/
[Thu Nov 09 22:46:23.862360 2017] [core:alert] [pid 1602:tid 140488908650240] [client 49.207.9.94:63630] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here
[Thu Nov 09 22:46:23.862232 2017] [core:alert] [pid 1602:tid 140488908650240] [client 49.207.9.94:63630] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here
[Thu Nov 09 22:46:10.473825 2017] [core:alert] [pid 29732:tid 140489118447360] [client 49.207.9.94:62045] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here, referer: http://houseofindiapa.com/
[Thu Nov 09 22:46:10.473729 2017] [core:alert] [pid 29732:tid 140489118447360] [client 49.207.9.94:62045] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here, referer: http://houseofindiapa.com/
[Thu Nov 09 22:46:10.060590 2017] [core:alert] [pid 21299:tid 140488940119808] [client 49.207.9.94:62044] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here
[Thu Nov 09 22:46:10.060428 2017] [core:alert] [pid 21299:tid 140488940119808] [client 49.207.9.94:62044] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here
[Thu Nov 09 22:45:58.094999 2017] [core:alert] [pid 6191:tid 140488866690816] [client 49.207.9.94:60701] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here, referer: http://houseofindiapa.com/
[Thu Nov 09 22:45:58.094846 2017] [core:alert] [pid 6191:tid 140488866690816] [client 49.207.9.94:60701] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here, referer: http://houseofindiapa.com/
[Thu Nov 09 22:45:57.697276 2017] [core:alert] [pid 6237:tid 140489034528512] [client 49.207.9.94:60699] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here
[Thu Nov 09 22:45:57.697173 2017] [core:alert] [pid 6237:tid 140489034528512] [client 49.207.9.94:60699] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here
[Thu Nov 09 22:45:35.480760 2017] [core:alert] [pid 4318:tid 140489076487936] [client 49.207.9.94:58221] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here, referer: http://houseofindiapa.com/
[Thu Nov 09 22:45:35.480635 2017] [core:alert] [pid 4318:tid 140489076487936] [client 49.207.9.94:58221] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here, referer: http://houseofindiapa.com/
[Thu Nov 09 22:45:35.140764 2017] [core:alert] [pid 4053:tid 140488982079232] [client 49.207.9.94:57891] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here
[Thu Nov 09 22:45:35.140654 2017] [core:alert] [pid 4053:tid 140488982079232] [client 49.207.9.94:57891] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here
[Thu Nov 09 22:45:32.507857 2017] [core:alert] [pid 6237:tid 140488898160384] [client 49.207.9.94:57890] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here, referer: http://houseofindiapa.com/submit.php
[Thu Nov 09 22:45:32.507706 2017] [core:alert] [pid 6237:tid 140488898160384] [client 49.207.9.94:57890] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here, referer: http://houseofindiapa.com/submit.php
[Thu Nov 09 22:45:32.142869 2017] [core:alert] [pid 6236:tid 140488866690816] [client 49.207.9.94:57775] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here
[Thu Nov 09 22:45:32.142728 2017] [core:alert] [pid 6236:tid 140488866690816] [client 49.207.9.94:57775] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here
[Thu Nov 09 22:45:31.434755 2017] [core:alert] [pid 21299:tid 140489024038656] [client 49.207.9.94:57774] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here, referer: http://houseofindiapa.com/submit.php
[Thu Nov 09 22:45:31.434625 2017] [core:alert] [pid 21299:tid 140489024038656] [client 49.207.9.94:57774] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here, referer: http://houseofindiapa.com/submit.php
[Thu Nov 09 22:45:31.094164 2017] [core:alert] [pid 6191:tid 140488866690816] [client 49.207.9.94:57008] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here
[Thu Nov 09 22:45:31.094051 2017] [core:alert] [pid 6191:tid 140488866690816] [client 49.207.9.94:57008] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here
[Thu Nov 09 22:45:24.810721 2017] [core:alert] [pid 1602:tid 140488929629952] [client 49.207.9.94:57007] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here, referer: http://houseofindiapa.com/submit.php
[Thu Nov 09 22:45:24.810528 2017] [core:alert] [pid 1602:tid 140488929629952] [client 49.207.9.94:57007] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here, referer: http://houseofindiapa.com/submit.php
[Thu Nov 09 22:45:24.430768 2017] [core:alert] [pid 4053:tid 140488961099520] [client 49.207.9.94:57004] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here
[Thu Nov 09 22:45:24.430628 2017] [core:alert] [pid 4053:tid 140488961099520] [client 49.207.9.94:57004] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here
[Thu Nov 09 22:45:04.843597 2017] [core:alert] [pid 6191:tid 140488866690816] [client 49.207.9.94:54783] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here, referer: http://houseofindiapa.com/submit.php
[Thu Nov 09 22:45:04.843468 2017] [core:alert] [pid 6191:tid 140488866690816] [client 49.207.9.94:54783] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here, referer: http://houseofindiapa.com/submit.php
[Thu Nov 09 22:45:04.313624 2017] [core:alert] [pid 4318:tid 140489003058944] [client 49.207.9.94:54781] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here
[Thu Nov 09 22:45:04.313480 2017] [core:alert] [pid 4318:tid 140489003058944] [client 49.207.9.94:54781] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here
[Thu Nov 09 21:03:38.055866 2017] [core:alert] [pid 4053:tid 140489024038656] [client 183.83.247.92:9241] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here, referer: http://houseofindiapa.com/css/jquery.bxslider.min.css
[Thu Nov 09 21:03:38.055755 2017] [core:alert] [pid 4053:tid 140489024038656] [client 183.83.247.92:9241] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here, referer: http://houseofindiapa.com/css/jquery.bxslider.min.css
[Thu Nov 09 21:03:33.952440 2017] [core:alert] [pid 3524:tid 140489045018368] [client 183.83.247.92:9242] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here
[Thu Nov 09 21:03:33.952319 2017] [core:alert] [pid 3524:tid 140489045018368] [client 183.83.247.92:9242] /home/kaligotla1234/public_html/.htaccess: <Directory not allowed here

这是.htaccess 文件:

RewriteEngine On

RewriteCond %{QUERY_STRING} !(?:^|&)test=yes(?:&|$) [NC]
RewriteRule ^foo/(.*)$ bar/$1?test=yes [NC,QSA,L]

【问题讨论】:

  • Edit 你的问题包括你的代码作为文本
  • 请在此处粘贴您的代码....
  • 错误日志显示&lt;Directory not allowed,而您的.htaccess 似乎不包含此文本。我猜你并没有真正向我们展示你的完整.htaccess并且投票关闭为不可复制。

标签: php mysql .htaccess


【解决方案1】:

你的insert语句写的不对,当你使用带有保留字或特殊字符的查询时,必须像这样指定列值,

"INSERT INTO `mycart` (`customr_id`, `category`, `product`, `price`, `qty`, `output`, `status`) VALUES 
 ('0','0','0','0','1','0','0')"

另外,请确保列名正确。

如果这不能解决您的问题,请从 cpanel 发布错误消息。

根据您的错误日志,您需要从 .htaccess 文件中删除 Directory 指令。

Check this post 供参考。

RewriteEngine On

#RewriteCond %{QUERY_STRING} !(?:^|&)test=yes(?:&|$) [NC]
#RewriteRule ^foo/(.*)$ bar/$1?test=yes [NC,QSA,L]

在 .htaccess 中使用此代码

【讨论】:

  • 在我的 cpanel 中可见的相同 500 错误存在于我的 cpanel .htaccesss 文件中为空是支持 apache 服务。 .htaccess 文件中写的任何内容请告诉我
  • 如果我没记错的话,您正在使用 Godaddy 托管,请点击此链接in.godaddy.com/help/working-with-error-logs-1197 并检查究竟是什么错误。
  • [Thu Nov 09 20:02:58.748306 2017] [core:alert] [pid 18153:tid 140488982079232] [client 183.83.247.92:11523] /home/kaligotla1234/public_html/.htaccess:
  • 以上信息是我最近的错误日志
  • .htaccess 文件中不允许目录指令stackoverflow.com/questions/46303236/…。请删除该指令。
【解决方案2】:

您没有将连接实例传递给您的 mysql_query() 函数调用。

【讨论】:

  • 写入 mysql_query() 函数在我的 cpanel 中出现相同的 500 错误。htaccesss 文件为空是支持 apache 服务。 .htaccess 文件中写的任何内容请告诉我
猜你喜欢
  • 2015-01-20
  • 1970-01-01
  • 2015-01-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-10-12
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多