草庐IT

命令字

全部标签

php - 使用 Boost::Process 运行 php 命令

我尝试运行PHP脚本并从stdout获取输出,代码如下所示:usingnamespaceboost::process;std::stringexec="php";std::vectorargs;//Imusttothrowtheexebyargumentargs.push_back("php");args.push_back("a.php");contextctx;ctx.stdout_behavior=capture_stream();childc=launch(exec,args,ctx);pistream&is=c.get_stdout();stdout中没有信息,但在stder

php - 在 PHP CLI 交互模式下添加命令

如何通过预先执行某些命令来启动php交互模式(php-a)?选项-B(--process-begin)似乎正是我想要的,但它看起来不能与`-a-结合使用:$php-B'$x=true;echo$x;'-aEitherexecutedirectcode,processstdinoruseafile.php二进制文件应该从另一个脚本化的php控制台中调用,然后交给用户。是否可以在移交之前提供代码?或者是否有其他可以使用的PHP选项? 最佳答案 基于@JustinT.的评论。auto_prepend_file选项可用于包含一些脚本:#ca

php - 如何在 Symfony2 应用程序的 Controller 中执行命令并在 Twig 模板中实时打印输出

我需要在我的Symfony2应用程序的Controller中执行一个持久的命令,并实时向用户返回终端的输出。我读过这个:http://symfony.com/doc/current/components/process.html#getting-real-time-process-output我不知道如何在Twig模板中实时打印终端输出。编辑:感谢Matteo的代码和用户的评论,最终实现是:/***@Route("/genera-xxx-r",name="commission_generate_r_xxx")*@Method({"GET"})*/publicfunctiongenera

php - 将 curl 命令转换为 php curl

我正在尝试将带有身份验证header的curl语句转换为phpcurl请求。但它似乎没有用,因为我收到了下面的错误echo'error:'。curl_error($ch);:error:SSLcertificateproblem:unabletogetlocalissuercertificate我的curl命令如下所示:curl--userXXXX:YYYY"URL"我的php-curl看起来像这样:$login='XXXX';$password='YYYY';$url='URL';$ch=curl_init();curl_setopt($ch,CURLOPT_URL,$url);cu

php - 如何在 Laravel 5 中获取当前使用的 Artisan 控制台命令名称?

问题/我尝试过的:在Laravel5中获取当前使用的Controller和操作很容易(但并不像它应该的那么容易),但是我坚持获取当前使用的artisan控制台命令。要获取Controller名称,我这样做:$route=Route::getRoutes()->match(Request::capture());$listAction=explode('\\',$route->getActionName());$rawAction=end($listAction);//controllernameandactioninasimplearray$controllerAndAction=ex

php - 如何在 hostgator 托管服务器 cpanel 上的 cron 作业上运行 laravel 5.2 artisan 命令?

我在Laravel5.2中创建了一个在特定时间后运行的示例计划作业。这通过artisan命令在localhost上运行良好。我在本地服务器上运行这个命令:phpartisan演示:Cron现在我将此任务添加到HostGator托管服务器上的cPanel高级选项cron作业中。但它不起作用。这是我正在尝试的命令:cd/home/pofindia/public_html/beta-var1/&&/usr/local/bin/phpartisanDemo:CronPHP版本:默认5.4。这是我的示例文件insert(['name'=>'hellonew']);$this->info('Dem

php - 之前不使用 "php"命令就无法执行 php 脚本

我需要使用不带“php”命令的php脚本。例如:$./test.php权限设置为755。这是脚本#!/usr/bin/php-q/usr/bin/php-v(所以路径存在)返回PHP7.0.15-1+deb.sury.org~xenial+1(cli)(built:Jan20201708:53:13)(NTS)Copyright(c)1997-2017ThePHPGroupZendEnginev3.0.0,Copyright(c)1998-2017ZendTechnologieswithZendOPcachev7.0.15-1+deb.sury.org~xenial+1,Copyrig

php - 加载 xdebug 时 CakePHP 命令行不工作

我正在尝试使用针对PHP7.1.6的xdebug来解决我的CakePHPv3.3.6项目中失败的单元测试。我使用以下设置设置了xdebug:[xdebug]xdebug.remote_enable=onxdebug.remote_host=127.0.0.1xdebug.remote_port=9000xdebug.remote_autostart=1xdebug.profiler_enable=offxdebug.profiler_enable_trigger=offxdebug.profiler_output_name=cachegrind.out.%t.%pxdebug.prof

php - "zip I/O error: Permission denied"执行命令

我正在尝试使用exec命令递归压缩目录,首先,出于大纲原因,我不需要zipArchive类,但是当我传递此命令时在exec命令中我收到一条错误消息:zipI/Oerror:Permissiondenied对于这个命令:cd../../;zip-Ptemppasswordhtml/acp/backup/filename.zip-rhtml/2>&1它从位于/var/www/html/acp/config.php的脚本开始,它将在cd之后移动到www目录。./../,然后将html目录压缩,并将zip文件存入/var/www/html/acp/backup/目录。但不幸的是我得到了一个权限

php - 从命令行运行 Gearman PHP 的段错误

我将UbuntuNatty与PHP5.3.5和PECLGearman0.8.0一起使用.这是版本信息:PHP5.3.5-1ubuntu7.3withSuhosin-Patch(cli)(built:Oct13201122:20:48)Copyright(c)1997-2009ThePHPGroupZendEnginev2.3.0,Copyright(c)1998-2010ZendTechnologieswiththeionCubePHPLoaderv4.0.10,Copyright(c)2002-2011,byionCubeLtd.,andwithZendGuardLoaderv3.3