I have a laravel project deployed in Heroku, in my Laravel project i have a php script i made to receive json, my php script is in public folder, when i use php artisan serve to serve the project, the script is accessible with no problem through the following url:
http://localhost:8000/receive-alert/api/historique/create.php
My problem is when i deploy my Laravel project the url isn't accessible anymore:
https://gestioncapteursincendie.herokuapp.com/receive-alert/api/historique/create.php
I found the solution, the folder in which my php script (receive-alert) was a repository of its own which is why heroku for some reason didn't recognize it, it works fine now.
Related
I am using Vue js with Laravel in large application for better user experience. Used API call to communicate Vue js front end with Laravel Backend. It's working fine when I use command prompt to execute the application and the commands are "php artisan serve" and "npm run watch".
As I need this to be executed in Live Server, I have renamed "server.php" to "index.php" then moved ".htaccess" file from public folder to root folder. When I execute this in browser "http://localhost/projectname" it's not working but when I use Laravel without vue js its working fine.
Can anyone please help me in this. Thanks in advance.
I developed application in laravel 5.2. I was using the Virtual host on local and pointing publice/index.php easily.
But on production why we need to using the put index.php & all stuff out of public folder. Is this best practice to deploy on production?
I copied whole in project folder and public folder stuff copied on the root(public_html) of server.
I changed the index.php accordingly and its working fine.
require __DIR__.'/project/bootstrap/autoload.php';
$app = require_once __DIR__.'/project/bootstrap/app.php';
Issue is When i use auto deployment tool, It pushes whole code in project folder. Every time I move assets by ssh from project/public/assets to root/assets manually.
Main Issue
I am also facing issue, saving profile picture in assets folder. But it save picture in project/public/asset instead it should in root/assets. I am really confused on this issue too.
Advise me
Please recommend me the best practice, where should i keep public folder stuff and how to manage auto deployment.
Can we keep index.php inside public and point directly index.php here. In this way auto deployment work fine.
Issue in after deployment commands
I am using DeployHQ.com to deploy my code. It execute ssh commands, but unfortunatly my command doesn't work because artisan file is inside of root/abc/project folder. I dont know where this shell execute commands. or How to point project folder directly to execute these commands.
Bitbucket webhook return 422 error code
I am using bitbucket webhook on approve event. I have given it deployment url and auto deployment is switched on. Hook triggerred as well, but it didn't deploy any thing, It shows error code 422 and error "Could not decode the deployement".
The index.php file should be in the public folder. Everything else should not. Your web server should be configured to point to this directory.
The index.php file bootstraps the Laravel framework. The framework files should sit in a directory outside of the publicly accessible folder. This is usually in the directory above the public/ folder.
You shouldn't work around your deployment tool. It should be configured to maintain this directory structure. Once there is no confusion as to where files should be pushed, you can begin to solve your other path related deployment problems. To avoid future pain, I'd recommend setting up your dev environment as close to production as possible.
I am pretty new in Laravel and I am finding the following problem.
I have put my application in this folder:
C:\xampp\htdocs\HotelRegistration\
Starting it via the statment:
php artisan serve
it is correctly started here: http://127.0.0.1:8000
For some reason I need to run it with XAMPP Apache server instead the one provided by php artisan serve
So I started Apache from XAMPP but trying to open:
http://127.0.0.1:80/HotelRegistration/
but so the application can't start and I obtain the list of directory and file contained in this folder.
Why? What is wrong? What am I missing? Maybe something related to virtual host? How can I fix this issue?
Tnx
php artisan serve creates a web server that shows the public folder of your app.
As a good practice, you should setup your hosting to show that public folder while hidding the rest of the program from unwanted visitors.
Check this links about it:
https://medium.com/laravel-news/the-simple-guide-to-deploy-laravel-5-application-on-shared-hosting-1a8d0aee923e
https://deployer.org/blog/how-to-deploy-laravel
For development, that isn't too much of a trouble.
You can use the below to run your application. But it can fail to load the basic css file.
http://localhost/HotelRegistration/public/
Hope its help you.
Solved by myself,
I create a virtual host in Apache and using this URL works
I'm trying to deploy my PHP app hosted on github to heroku. Unfortunately heroku doesn't recognise it as PHP and uses default Nodejs setup. I made sure i have composer file in the root directory as specified by heroku documentation page. I also copied Procfile from their example app. Wonder if anybody have an idea why heroku doesn't recognise my app as PHP?
UPDATE
If i push the project from my machine directly to heroku, everything works as intended.
Creating a ticket with heroku support revealed that once my app was recognised as nodejs wouldn't change automatically to PHP (I had a package.json file in my project which made it to look like nodejs app to heroku, and removing it wouldn't help). Simply creating new heroku app, without package.json file solved the problem.
You need to set the correct buildpack before pushing to heroku:
heroku buildpacks:set https://github.com/heroku/heroku-buildpack-php
does the trick.
This is the first time I've used a PHP framework.
I've been following the Laravel documentation to install Composer and Laravel, and everything seems to have gone smoothly.
But now I've finished the installation/configure instructions, and I have created a project, I can't see any instructions on how to serve my application so it's viewable via a browser?
I have used Ruby on Rails before, which came with an easy way to get an instance of the application running via a built-in web server.
Is there something similar with Laravel, or do I need to somehow configure my standard Apache instance to serve the application?
I'm guessing there is something I've overlooked or misunderstood in the documentation.
yes, you can do it by using following in your terminal.
open your terminal, and navigate to directory where you have your project abc
and fire following command
php artisan serve
Now you can access it in browser by going to http://localhost:8000
hope you get it
I just want to add to the answer of Mubin Khalid . You can choose your own port number like
php artisan serve --port=8080
This is helpful when running two or more project.
You can also serve with you ip address
php artisan serve --host=ip_of_computer_running_laravel --port=8080
works to access server with in same network.
if you are accessing from same laptop you can just browse to ip_of_computer_running_laravel:8080 but if you are browsing from other computer in the network ip_of_computer_running_laravel:8080