Illegal instruction: 4 when executing php artisan migrate - laravel

I am new with Laravel and working on a project to practice myself. I have set up and connected my database and when I try to execute the migrate command on the VS Code terminal, I get the error: Illegal Instruction: 4
I have seen different discussions but was not able to find one with good instructions to solve this.
Most of them were for other programs and not Laravel/VS Code.(also I am a Mac user)
Any ideas on this and how to solve it?
enter image description here

This error seems to occur if you have SSL issues or config issues in the options section.
It may be how the composer runs from a root directory and it cannot find the real path of a SSL certificate.

We experienced this due to an incorrect configuration on Symfony[*] where the the mysql port was set to 33060 instead of 3306.
I think you can get this error if your mysql configuration is pointing to the wrong host/port combination, possibly combined with SSL enabled.
The issue is in the php mysql layer so which framework is in use is not so important.

You are trying outside the project folder you should go inside your project folder
cd YOUR_FOLDER_NAME
then
php artisan migrate

Related

DigitOcean - laravel 8 deployment through Github (error 500)

I deployed the laravel app to digitalocean:
but I don't understand why is it showing error 500??
I connected a github repo to deploy it to digitalocean.
1- I set the build commands to: composer install
2- environment variables are set: APP_NAME, APP_URL, APP_KEY, DATABASE_URL, APP_DEBUG
This is how the repo looks (private)
What seems to be the issue??
I just did check the repo and it seems the vendors folder not there and your build steps look like a typo issue so please run below command
composer install
Still you face the issue then refer the laravel logs for that what went wrong
you also dont have a .env file
maybe copy the .env.example to .env
perhaps follow the instructions on the laravel site for the version you are using.
in your question, you have spelt 'install' incorrectly
turns out there were typos of lower and upper cases in controllers according to the laravel log.
I fixed them and now the site is running. It's weird that these typos didn't trigger erorrs locally..
All You have to do is configure the .env file if u have a .example.env edit the file to .env if u dont have it just try to create one or clone one from another project and do composer install but don't forget to generate a key with php artisan key:generate in the end

AWS Beanstalk Laravel post deploy hooks no such file or directory

I'm trying to deploy laravel app to aws beanstalk, OS is Amazon Linux 2 AMI.
I've setup following files:
.ebextensions/01-deploy-script-permission.config
It contains below code:
container_commands:
01-storage-link:
command: 'sudo chmod +x .platform/hooks/postdeploy/post-deploy.sh'
And
.platform\hooks\postdeploy/01-post-deploy.sh
It contains below code:
php artisan optimize:clear
Upon deploying it fails with following entry in eb-engine.log file
[ERROR] An error occurred during execution of command [app-deploy] -
[RunAppDeployPostDeployHooks]. Stop running the command. Error:
Command .platform/hooks/postdeploy/post-deploy.sh failed with error
fork/exec .platform/hooks/postdeploy/post-deploy.sh: no such file or
directory
This answer is for users who are using Windows to deploy their files to elastic beanstalk.
I found this information after spending 6 precious hours. Probably not documented anywhere in official documentations
As per this link "https://forums.aws.amazon.com/thread.jspa?threadID=321653"
psss: most important that the file is saved with LF line separator.
CRLF makes "no file or directory found"
So I used Visual Studio Code to convert CRLF to LF for files in .platform/hooks/postdeploy
At the bottom right of the screen in VS Code there is a little button
that says “LF” or “CRLF”: Click that button and change it to your
preference.
I don't know for sure but I think you are running the command before the files are even created hence getting the following error.
A while ago I faced the same kind of problem where I wrote migration commands in .ebextension and it used to give me an error because my env file wasn't even created yet hence no DB connection is made so I was getting the error. Hope this will give you a direction.
By the way, I resolved the problem by creating env then pushing these commands through the pipeline.

How to fix this error "Impossible to connect, please check your Algolia Application Id"?

