I am trying to deploy a Laravel 4 app, but artisan is not showing any commands. Why? - deployment

I've deployed a Laravel 4 app to a shared host for the first time and run composer install, but it fails with the message:
Script php artisan clear-compiled handling the post-install-cmd event returned with an error
[RuntimeException]
Error Output:
[InvalidArgumentException]
Command "clear-compiled" is not defined.
When I run the command php artisan list I don't get the expected list of artisan commands, only:
Available commands:
help Displays help for a command
list Lists commands
workbench Create a new package workbench
All the dependency files are properly installed in the vendor folder.
Why are Laravel's standard artisan commands not available?

The problem was that the php command on my host machine was not running the CLI version of php. When I run the command php-cli artisan list then I get the expected list of Laravel artisan commands.
To get composer to call this properly, then, I just had to update the 'scripts' section in my composer.json to use php-cli instead of plain php.
(As a side note, composer had been spitting out a similar warning with this message: Warning: Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI)

Related

php_intl.dll issue while installing moodle

I am trying to install moodle. It has been a very frustrating experience with the "Server Checks" page during the installation process with 2 issues.
php_extension for php_intl.dll is failing. I have done nearly everything that is written anywhere but the server check still fails.
php_setting for opcache.enable also fails. All the settings in php.ini as per recommendation has been made and yet this check doesn't pass.
One pointer which may be useful. from the command prompt, when i tried to do php -v to check version or if i run php.exe, it throws an error saying:
"PHP Warning: PHP Startup: Unable to load dynamic library 'D:\Moodle_34\server\php\ext\php_intl.dll' - The specified module could not be found. in Unknown on line 0"
moodle 3.4.3+
Windows 8.1 pro desktop
PHP 7.1.10
Apache 2.4
XAMPP 3.2.2
Any help would be most welcome.

Installing Laravel Backpack "no install"

I'm trying to install Backpack for Laravel on Windows Server 2012 (which may be part of the problem, but I can't find any instructions specifically for Windows). I'm following the directions here, and everything goes fine until I need to run "php artisan backpack:base:install" at which point I get this error:
[ReflectionException]
Class Backpack\Base\Backpack\Base\app\Console\Commands\Install does not exist
I assume it has something to do with the duplication of the "Backpack\Base" part, but explicitly giving it the path without the duplication or just saying install results in the same error. Likewise, same error with any other artisan commands later in the guide, such as php artisan vendor:publish --provider="Backpack\CRUD\CrudServiceProvider" --tag="public". Any advice would be really appreciated.
There was a problem with the 3.3.0 release, which has since been fixed. You must have tried to install it within the 1-hour timespan until we had time to properly test the release. A composer update should fix it for you. You'll then be able to run php artisan backpack:base:install without a glitch.
Cheers!

Install laravel ends up in wrong directory (composer with cygwin)

I am trying to install laravel with the use of cygwin, a command line tool for windows.
I use this line
composer create-project laravel/laravel=4.2.0 c/my_workspace/projectname --prefer-dist
which installs everything. But it does not end up in c:/my_workspace/projectname. Instead it ends up in cygwin64/c/my_workspace/projectname.
The next time I tried it it ended up in a different folder, also inside "cygwin64".
It doesn't matter what path I specify, the path will start in the cygwin64 folder for some reason. By the way, in cygwin there is a always a prefix for the paths called /cygdrive/. Is that what causes it to start from cygwin64?
I also tried instead to execute it from cmd by navigating to
cd c:/myworkspace
And then entering
composer create-project laravel/laravel=4.2.0 /projectname --prefer-dist
It says "Installling", and then "loading from cache" (?), then it says
failed to download laravel/laravel from dist: C:my_workspace/vendor/composer/5079c43b does not exist and could not be created
Then it tries to download from source. When cloning starts it fails:
Failed to clone git#github.com:laravel/laravel.git, git was not found
I managed to get it installed finally. I suppose there was something wrong with the way I wrote the filepath:
c/my_workspace/projectname
so it was created in the cygwin64 folder (for some reason). This time I navigated to the folder where I want the install:
cd c:/my_workspace/projectname
then install with:
composer create-project laravel/laravel=4.2.0 --prefer-dist
However, I got a mkdir() permission denied problem, which was solved by running cygwin as administrator.
Then I got another problem where you setup the laravel development server with
$ php artisan serve
It could not find the artisan file because it was located inside a "laravel" folder(!?), which I guess wasn't right, so I moved the laravel files back to my project folder and deleted the laravel folder. The laravel development server has started so I guess it works now.

Execute php commands in WAMP environment

I'm new to working in a WAMP environment, in this case I'm using Easyphp, and I can't find how to execute php commands (like a simple php -v), like I would do for example when connecting to a server with SSH.
I have Easyphp installed, apache and mysql servers are on, and I created a virtual host using the module in the same folder where I'm trying to execute the php command (using the cmd tool in windows).
Is there any other way to do this? Is there a "console" just for that? Any help would be appreciated!
EDIT
OK maybe I should give a specific example of what I'm trying to do in case I didn't explain myself very well. I'm trying to follow this guide to getting started with Zend Framework, and in the very first step after downloading the files, it asks to "type" 2 commands:
php composer.phar self-update
php composer.phar install
Where do I exactly "type" those commands?
In windows you need to set up your path environment variable (if it hasn't already been done by the installer) so that it points to the correct location for the PHP executables. Refer to the documentation for EasyPHP to see if/how you need to do this.
Then, open a dos window, and cd into the directory for your project. Then you should be able to run the commands as shown.

pecl not working on php CLI mode (involving mongoDB in Gearman)

For test purposes I have gearman running on localhost. So I run the gearman worker.php file from php command line. When I test this in normal apache mode, mongoDB works just fine, but when it runs from the gearman worker file I get the error "fatal error: class 'Mongo' not found". Now the Mongo class comes from pecl and the mongo.so extension in php.ini. SO yeah, trying to figure out why a php file run from CLI is different. Does it use a separate php.ini file?
You can check which .ini files are being loaded by the CLI version by doing php --ini. If your PHP was provided by a distro, it's very possible for it to have two seperate .ini sets, one for web-based and one for CLI. You can get the equivalent info from phpinfo() when it's running online as well.
To force it to load a particular .ini, you can use php -c /path/to/file.ini.
Well a simple find / -name php.ini answered that question for me. So yes, there is a separate php.ini file. Where I needed to add the line extension=mongo.so.
It sounds like either you're loading different ini files or you've got multiple instances of php installed on your machine and apache is using a different one. Make the script v.php:
<?php phpinfo();
then try running it from CLI and then viewing it via localhost. EG:
php v.php
and
http://localhost/v.php