提问者:小点点

如何在cpanel中运行php mysql代码[closed]


请检查我的错误日志和. htaccess文件。我的C面板不支持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]

共2个答案

匿名用户

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

匿名用户

insert语句的写入方式不正确,在使用带有保留字或某些特殊字符的查询时,必须像这样指定列值,

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

此外,请确保列名正确。

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

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

查看这篇文章以供参考。

RewriteEngine On

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

在中使用此代码。htaccess