Vagrant + VirtualBox + Dashbrew = not working - php

I am new to PHP. Coming from the Java - Servlet would, the whole idea of installing virtual machines to do local development is a bit confusing. I am familiar with virtual machines, just not using them for development purposes.
I attempted to use Homestead from Laravel (since this is the framework I'll be using). I have attempted it probably 10 times. Each met with failure. I also attempted to use PuPHPet however I was met with a "File not found" in my browser upon loading it. No matter what tutorial I follow I end up with some kind of issue.
Now I am trying Dashbrew. A new Vagrant build that is supposed to be simple for beginners. I went through the installation without a hitch. However upon trying to navigate to the dash board for the application (dashbrew.dev) nothing happens. Chrome shows that it is trying to request information, evident by the loading wheel on the tab spinning backwards.
What do I need to do to get this working?
I have MAMP working with Laravel so I could use that. But I wanted to familiarize myself with Vagrant a bit.
If you need any additional information, just leave a comment.
EDIT: Here's what my hosts file looks like...
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
## vagrant-hosts-provisioner-start id: 971cff21-8d99-4aa7-b9b2-ff03403af9f8-0
## vagrant-hosts-provisioner-end
## vagrant-hosts-provisioner-start id: 9b67e862-ea30-4232-9c4a-4c1eb45d8464-0
## vagrant-hosts-provisioner-end
## vagrant-hosts-provisioner-start id: c93caf02-00af-4df0-9d9d-bdaf3c3f34eb-0
## vagrant-hosts-provisioner-end
## vagrant-hosts-provisioner-start id: c83f58db-fd9d-47f1-9aad-685f3e97c6a4-0
## vagrant-hosts-provisioner-end
This is what prints in the terminal up running vagrant up

I also attempted to use PuPHPet however I was met with a "File not found" in my browser upon loading it. No matter what tutorial I follow I end up with some kind of issue.
This is because you probably didn't have an index file in the vhost's directory.
For example, if your vhost foo.dev's document root is /var/www/foo.dev/public, going to http://foo.dev would be hitting your VM's /var/www/foo.dev/public directory, looking for an index.php file.

I had the same problem. chmod the dashbrew directory to 777. I also changed ownership of the dashbrew directory to my username.

Related

Docker Compose LAMP stack not serving index.php

I'm doing some freelance work and the people I'm working with use a LAMP stack with docker. I've never used docker before and I am having some issues. They all use Macs, while I have windows so they have not been able to help me. I've been working on this on and off for the last 12 hours and cannot get my index.php page to show up. I'll go over the steps I've taken so far and provide the file structure.
I was working in windows powershell
Installed Docker Desktop from here
I followed the steps here to create a new docker-machine
2a. The command I ran was 'docker-machine create -d hyperv --hyperv-virtual-switch "DockerVS" default'
I then ran 'docker-machine env'
Then I ran '& "C:\Program Files\Docker\Docker\Resources\bin\docker-machine.exe" env | Invoke-Expression'
Then, while in the same directory, I grabbed the project from GitHub, changed directory into the location with the .env and docker-compose.yml files. then ran the command 'docker-compose up -d'
At this point, I was supposed to be able to run 'docker-machine ip default', paste that IP into my browser and see the page. That is what all my coworkers had done with their macs, at least. If it matters, the IP is 10.0.0.117
Now something is definitely running there, it attempts to get the "index.php" file, but it returns "File not found" to the browser. The page is also running phpMyAdmin, so if I type in 10.0.0.117:8080 to the browser, I see this page. So I'm confident that I'm on the right track, I just assume I've done something minor.
So the solutions I've attempted. My first guess was that I needed a port similar to :8080 that make the php page pop up. I ran 'docker-compose ps' and I tried the ports 443, 3360, and 9000 which I all see here:
Naturally no go. Next I tried various paths, and then tried all the aforementioned ports and paths together. The paths I tried were
/index.php
/index.html
/index
/index.htm
The above four with /public-html in front
The above with /LAMPProject in front
The file structure looks like this:
So all in all, that is what I am working with. It's a fairly simple docker LAMP set up before I start working on bigger stuff. Any advice at all would be very welcome.
I think you should map your phpmyadmin port to another one like 8081 instead 80, apache container mapped to 80 too.

XAMPP Ignores Document Root; Redirects to 'localhost/dashboard'

I have two computers, a laptop & desktop, with seemingly identical setups:
Running local server via XAMPP (for Windows, v 7.0.13)
Laravel-based project
In httpd.conf, DocumentRoot is set to D:/xampp/htdocs/site-folder/public
On the laptop, everything works as expected; visiting localhost in Chrome hits Laravel's public folder and the application fires up like it should. On the desktop, however, I get redirected to localhost/dashboard when I visit localhost. Typing out the full address (ie, localhost/site-folder/public) works, but all links are broken, as they expect the site-folder/public directory to be the root.
My assumption—and I hope I'm wrong about this—is that there are a lot of potential configuration settings that might be off. Any ideas on what might cause this, or how to go about debugging? Thanks in advance for any thoughts/suggestions!
This turned out to be the result of middleware I had in place, which required a secure connection. The middleware worked fine/as expected, but the httpd-ssl.conf file needed the updated project path. In case somebody else is experiencing a similar problem, try this:
Find the comment # General setup for the virtual host
Change DocumentRoot to the same project path used in your
httpd.conf
Appreciate all comments on the original question!

CakePHP 3 Apache does not find Views

I am just starting to work with CakePHP3.0 and while following the 'Quick Start Guide' I came across a step that has me stuck.
The section labeled DATABASE CONFIGURATION has me create some MySQL tables (I copy pasted from the site) and then run the commands: bin/cake bake all bookmarks, bin/cake bake all users, and bin/cake bake all tags.
After running those three commands several files have been generated; the Models and Controllers associated with the tables I just created. However, the Views have not been created...By the way I am using Ubuntu 12.04
As suggested by the tutorial I checked my apache2/mods-enabled directory for the rewrite.load and it is there.
Has any else experienced this issue?
It is likely that I am making a simple mistake
This is the output when I ran bin/cake bake all bookmarks the first time:
As the tutorial suggested, if I receive a 404 page not found error I should make sure that mod_rewrite is enabled for apache2, also I noticed that it says to use http://localhost:8765/bookmarks since my web server is configured on port 80 I have been ignoring the port # suggested by the tutorial.
Here is a screenshot of my apache2/mods_enabled/: (rewrite.load is present)
Lastly, here is the data source that I have configured in /config/App.php:
It is beginning to appear that the problem is with my Apache configuration and the rewrite rules. I will investigate into this further.
Turns out that I was initially confused about what CakePHP3 was supposed to create and realize now that it was running as expected (see question above for output). One the proper DocumentRoot is set, if rewrite is not set up properly navigating to you page may begin a download of the file you mean to view instead.
The real problem was with my Apache configuration. These are the steps I followed to configure Apache 2.4 (after reinstalling Apache):
Add the new DocumentRoot in /etc/apache2/sites-available/000-default.conf and in /etc/apache2/sites-enabled/000-default.conf
Enable mod_rewrite: a2enmod rewrite
Restart Apache: service apache2 restart
After enabling rewrite your /etc/apache2/mods-enabled/ may look like this(notice rewrite highlighted):
Problem has been resolved. Thanks to this post!
#user1843159 - Thanks for pointing me toward the direction of Apache Configuration.

Not able to open localhost/phpmyadmin with nginx

Before starting I installed XAMPP. Now am trying to use nginx instead of Apache. For that I did the following steps:
Installed nginx (1. c:>cd nginx 1.8.0 2. start nginx). installed successfully.
Now am not able to load php files and localhost/phpmyadmin.
There are a handful of reasons for this behavior. Could you run through some of the following options? If they don't outright solve the issue they should provide greater context to help us resolve this.
What happens when you attempt to pull up the "localhost/phpmyadmin" website? If it attempts to save a file then nginx may not be properly configured to interact with the PHP interpreter to process the PHP code and provide it to the web server (nginx).
In the directory of your nginx installation there should be a "sites-available" directory containing a plain text "default" file. In this server you should find a declaration of a server block which, in turn, contains an identifier for the document root referred to as "root." Does this point to the directory containing the phpMyAdmin source code?
Are you able to pull up just "localhost"?
If option 3 is unsuccessful you can run something like "netstat -na | findstr /c:':80'". This will tell you if nginx is actually listening on port 80.
If option 3 is unsuccessful but option 4 shows results, you may want to pull up the listening IP address (or your assigned/static IP if it shows 0.0.0.0:80) in your web browser. For example: "192.168.1.100/phpmyadmin"
I hope this triage helps find the underlying cause of your issue.
I open the apache with Xampp from the IP direction and it works ok, that is in localhost it not work and in IP direction work fine.

Symfony project on CPanel account

For a bit of history - this is the first time I attempted to setup a test symfony project, just to have a play with it.
The symfony project was setup in the following location:
~/symfony_projects/myproject/
Now, with cpanel, the httpd.conf is automatically generated (but I'm sure you knew that), and it uses ~/public_html/ as the web root and splits it up by domain name (virtual hosts) - so for this example, lets say it's ~/public_html/example.com/.
So the symfony project is all setup now, the next problem was trying to figure out how to setup the server so it points to the /web part of the project - this is where I found it tricky.
I tried doing the following:
ln -sf ~/public_html/libs/Symfony/data/web/sf ~/symfony_projects/myproject/web/sf
ln -sf ~/symfony_projects/myproject/web/* ~/public_html/example.com
That unfortunately didn't work though. When trying to go to http://www.example.com it just gave me a 500 error.
Any other options here? Taking into consideration that I cannot modify the httpd.conf. And even if I could, it's auto-generated and would rather not (in cpanel).
* Update *
I just tried what was suggested by #Dan, but with the same issue - getting HTTP Error 500 (Internal Server Error). So, it looks like something else is the issue.
I checked my error_logs but didn't see anything useful there. Is there any other way I can check to see what the problem is?
* Another Update *
Just tried http://example.com/frontend_dev.php and it works perfectly - gives no errors at all, which makes it kind of hard to debug the production controller.
So the Development controller works flawlessly and the production is spitting out the 500 error - any ideas? :/
I just copy everything out of web/ (including css/, js/, etc. subfolders) one level higher, then edit the index.php/yourapp_dev.php files' require statements to reflect the change in path. Add some rewrite rules to forbid direct access to the rest of the directories and you're all set on servers where you can't change the document root.
If you look at the http.conf virtual host entry for the symfony project the last line in generally a commented out include statement. If you uncomment that line you add any extra virtual host configs you need into that file. Then just restart apache. Anything in the file will then be appended in place of the include statement.

Categories