草庐IT

database-connectivity

全部标签

php - <b> fatal error </b> : Uncaught exception 'Exception' with message 'Failed to connect to api.twitter.com port 443: Connection timed out'

我正在开发一个Codeigniter项目,在该项目中我使用twitterapi库来获取twitter数据。在我更改服务器之前它工作得很好,但是在更改服务器之后它产生了以下错误。我不知道问题所在。Fatalerror:Uncaughtexception'Exception'withmessage'Failedtoconnecttoapi.twitter.comport443:Connectiontimedout'in/my/project/path/myProject/application/ws/libraries/TwitterAPIExchange.php:297Stacktrac

php - SMTP 错误 : Could not connect to SMTP host. 邮件程序错误:SMTP 错误:无法连接到 SMTP 主机

大家好,我是php和html新手,面临问题:SMTP错误:无法连接到SMTP主机。邮件程序错误:SMTP错误:无法连接到SMTP主机。但在本地xampp中工作正常,在服务器中出现错误。代码如下:Name:$nameContact:$contactEmail:$emailCompany:$companyMessage:$message";require_once('mailer/class.phpmailer.php');$mail=newPHPMailer();$mail->IsSMTP();$mail->Host="smtp.gmail.com";$mail->SMTPDebug=0

php - 无法在类 App\bill、Laravel 中使非静态方法 Illuminate\Database\Eloquent\Model::getTable() 静态化

我在模型中创建了如下方法:classbillextendsModel{publicstaticfunctiongetTable(){$tables=Bill::where('order_type','0')->where('table_no','','')->groupBy('table_no')->get();return$tables;}}在Controller中我访问这个方法是publicfunctionbill(){$data=Bill::getTable();returnview('bill.bills');}它给出错误,因为Cannotmakenonstaticmethod

php - 调用未定义的方法 Illuminate\Database\Query\Builder::post()

我在使用查询构建器时遇到问题,在路由文件中使用post()时会出现未定义的方法错误。一般我用的是returnofUser::find($id)->post;但是当我将post作为函数调用时,它不起作用并给我:CalltoundefinedmethodIlluminate\Database\Query\Builder::post()用户模型hasOne('App\Post');}}路线Route::get('/',function(){returnview('welcome');});Route::get('/user/{id}/post',function($id){returnUse

PHP Soap故障: Could not connect to host

类似这样的问题很多。但是我在尝试时没有得到解决方案。在下面找到我的代码:SOAPXML:xxxxxxxyyyyyyyy.....PHP代码:$client=newSoapClient({soapurl},$params);$auth=newstdClass();$auth->UserName='xxxxxxx';$auth->Password='yyyyyyyy';$header=newSoapHeader('NAMESPACE','Authentication',$auth,false);$client->__setSoapHeaders($header);$result=$clie

docker: Error response from daemon: driver failed programming external connectivity on endpoint tomc

docker:Errorresponsefromdaemon:driverfailedprogrammingexternalconnectivityonendpointtomcat1(9d06342addfe339a1bbf0876ae4534410f58cc65fa0b3b6516f282224af68202):(iptablesfailed:iptables--wait-tnat-ADOCKER-ptcp-d0/0--dport8080-jDNAT--to-destination172.17.0.2:8080!-idocker0:iptables:Nochain/target/matchb

PHP oci_connect() 卡住/没有超时

我们正在使用Lumen5.2.x(Laravel)应用程序从Oracle数据库获取数据。为此,我们使用oci_connect()连接到数据库。(额外信息:我们使用Oracleinstantclient)由于未知原因,应用程序没有响应并且不会返回任何数据。经过几个小时的调试,我们发现它卡在了同一个方法中:oci_connect()。显然该函数没有返回“超时”消息或任何类似的消息。后来好像是数据库搬到了别的主机上,就是连接不上的原因。但是,我们预计会出现错误,而不是大量等待。这就是我们试图强制设置超时的原因,直到现在还没有成功。我们尝试过的事情:将此添加到连接字符串:(CONNECT_TI

php - 交响乐 2 : Global Database Query

我将如何在Symfony2包中的每个页面上执行数据库查询?我正在尝试创建在线名人录功能,但这需要在全局范围内执行查询。谢谢!:) 最佳答案 你可以渲染一个子模板,例如(在我的一个项目中)在我的layout.html.twig我有这个:{%render"EUPaNdataBundle:Home:listAllInstitutes"%}这将在顶部导航栏的下拉菜单中呈现所有机构的列表。listAllInstitutes是HomeController中的一个操作,它从数据库中获取一个机构列表,然后返回listAllInstitutes.ht

php - socket_connect 不会超时

我正在使用套接字将数据发送到可能没有响应的服务器。所以我试图通过在SO中使用此解决方案来定义超时。MakePHPsocket_connecttimeoutsocket_set_option($socket,SOL_SOCKET,SO_RCVTIMEO,array('sec'=>1,'usec'=>0));socket_set_option($socket,SOL_SOCKET,SO_SNDTIMEO,array('sec'=>1,'usec'=>0));这在建立连接并且服务器响应时间过长时有效。但是当它无法创建连接时socket_connect($socket,$addr,$port)

php - Symfony2 : How to use INSERT DELAYED with doctrine or create a non-blocking database operation?

出于性能原因,我想使用mysql的INSERTDELAYED查询来保留一个日志对象。您是否知道如何使用Doctrine来执行此操作? 最佳答案 为什么你可能不应该使用INSERTDELAYED:AsofMySQL5.6.6,INSERTDELAYEDisdeprecated,andwillberemovedinafuturerelease.UseINSERT(withoutDELAYED)instead.(officialdocumentation)symfony2解决方案:使用symfony2,您可以通过为kernel.termi