在linux的bash运行PHP脚本(PHP函数) [英] running php script (php function) in linux bash

查看:151
本文介绍了在linux的bash运行PHP脚本(PHP函数)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何使用Linux的bash运行PHP脚本?

PHP文件test.php的

test.php的遏制。

 <?PHP的回声你好\\ N>


解决方案

在命令行中输入:
PHP -f filename.php

确保filename.php既包括并执行要测试的功能。你回声出任何将出现在控制台包括错误。

警惕,往往为Apache PHP在php.ini是PHP CLI(命令行界面)不同。

How we run php script using linux bash ?

php file test.php

test.php contain.

<?php echo "hello\n" ?>

解决方案

From the command line enter this: php -f filename.php

Make sure that filename.php both includes and executes the function you want to test. Anything you echo out will appear in the console including errors.

Be wary that often the php.ini for Apache PHP is different from CLI PHP (command line interface).

这篇关于在linux的bash运行PHP脚本(PHP函数)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