New Installation of SilverStripe 4 InjectorNotFoundException - php

I'm using Vagrant/Homestead/Virtualbox ~ Vagrant version 2.2.10 | Homestead 10.1.1 | Virtualbox 5.2
I'm running the SilverStripe installation on PHP7.4 and my PHP CLI version is also PHP7.4
Following the SilverStripe installation instructions I've ran the following:
composer create-project silverstripe/installer client-folder
When I load up my installation for the first time I get the following error: (I've censored out the client's name)
Weirdly, even though install.php is no longer included with the installed, I got an old install.php file and ran it and the install.php page loaded up perfectly. When I then ran the install script it gave me the error above again.
I've gone through and made sure all the required extensions are installed.
Could anyone advise on how to fix this please?

I've had a look at this. I tried to destroy my vagrant box using the 'vagrant destroy' command but it didn't work.
I ended up opening up the Virtual Box UI and I then destroyed my Vagrant local machine using that interface.
Afterwards, I ran Vagrant Up to create the 'new' box for the 'first time'.
Silverstripe now loads up perfectly well. As a side, Laravel also didn't work and now works.
In short, it was a problem with my local machine and not SilverStripe.

Related

How Can I install OctoberCMS with PHP Version 5.x?

I have Windows 10, Xampp installed with PHP Version 5.x and I want to install OctoberCMS with Installation wizard https://octobercms.com/docs/setup/installation but I noticed that OctoberCMS requires PHP 7.0 or higher to achieve this and I have version 5.x.
So How can I install OctoberCMS with PHP Version 5.x ?
OK Guys, Eventually I have come up with the solution to install OctoberCMS with PHP Version 5.x.
Remember, these steps can be varied based on your operating system and the things which you have installed in your system.
First go to OctoberCMS Change log -
https://octobercms.com/changelog and find Build 419 has the php
version 5.x support.
Then go to OctoberCMS release list - https://github.com/octobercms/october/releases and click on the version you need to install which is v1.0.419. Install the zip to the root of xampp/htdocs and extract the folder.
Then inside the same folder which extracted, run this composer install.
After this, run php artisan october:env .. You can run C:\xampp\php\php.exe artisan october:env if you are having an error php is not recognized as an internal or external command.
After php artisan october:env, .env file is created. There you need to modify your database settings like database name, port (put 3306 for localhost etc) by opening this file which will be in same folder.
Then run php artisan october:up or C:\xampp\php\php.exe artisan october:up. It will create database tables and your admin user will be created with User: admin, Password: admin (You can change this after logging IN). And backend url will be something like http://example.com/backend.
Once its done, you can cut paste all your extracted folder files to root .. like from C:\xampp\htdocs\youproject\version419 to C:\xampp\htdocs\youproject\.
Hope this helps.

Using Laravel Homestead for PHP5.6 and PHP7 projects

