how to deploy symfony on cpanel in public_html - php

Am trying to run symfony on the Cpanel in the public_html. But when I access app_dev.php page it shows me 500 Internal Server error. I tried all method which are available on internet. I did same thing on the localhost but it is working on the localhost on the port 8000. But not working on the Cpanel. finding some solution

first of all, you can't browse app_dev.php except localhost, for this you have to add your public IP in app_dev.php
check app_dev.php line 13
clear cache and check permission for cache logs and session.if it's not solved your problem then
just check Symfony log file, this will tell everything you need....
and one more thing after placing your file in public_html your URL should be youdomain.com/web
if you want to remove web from your url try this....
shared hosting .htaccess for symfony

This is the permission problem. whenever you face this error please change the /username/public_html/web folder permission to 755 and app_dev.php -> 644 ,config.php -> 644 and app.php -> 644.

Related

XAMPP Apache not working on Ubuntu 20.04.3 LTS

I have been searching for hours now and I cant find a solution. I have tried much to many things to even start listing the things. So please any assistance would be appreciated.
I have changed the htdocs folder location in httpd.conf because I have all my files sync to cloud storage. This works perfectly on my windows machine but on linux not so much. Every thing runs perfectly but when I try to access my htdocs folder (new location) I get a message:
Access forbidden!
You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.
If you think this is a server error, please contact the webmaster.
Error 403
localhost
Apache/2.4.48 (Unix) OpenSSL/1.1.1k PHP/8.0.10 mod_perl/2.0.11 Perl/v5.32.1
But When I change the location back to the normal location it works perfectly.
I have already gave full access to the folder.
Think of a directory structure as a series of security doors:
/var
/www
/htdocs
If you give someone a key to htdocs (i.e. set the permissions to give a user access) then they can open that door… but only if they can get to it.
If you don't also give them keys to www and var then they can't get into htdocs.

Hosted Laravel 5.4 App shows "View [path.to.viewfile] not found."

I have tried hosting my Laravel app in Godaddy. The homepage works well as well as the log ins and dashboard after logging in. But the other views return a InvalidArgumentException in FileViewFinder.php line 137: "View [path.to.viewfile] not found.
I'm returning the view from the controller with return view::make('path.to.viewfile')
It works well on my localhost using XAMPP. Does anybody know how to fix this?
Have you checked filenames and permission? file names are case sensitive in Linux (your hosting provider uses it)
You have to change directory permissions at your server. Directories and files within the storage and the bootstrap/cache directories should be writable (e.g. chmod 777)

Symfony deployment on heroku points to app folder

I am trying to deploy the symfony app on heroku and I am able to update the schema and all perfectly fine however when i try to access the site I get
Forbidden
You don't have permission to access / on this server.
So using the command heroku logs --num 10 i can see the error
Cannot serve directory /app/web/: No matching DirectoryIndex
(index.php,index.html,index.htm) found, and server-generated directory
index forbidden by Options directive
As you can see heroku is trying to access /app/web/ rather than just web, because of this even my assets are being access via app/web/css which is ofcourse wrong.
So how can i get rid of this app? I do not understand why Heroku is even pointing at that.
I have gone through the steps mentioned in Symfony documentation over and over and I cant seem to find out what I am missing?
The Procfile seems to be point to web so where is this app coming from?
web: vendor/bin/heroku-php-apache2 web/
I have gone through other articles online like the one as following but nothing seems to be fixing my problem.
Symfony on Heroku: 403 Forbidden You don't have permission to access / on this server
Any help will be really appreciated.
On Heroku you need to create the .Procfile and upload that or create the app.json Schema file and then based on that Heroku will create the .Procfile for you automatically, here you can see the app.json example for Symfony app.
Another thing that needs to be crossed checked is make sure in your public directory the .htaccess file was also uploaded. In Symfony the public directory is the web folder and in my case the .htaccess file was missing.
After making sure of the above two steps my app works perfectly fine on Heroku.
Use /web/ instead of web/: add the leading slash!
Your Procfile file should contain this:
web: vendor/bin/heroku-php-apache2 /web/
Note the leading / in the path to the web folder!

Laravel 5.2 HTTP error 500

I have made a website with Laravel 5.2 and now want to put it in my VPS. I installed LAMP on my server, and put my project in /www/ directory. I can access my server, however, when I try to access /public, I get an HTTP 500 error. Both my /bootstrap/cache and /storage are writable. Do you have any suggestions, what should I do? Thanks for your help!
Sorry, just made a mistake on changing rights of bootstrap and storage folders... Very sorry... Everything works now!

Laravel error page not showing when using virtual host

I install new laravel package through composer and everything is going fine (including the error page) when I use php artisan serve and access my project in http://localhost:8000. But when I use virtual hosts (for example: example.dev), the error page is not showing, just a blank page. I'm not sure if it has something to do with my virtual host configuration because if the code has no error, the page just load normally. And I have changed the permission of storage and bootstrap/cache folder to 777.
Is there any other configuration that have to do?
Which PHP version do you use on your server? Check the logs and see if you find something there.
Try giving the entire Laravel folder 755 permissions and then change the bootstrap/cache and storage folders.
Also try editing your .htaccess file, add something like:
RewriteEngine On RewriteBase /

Categories