How to run Yii console app from Ubuntu CLI? - php

I uploaded my project to a server running Ubuntu. The project has a console command logrotation/index. I want to run it through the command line, and Ubuntu says "yii: command not found". I tried to run it in different ways.
How to run this console application from the command line and then (for the future) put it as a cronjob?

Inside project directory:
./yii logrotation/index
Or
php yii logrotation/index
The error message "yii: command not found" means that Ubuntu can't find the binary in $PATH directories. So you need to specify ./ to show that you are executing a file from the current directory.

Related

Can't find .env files during PHPUnit test using PUTTY

I'm using a vagrant box for my php project. I've created two .env files (.env and .env.testing). The website runs smoothly but while testing the functions using PHPUnit, it throws me a File Not found error. I can see the files on my directory but can't view them in terminal using ls. But I can see them all if I use ls -a command. Is the issue with vagrant or putty or am I doing this wrong?

symfony - 'bin' is not recognized as an internal or external command

I am trying to run a symfony command via the command line. On writing the below command
bin/console doctrine:database:create
it outputs an error
'bin' is not recognized as an internal or external command,
operable program or batch file.
php is installed on my machine and configured in environment variables but I am getting that error. Please what could be wrong?
This is a Linux like command. Obviously you are coming from Windows system:
php bin\console doctrine:database:create
Pro tip: you can shortcut commands as long as the shortcut is unique:
php bin\console doc:dat:cr
Make sure you cd to the app's directory before running the command too.

PHP artisan command has no effect

I created a project in Laravel 5, on localhost. It works perfectly. I uploaded it on Godaddy using FileZilla and tried to run php artisan command. It didn't work. Just to be sure if there's a problem with composer or Laravel, I created a new Laravel project with same name and tried php artisan command it worked. Then I tried copying just app and database folder into newly created project and tried php artisan command, it stopped working just like before.
Can anyone tell me what is the problem here.
I tried running composer install command in project directory as per one suggestion on stackoveflow, didn't work for me
There probably is something in the app/ or database/ directory that's causing some fatal error and your php configuration is set to not display any errors.
Execute php --ini to find out which ini file is used and then configure it to show errors. After saving the ini file, run php artisan again and fix the error.

Adding git-ftp to my environment for php

I've installed git-ftp onto my CentOS Server so that I can do deployments from an activeCollab installation running the ac_gitolite module.
Everything installed fine and the app lives at
/usr/local/bin/git-ftp
When I log into the server via ssh I can run git-ftp commands without the full path, but when attempting to use PHP to run commands with exec ie:
exec ("git-ftp --version 2>&1", $output);
I receive the following error:
sh: git-ftp: command not found
Is there an environment path I need to specify somewhere specifically for PHP, or what am I doing wrong?
The two options discussed in "command not found - error in exec() command" are:
One easy solution would be to put the full path of the git-ftp executable.
The other is to add git-ftp to the php server user's PATH.

How do I get the Bake console for CakePHP?

I am having trouble getting the Bake console.
I am on Windows running XAMPP.
I'm doing the IBM CakePHP tutorial.
Here is my directory:
C:\
xampp
htdocs
ibm2 (a test project - orginally called cakephp)
app
cake
vendors
(etc)
It says to use Bake,
cd into the /webroot/app directory and
launch the Cake Console:
../cake/console/cake bake. You should
be presented with a screen that looks
like Figure 2.
So I write in my command prompt till I am at:
C:\xampp\htdocs\ibm2\app>
Then I type
../cake/console/cake bake
but I get this error:
'..' is not recognized as an internal
or external command, operable program
or batch file.
What am I doing wrong? I use the Windows command prompt
Take a look at Setting Up the CakePHP Console on Windows screencast.
start the command prompt:
type cd\ press enter and then cd:/xampp/php press enter
php.exe C:/xampp/htdocs/cakeblog/lib/cake/console/cake.php bake press enter
This trick works for me :-
Go to shell folder which is in bin folder in cakephp 3.0.
Click on batch file.
After it open cmd and set path to your folder like cd xampp/htdocs/test and then enter bake commands
In cakephp 3.X bake and windows environment with wamp server you should have yet php environment variable active:
check with Powershell and type php-v if you see your version of php
Install cake php bake https://book.cakephp.org/bake/1/en/index.html
no need to install cakephp environmetn variable only go to the root folder on your project and type: PS C:\wamp64\www\yourcakephp3.x_project>bin/cake bake
first check bake command in command prompt if it gives the out put not recognized as
internal or external command than first add environment variable correctly than cake bake will
work correctly

Categories