Here at the office we are using Homestead as our local development environment. All projects we had so far were made in PHP5.6. Now we have a new project and we are going to use PHP7. I can't run PHP7 in my current PHP5.6 homestead machine. How can I achieve to run PHP5.6 and PHP7 projects? They do not have to run at the same time, so I if it's possible to change the Homestead.yaml to use a newer version, that would be fine.
What I have tried already was to run vagrant box add laravel/homestead --box-version 1.0.1. This added the 1.0.1 box but when I added version: 1.0.1 to my Homestead.yaml and started vagrant the PHP version was still on 5.6.
In case people find this post - the answer has changed.
If you run Homestead v6 or above - you automatically get multiple PHP versions installed by default.
In your Homestead.yaml file you can set the version:
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
php: "5.6"
In addition, you may use any of the supported PHP versions via the CLI:
php5.6 artisan list
php7.0 artisan list
php7.1 artisan list
Check the Laravel docs for more info: https://laravel.com/docs/5.4/homestead#multiple-php-versions
The latest Laravel-Version with Homestead including PHP 5.6 is Laravel 5.6. See https://laravel.com/docs/5.6/homestead for details and installation instructions.
Use the following commands during installation to get this Homestead-Vagrant-Box:
vagrant box add laravel/homestead --box-version 6.4.0
git clone https://github.com/laravel/homestead.git .
git checkout v7.20.0
This Homestead-Version supports PHP 5.6 to 7.3.
(More details in german: https://blog.dmr-solutions.com/blog/homestead-vagrant-box-mit-php-56)
Found a solution! I followed this tutorial. I can run a PHP 5.6 and a PHP 7 Homestead. The only thing I had to do (I already have a PHP 5.6 homestead configured) was:
Clone the latest homestead version in a Homestead-7 folder (or a different name) by running git clone https://github.com/laravel/homestead.git ~/Homestead-7
Go into this directory and run bash init.sh and answer no to all questions.
That's it! You might have to upgrade your vagrant (mine was too old) but that's easy to do by just downloading the latest version on https://www.vagrantup.com/downloads.html (Do not forget to run vagrant provision in Homestead-7)
I like to add to Laurence answer.
After adding php5.6 to Homestead.yml, you cannot simply do "vagrant up --provision". It will not work. You have to actually destroy the vm by running command "vagrant destroy" and recreate back the vm.
So before destroying the vm, better to backup every database you have in there. I do this by dumping all the sql in Code folder. Later after I run the command "vagrant up" I can simply ssh to my vm and go to mysql and run "source dump.sql" in mysql command line again.

Installing multiple Laravel homestead environments

I was wondering how I would be able to run multiple versions of homestead without having VirtualBox crash.
I am currently running a default installation of the laravel homestead, but I need to install another older version, the reason is that in current version 0.4.0 the mysql server is 5.7 which is fine, but i need another environment with 5.6 because i have an old project which requires 5.6, so homestead version 0.3.0 would be fine.
Just to be clear: I know how to run multiple sites. That is not the issue. I just want to run a second, custom version of the Laravel Homestead Vagrant box, while still having the possibility to run my normal one.
Details: i managed to add both versions. Output of:
vagrant box list
laravel/homestead (virtualbox, 0.3.0)
laravel/homestead (virtualbox, 0.4.0)
so version 0.4.0 is running fine, now how i can run 0.3.0 ?
Thanks in advance!
Ok i managed it.
I will post the solution for those who faced this issue, because I was not able to find a step by step guide with a homestead related instructions.
Without too much theory the steps are:
Decide which box version you need from here (https://atlas.hashicorp.com/laravel/boxes/homestead), in my case it was 0.3.0 and run
vagrant box add laravel/homestead --box-version 0.3.0
Find on github the propper release of homestead (https://github.com/laravel/homestead/releases) in my case it was (v2.1.8)
and download and extract it to a directory for example Homestead2 in your home folder
Inside Homestead2 directory find scripts/homestead.rb file and edit it.
find lines
config.vm.box = settings["box"] ||= "laravel/homestead"
config.vm.hostname = settings["hostname"] ||= "homestead"
between them add line, in my case :
config.vm.box_version = "0.3.0"
you can also rename
vb.name = settings["name"] ||= "homestead"
if you wish
from within this directory run vagrant up
after this you can use it as usual.
I hope this helps somebody.
There's an option for running a box with version in Vagrantfile.
In your case you need to add box_version to your Vagrantfile similar to this:
Vagrant.configure('2') do |config|
// This line
config.vm.box_version = 0.3.0
end
You can check it out from documentation.

Homestead Installed PHP7 but I need PHP5

Homestead randomly stopped working for me, so I tried to remove the whole thing and reinstall, but it's not gone well.
I have it "running" after a day and a half of muddling my way through various issues. However, for reasons that I cannot understand, my Homestead box is now running PHP 7.
The instructions I was following had optional options for installing PHP 7, but I intentionally skipped that because we are on PHP 5.
For the life of me, I can't figure out how to fix this. Things I have tried:
I have destroyed and reinstalled the box multiple times.
I have deleted the VirtualBox box multiple times and redownloaded it.
I tried installing v0.3.3 of the box based on one suggestion. (I also updated the homestead.rb script accordingly.) At one point, something failed during the install process with php7.0-fpm: unrecognized service and the configured sites were returning 502 Bad Gateway errors.
After reinstalling with v.0.4.0, it has started "running" as I described (serves the sites as expected, etc.), but with PHP 7.
Searching for solutions has persistently led to a dead-end.
I'm just a dummy front-end developer. :) Laravel, Vagrant, Homestead, all this stuff makes my head hurt. I just want this to work again so I can go back to my actual work. Any advice or alternate avenues of pursuit for researching this problem would be appreciated.
I've been through this issue too and I solved it by installing an old homestead box v0.3.3 and I've used an old release of homestead installer, so I suggest that you remove your current box v0.4.0 and delete your homestead folder then do this:
$vagrant box add laravel/homestead --box-version 0.3.3
and then download an older version of Homestead installer from git, I'm using v2.1.8 it works fine.
Enjoy php 5.6 :)
I had a similar problem where I tried to upgrade Homestead to the most recent Homestead 7.0 box and configure it to run PHP 5.6 instead of PH7, which various sources said was possible via adding a line to the .yaml file specifying the PHP version.
sites:
- map: myproject.local
to: /home/vagrant/Code/craven/public_html
php: "5.6"
What actually happened when I tried that was that I got a 502 CGI gateway error. Here is a summary of the steps I had to take to fix it:
1) SSH into the Homestead virtual machine.
ssh vagrant#127.0.0.1 -p 2222
Taking a look at the nginx error log in /var/log/nginx/ reveals that the PHP 5.6 files the server is looking for don't exist.
You can get confirmation of this by having a look at the executables.
ls -la /usr/bin/php*
2) To install PHP 5.6, run
sudo apt-get update
sudo apt-get install php5.6-fpm
You can confirm that the php 5.6 service is running via the command
service --status-all
3) Once all this is working, refresh the web page for your site and it should now work. In my case, because I was running a Laravel 4.2 site, I then to install Mcrypt:
sudo apt-get install php5.6-mcrypt
4) In order to get my mysql database up and running, I also had to install mysql.
sudo apt-get install php5.6-mysql
And of course after all that, I had to re-import the database contents from the file I'd exported before upgrading the Homestead box.
Note that if you ever destroy and recreate the Homestead box, you will need to repeat all these steps again.

Magento 2 installation, redirect 404 issue

I am facing a redirect 404 issue while installing Magento 2.
here are the steps i followed
1 - git clone this repo
2 - composer install in the root of the project
3 - composer install in the setup folder
4 - Enabled php_intl extension
5 - Created a virtual host magento2dev.com
Now when in browser, i run http://magento2dev.com This redirects me to 404 http://magento2dev.com/setup/en_US/index
Nothing is displayed in log ...
Using version alpha95, and now tried alpha96 But same problem.
any suggestions ???
Please install composer under root/home directory and then copy the composer.phar to user/local/bin directory so that it can be accessible from everywhere (assuming you have Ubuntu or Linux).
Right now, due to the unstable web interface of the installer, it is recommended to use CLI instead.
Here is a described sample installation.
Installing Magento 2 has always been an issue for me too. But it seems like using Docker is one of the best solution in my case. I ran a container which has a pre-built Magento 2 with all its system requirements.
We have lots of different docker images for Magento 2, try it out.
Sample Repo:
https://registry.hub.docker.com/u/ilampirai/docker-magento2/

Categories