Welcome Guest, Not a member yet? Register   Sign In
Best way to run CI from PHP CLI?
#1

[eluser]Sinclair[/eluser]
Hi,

I need to run CI from the PHP CLI. I have read from various sources but I'm not sure about the best method to do this.

Can someone give me a clue about the method I should use?

Best Regards,
#2

[eluser]Phil Sturgeon[/eluser]
My method

Alternative method

TBH I use both, you can work out the pro's and con's of each I'm sure.
#3

[eluser]Sinclair[/eluser]
[quote author="Phil Sturgeon" date="1271861111"]My method

Alternative method

TBH I use both, you can work out the pro's and con's of each I'm sure.[/quote]

Thanks for the reply.

I need only to run one controller from the PHP CLI. There are any methods to run only one controller from the PHP CLI?

Another information that I forgot to specify is that I need to run a controller from a CronJob.

PS: Sorry for my bad english.

Best Regards,
#4

[eluser]Phil Sturgeon[/eluser]
Running from CLI is identical to crontab, as long as you have your paths configured properly which CodeIgniter generally does.

There is no other known method that will specifically work with ONE controller. I would use the 2nd method I posted, then use if(defined('CMD')) to allow it to be run or ban others.
#5

[eluser]jedc53[/eluser]
I have a normal PHP install for running command line scripts and use one that is installed as a module for Apache.I've tried SimpleTest and PHPUnit,and stuck with PHPUnit because it works with PHP 5,and Simple Unit seemed to throw a lot of notices and warnings.There is a PHPUnit testing framework that is developed in native PHP and used by projects such as the Zend Framework.




Theme © iAndrew 2016 - Forum software by © MyBB