Having trouble configuring Laravel - php

I'm using Laravel with intellij and whenever I run my project this is what it looks like in the web browser
I'm not sure if I set up Laravel correctly on intellij. I set it up for XAMPP because I thought that was the problem however my pages are still looking like the image above.

probably it's not laravel problem. Maybe is better to setup local server in right way. You can try:
php artisan serve
under laravel root dir and then open in http://localhost:8000 in browser

Those icons are trying to use php built in server and may not be configured to match your laravel project. I get the same thing as you with localhost:63342 when clicking web browser preview icons in my Symfony project. I just configured phpStorm preview icons to load based on my web server root.
When using laravel, trying to load your blade views directly will most likely run into issues. Your request is not being mapped to a route/controller for it to be properly handled. For my symfony project and after configuring phpStorm, i get sent to app.dev/app/Resources/views/test.php, which is not a valid route (proves point of previous sentence). You will most likely get the same issue in your laravel project.
You can configure your phpStorm preview icons to load to your localhost:8000 / app.dev or whatever you may have set your app host to.
Follow the below phpStorm articles if you want to mess with this some more.
https://www.jetbrains.com/help/phpstorm/2016.3/working-with-web-servers-copying-files.html
https://www.jetbrains.com/help/phpstorm/2016.3/creating-a-local-server-configuration.html

Related

Laravel app downloading all assets again on every route request

I have a strange error in my Laravel(5.6)/app. Whenever there is any route request in the app, all css, js, bootstrap and icons files reload all over again in the browser. I'm debugging this app from last 2 days. And I have no clue what's going on.
I worked on this project a few days ago and it was working fine then I started working on some other project and after a couple of days when I worked again on this project to add some new features, it is behaving like this. Whenever I request any route in the app, all the assets download and load again in the browser. I didn't provide any code sample here because I don't know where the error might be.
If there have been an error in some particular file then that particular route would have behave that way. But all routes reload all the assets all over again. So I just want your opinion is this ever happens to you and how should I tackle it?
If you wanna recreate this project then here is the GitHub link. Git Repo . Recreating this project is very easy. Just create a database. run migrations and then seed the database. For sass and js ,run 'npm run dev' if needed.
Update: Solution to this problem is, don't use buit-in server of laravel, it sucks. Use any php development stack like xampp, wamp etc. and it will work fine.

Zend Skeleton framework not displaying using Php

I am working through the ZEND Skeleton installation described here
I am running it on an Apache server (in my home network) on Ubuntu 16.10
When I switched off the server yesterday the installation was working correctly, and displaying the expected Zend pages, as per the documentation.
To clarify - I need to know why the previously working installation on Apache has stopped rendering the pages in Php
I bookmarked these links in my browser. When I booted the server this morning and went to those links I get the result shown in the image below:-
Local browser URL (192.168.1.201/zendtest1/)
Zend Skeleton index
It appears that in switching off and on the machine the Zend installation has stopped accessing Php to render out the page in the browser.
Does anyone have any experience of this, or any suggestion as to what may have occurred?
The document root of a ZF2/ZF3 project is public, so you should use one of the strategies exposed in the quick start to either:
set the proper document root on your server
use the php development server
use vagrant and a VM
use docker
You could also access the address with typing /public at the end, that will probably not work at some point for your assets though. Then you will need to fix your basepath.

Problems when moving Symfony3 app from dev to production server

I've created a web application using Symfony 3. In the development environment, I always use Symfony's built-in server and just use the command "php bin/console server:run". The app can then be accessed via "localhost:8000".
I've also defined routes using annotations in Controllers such as "/", "/about" etc. These pages can be accessed via "localhost:8000/" and "localhost:8000/about". Other links on the page that point to routes like "/contact" or "/users/1" also work perfectly. They will link to "localhost:8000/contact" and "localhost:8000/users/1".
Now, I move my application to the production server. On the production server, Apache2 is installed and some other people have developed Symfony applications on it. Their apps can be accessed via url like "example.com/apps/app1/web/app_dev.php" and the links on their apps have been pre-appended with "example.com/apps/app1/web/app_dev.php" automatically. So when the user clicks a button that links to "/contact", the link will direct to "example.com/apps/app1/web/app_dev.php/contact".
Now, when I move my application named "app2" under the "example.com/apps/" directory, I can visit "example.com/apps/app2/web/app_dev.php" without any configuration and see my homepage perfectly. Apache can automatically pick up my code. However all the links on the homepage will direct to "example.com/contact" instead of "example.com/apps/app2/web/app_dev.php/contact".
Can anyone help me with this? I'm pretty new with Symfony and Apache.
Or perhaps I've done the migration from dev to production environment in a totally wrong way? Any new ideas or proper way to move Symfony3 application to production server?
Thanks a lot!
Do you have apache configured correctly? You may need to have a virtualhost configuration added to the server. You can find out about it on the Symfony site for the specifics.
I finally solved the issue. I should use href="{{ path('about') }}" instead of href="/about" in all twig templates. Thanks everybody!

Laravel and Angular url prefix issue with apache

I created an app with Laravel and angular. On development The app works good in php artisan serve in localhost:8000.
if i copied the project folder and paste in www of lamp or wamp then i need to use localhost/projectname/public. To load the css and js i use <base href="/projectname/public/"> in my main html.
But my urls and angular templates still miss the projectname/public. if I click a url it goes to localhost\url. How to prefix url in angular? or is there another way to work this out?
There are 2 ways to fix this.
First is laravel homestead. This is perfect for laravel projects. for more information about homestead go here
The other option is to setup a virtual host on your wamp server. For more info about this go here

Trying to run a Symfony project on my computer

I'm trying to run a Symfony project that I cloned from a GitHub. I've never used Symfony before but I'd like to run the project.
I read you needed to run frontend_dev.php so I ran that in to my browser:
C:\Users\Computer\Desktop\Project\WebInterface\web\frontend_dev.php
But just got a blank page with some PHP on it. I believe I may have to set up a web server but I'm not sure and figured I'd ask here first.
If I wanted to run the project from my computer, would I just download an Apache server and drop it in the root directory? What variables and files would I need to change to get it working properly? Do I need to forward any ports?
Symfony 1.x branch is not supported anymore. Use Symfony 2.
Anyway, concerning your question: here is the doc for 1.4: Day 1: Starting up the Project

Categories