I'm trying to get a laravel programming enviroment up to finish my masters' degree project but I can't get this to work no matter how hard I try.
I've followed various tutorials but the last one I've tried has been http://sherriflemings.blogspot.com.es/2015/03/laravel-homestead-on-windows-8.html
and I think I got somewhere but I get the following error trying to initialize vagrant
Vagrant up error:
and I've confirmed that the file C:\Users\Administrator\homestead\Homestead\scripts\homestead.rb is available and permissions are correct.
Also In the error I see C:/Users/Administrator/.ssh/id_rsa (Errno::ENOENT)
but I have other routes difined in my Homestead.yaml
Is there any other way I can run homstead of have a Laravel development enviromet?
What tutorial would you recommend to get this up and running?
You should generate key to make it work. So, you will have two files
id_rsa and id_rsa.pub in your C:/Users/Administrator/.ssh/ folder.
As I totally agree with the previous answer, I wanted to provide some more information about your state.
There is no need to check if the homestead.rb exists at that stage. Because it is already the running code and informing you about the problem that it can't fix by herself.
That is also not a route problem (to tell the truth; the provided information under 'sites' key of Homestead.yaml is not about routes. You are listing the projects inside your homestead virtual machine there. One site per project is generally enough. Like:
-sites:
- map: foo.com
- to: /home/vagrant/Code/Foo/public
Your homestead.rb file is blocked while running because the created virtual machine's operating system needs something to trust your code working using ssh. And one of the ways of achieving that is using a public key - private key pair (also used by homestead). It looks like you don't have a pair. And the script running can't access the public key: AKA id_rsa.
Related
At work we took back our existing store running on Magento 2 from an external development agency. I need to get the project running in local development (with docker).
I familiarized myself with a vanilla project from the official docs and managed to get it running by downloading the vanilla template with composer, granting the proper permissions on files and folder and running the magento setup:install command.
My question is how do one goes when kick starting from an existing (production running) project?
Do I need to run setup:install again? If I do, why?
What do I need to import from production to ensure any content or configuration created via the admin is also running on my local setup? Should I import the complete Database from production?
I know our setup is using more than just php and mysql, but env.php seems to be listing only db configuration and admin url. Where can I get the complete service configuration informations about what our setup uses?
Anything else I am missing to get started with an existing project for local development?
As someone who is running Magento 2 on a local environment myself, hopefully I can shed some light on this.
If you have a direct copy of the live site, you do not need to run setup:install again.
Ensure you have a copy of the entire Magento 2 site (you can technically ignore the vendor folder, as you can run composer install and it will redownload those files, but that's up to you). Also get a copy of the entire database. Magento 2 is notorious for copying the same data to multiple tables so something could break if you don't have everything.
What do you mean by "service configurations" If you are referring to Magento 2 extensions, that data is saved in the database, not the env.php file. env.php is only for server side configurations, such as the DB information, Caching, and things of that nature. On mine, I use Redis for site Cache, so that would be included in that file as well, as an example.
When you first unpack the site to your local environment, run composer update in the directory. This will ensure you have all the proper files installed. If you are going to run a local dev environment, set the mode to development with the following command: bin/magento deploy:mode:set developer. This will allow you to make changes and to view those changes by just refreshing the page, rather than flushing cache all the time.
All queries are replied correctly by Eric. I am also not sure about "service configurations" you have mentioned here. If this is about third-party extensions/services you can check config.php file for this.
Currently I am trying to run a Wordpress repo locally for development. I am not using MAMP pro even though I still have a 9 day trail. I figured since I'm going to be using the free version for now I might as well work with that. I have my Apache & MySQL server running along with the Document Root pointing to my Sites folder where my projectName repo sits. I'm still running off of the default port of Apache 8888.
After I start the servers, I open WebStart and import my DB into phpMyAdmin. Everything works perfectly fine and the copy of my db gets imported. I then make sure that my wp-config.php file has the appropriate settings to access this db. I then click on My Website. This pulls up the content of the website. However, it does not pull in any of the assets(imgs/js/css). I receive the following errors in the console:
Failed to load resource: net::ERR_EMPTY_RESPONSE http://projectName.dev/wp-content/uploads/2016/09/logo-footer-1.png
Failed to load resource: net::ERR_EMPTY_RESPONSE http://projectName.dev/wp-content/themes/projectName/images/circle.png
And so the list goes on and on for pretty much every asset the project could possibly have. Now configuration is NOT my strong suit, and at this point I am at a loss of what could possibly be happening. Awhile ago I did follow a tutorial on how to setup my files so that I can access them in the web browser by simply typing the name of the project with the domain .dev, example: projectName.dev. I started having issues with this after upgrading to OS Sierra and it no longer works. Could this possibly be the reason as to why it is looking for these assets in the projectName at the .dev domain?
I apologize if this does not make sense. I am willing to provide anyone with any information on this as I need as much help as possible because I still need to level up my configuration skills. Let me know if you have questions.
The images and other assets are referenced with an absolute filepath (i.e. the URL of the server on which you first set it up). This has to be changed in all database entries. There are tutorials for this on the net, but the most simple version is to open the sql file in an editor and search & replace the general URL part in the complete database.
Be sure to keep a backup of the file - that might not work on the first try...
A year ago, I decided to go with codeigniter instead of laravel, because codeigniter prooved to be easier to setup. I am now preparing for my next project and it seems as if codeigniter is now obsolete (at least most of the people seem to recommend laravel over codeigniter).
Now to my problem: I use a virtual ubuntu machine for developing web apps so I have a dev environment similar to the production environment (this helps me to avoid some problems (especially case-sensitivity...;)))
I installed composer and laravel and created a new laravel project named "quickstart" in /var/www/quickstart. I then followed their "getting started guide" (here: Guide). So far everything worked.
But here come the problems:
I have two other web applications in /var/www, so when I enter the ip of the machine I see the 3 directories.
Issue 1:
Normaly I'd expect that as soon as if I click on the "quickstart"-Directory in my browser, the webapp would get displayed, but I have to click a second time on "public", and then the webapp is displayed.
Issue 2: Of course, the links on the page are wrong too, because they reeer to (for example) "/task", which can't be found on the server.
The problem is that I'm not really experienced with apache configuration. I suspect it has something to do with VirtualHosts, but AFAIK you need to have root access to configure virtual hosts, and I do not have root rights on the dev environment.
Could you point out a way to me how I can make laravel work in a subdirectory in a way that I can just move the files and folders to my hoster as soon as I have finished the project? I'd like to then change only one file, and not all paths and URLs in all files ;)
Regards,
Christian
Thanks to Bogdan, I was able to figure it out. My hoster allows symlinks, so I did it like so:
I put the laravel installation in
/srv/web/quickstart
(quickstart is the name of the project). I then created the following symlink:
ln -s /srv/web/quickstart/public /srv/web/www/public
The document root of the apache is configured to
/srv/web/www/public
After that I just got a blank page. That was because I forgot to set the correct permissions on the storage-folder. So I set the following permissions
chmod -R 777 /srv/web/quickstart/storage
This is fine for a development environment. For production I'd recommend to only allow the webserver-user to write into that directory.
And voilĂ : Everything works!
Thank you for your help bogdan.
Christian
I want to deploy a Laravel 5 project to shared hosting from my localhost but I am facing so many problems. I have uploaded all files in a subfolder of my shared hosting (PHP 5.5) and when I try http://domain.com/subfolder/public its showing me 500 error. I check the laravel.log but found nothing, set the storage/ to 777 but still no changed (showing last error from localhost).
I also check .htaccess and it seems good. I search a lot and try so many thing but still facing same problem.
Now, my shared hosting give access of SSH so I have installed a new Laravel project. Then copy my edited and added file except vendor from my localhost to Hosting. Then I update the composer and dump-autoload, Now my application is working file.
But I am not sure about the process I did. Is it the right way (I don't think so)? Please let me know what was the problem of directly uploaded file and is there any problem if I use second system for my production app.
There are chances that your route cache is messed up. It is safe to artisan route:clear, artisan cache:clear, and artisan view:clear before uploading your files to ensure that no compiled script left - which usually tied to specific path.
But it is unclear, could you share your stacktrace for your error (and if possible share where your .htaccess file and it's content)?
sorry i can't comment, need higher point. However, by looking at your statement that it works by moving your files (controller, views, public, etc) but not the entire project, i believe clearing caches is the best to try.
As for the deployment of laravel project, there are methods suggested in laravel.io. It is not a good idea to expose your entire laravel files in public folder. Nevertheless, there are many ways to deploy it.
I know it's a little late but you need to either:
1. Make laravel's public folder the root folder of your domain or
2. Make a sub-domain and point the root folder to your projects public folder. The disadvantage with this is that your sessions cannot be connected directly to your main domain's sessions.
I've been working on a project on my local machine (running OS X with Cake server) using CakePHP 3 Beta. Sometimes I copy this project to a remove test server (running Ubuntu with Apache).
Last time I copied all the files to the remote server, Beta 2 was the newest version, and the site was running just fine on both machines.
When Beta 3 came out, I updated my local project and continued working on it on the local machine without running into any issues.
Today I copied the whole project to the test server, just as it is on my machine (adjusting database configurations, of course), but something weird is happening this time:
When I access URLs like http://www.example.com/controller/action I get a Missing Controller error, as can be seen in the screenshot below:
I've been following the conventions as seen on the documentation, so my controller is the class UsersController inside the file UsersController.php
But if I access http://www.example.com/Users/action, for example, it just works.
Keep in mind that the exact same files work on my local machine using lowercase URLs, so it isn't just some typo or misplaced file.
This happens for all my controllers.
Should I now follow the naming conventions the error page suggests me and user lower case first letters on all my controllers?
Is this a bug or am I doing something wrong?
If you need any other information, feel free to ask.
Thanks for helping me out!
Best regards,
Daniel
You are missing appropriate inflecting routes that would turn users into Users in order to match the filename UsersController.php, this is evident from looking at the error message which says usersContoller is missing.
It works on your local machine as the default OS X filesystem is by default case-insensitive, unlike the one in Ubuntu, which is case-sensitive.
In case you have updated the core lately the RouteBuilder::fallback() call that is present in the app routes by default may be missing the InflectedRoute argument, which wasn't necessary before.
https://github.com/cakephp/cakephp/commit/5af6464a49204f873aeac52024d295787809822a#diff-37dbf1f85d9888de3ac3c50006f2704f
So, check your routes, and update your app template if necessary.
https://github.com/cakephp/app/commit/4719b42f9db0d80b3dd22edc6a4476566dbb0215