I have everything correct, as written at laravel/algolia websites.
I tried to read lot of documentations and tutorials about Laravel Scout installation, but still can't find solution.
I have everything correct in my settings and also APIs are correct but still getting this error:
Impossible to connect, please check your Algolia Application Id.
I had the same issue (with Windows 10) and found this exception in the stack trace:
cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
I found the solution for the error above in another StackOverflow post:
1) Download the latest cacert.pem from
https://curl.haxx.se/ca/cacert.pem
2) Add the following line to php.ini (if this is shared hosting and
you don't have access to php.ini then you could add this to .user.ini
in public_html)
curl.cainfo="/path/to/downloaded/cacert.pem"
Make sure you enclose the path within double quotation marks!!!
It solved my problem, Laravel Scout is working fine after that. Hope this will help someone.
Apparently on the issue came from on wrong credentials, this can occurs providing the wrong Application ID or Admin API Key. Also the correct way to provide the credential on scout.php is :
'algolia' => [
'id' => env('ALGOLIA_APP_ID', ''),
'secret' => env('ALGOLIA_SECRET', '')
],
And then fill your credentials in your .env file.
I'd recommend you to run php artisan config:clear in case you have cached your configuration (which you shouldn't do in dev env).
Let us know if it solve your issue.
I had the same issue and solved it like this
php artisan cache:clear
php artisan route:clear
php artisan config:clear or config:cache
My assumption is, because Laravel always creates a cache in the config, every time we change some config, there must be another config that is broken or an error due to the cache that was created earlier.
But I don't know for sure.
I share with you my experience.
System was Vagrant Homestead with VirtualBox in Windows 10.
command used in CMD:
php artisan scout:import "App\Post"
command failed with:
Impossible to connect, please check your Algolia Application Id.
Logged into virtual box with vagrant ssh and gave it another try.
That solved my problem.

CurlExeception with Guzzle using KeenIO

I am building a Laravel (5.1) site which uses KeenIO to do some event tracking. Everything went fine locally (on a mac), so I pushed everything up to my digital ocean droplet through forge to start testing on the server. I delegated the keen events to the Laravel queue service for performance reasons. When I ran the queue:listen command I got this strange error.
[Guzzle\Http\Exception\CurlException]
[curl] 77: error setting certificate verify locations:
CAfile: {my_local_file_path}/vendor/guzzle/guzzle/src/Guzzle/Http/Resources/cacert.pem
CApath: /etc/ssl/certs [url] https://api.keen.io/3.0/projects/{project_id}/events/users
I checked the guzzle source code and it looks like this line is where this path is being set inside of Client.php on line 139.
$opts[CURLOPT_CAINFO] = __DIR__ . '/Resources/cacert.pem';
DIR should be referencing the file path of the server though...so why is it still pointing to my local file path on my mac?????
I tried clearing all the Laravel caches and using every other command I could find. This one has me really stumped, guys. Am I missing something super obvious?
I don't know if this is an actual solution...but after running composer update on my local machine a few times and pushing back up to the droplet, everything seems to be working...If anyone could shed light on why this fixed things I'd appreciate it, haha.

Zend Framework 2 Getting Started on WAMP server

I have been trying to follow this tutorial: Tutorial
I can't get past page 2. When I try to run the command:
php composer.phar create-project --repository-url="http://packages.zendframework.com" C:\wamp\www\zendTutorial
I get these messages:
[RuntimeException]...[Composer\Downloader\TransportException]<br>
The "http://packages.zendframework.com/packages.json" file could not be downloaded: failed to open stream: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?
I enabled ssl_module in the Apache modules and php_openssl in PHP extensions and a runtime error window popped up which I didn't read because I thought I would restart the server and everything would be okay.
Then I found out I had to create a private/public key pair so I followed this tutorial: tutorial
But I realized I skipped the step where I have to download WSAS (the 3rd application to download just to get this pig to oink) to export my pk from the keystore and I decided to put on the brakes and ask "really?" Is there a shortcut I can take to bypass all this crap so I can start with the tutorial? I've been at this for the past 3 hours and I am so fed up - it's demoralizing.
Note Another way to install the ZendSkeletonApplication is to use github. Go to https://github.com/zendframework/ZendSkeletonApplication ...
Try it this way. Get git and clone the repository from
https://github.com/zendframework/ZendSkeletonApplication.git
To do this, change in console (cmd.exe) to your workspace and type
git clone https://github.com/zendframework/ZendSkeletonApplication.git
It should create a subfolder ZendSkeletonApplication with the skeleton application inside.
Later when you have your skeleton application project you can run composer as described in the tutorial to get the dependencies.

Resources