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!
Related
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 /
I have installed the laravel 5 on my local machine.And made the changes in the database.php file in config folder.I have set my credential.Now I am accessing the folder http://localhost/laravel/public/ but it displays html page with this content. Whoops, looks like something went wrong.What configuration should I set apart from this database.php so that it works fine.
This will likely happen to you everytime you create a new Laravel project. The problem is that your webservice (apache/nginx) doesn't have read/write permissions for the storage folder. From the root of your installation perform a chmod 777 -R ./storage and that should get you to the welcome to Laravel screen you should expect for an installation, and from that point on you should now get the error reporting if you have debug mode set as true. If you are still having trouble, you may need to provide access to the ./public folder as well.
You can run laravel application when you have successfully installed in your machine, Add '/public' in url after root folder. Means you have installed app on www.firstlaravel.com and your root folder is 'first'.
So you can run app using like => www.firstlaravel.com/public
I am trying to take my Laravel project online. I am using AWS to host it. The project is working fine in localhost. But when I try to put it online, I have to add public at the end of URL to view my project. Plus, no other route except '/' is working for me. For example, I have a route defined user/login which is working fine in localhost but not online. Here is the link to the project.
You need to correctly set the document root on your web server. The document root is the folder that apache or nginx will attempt to serve files out of. You want this to be the full path to the Laravel public folder.
I'm not an AWS expert, but if you're using Elastic Beanstalk checkout the "Document root" section on this page. If you're just spinning up an EC2 instance you'll need to alter your deployment scripts to change the Apache virtual host setup and/or nginx configuration to point to the correct folder.
Add a Procfile to your project root that contains something like the following:
web: vendor/bin/heroku-php-apache2 public
The above assumes you are using php/apache, if it is something else, then change accordingly.
So I'm new to Laravel 4, and I'm trying to figure out how to Symlink two parts of my site.
The first is apps/storage
The second is public/cache (this is where an image cache is stored)
I'd like to move both of these to a SSD on my server, however Laravel keeps throwing out an error whenever I try and setup these Symlinks.
That error is:
ErrorException
file_put_contents(/meta/services.json): failed to open stream: No such file or directory
Clearly it's unable to find the filesystem and the symlink isn't working with Laravel. But the symlink DOES work with individual files (such as a jpeg), so I'm positive there is no problem with the initial setup.
To clarify, the document root is set to httpdocs/public (via Plesk settings)
The apps (and framework) are located in the httpdocs folder which is no longer serving as the vhost root.
As I hinted at, it's a Plesk server. The owner belongs to the vhost, and the group belongs to psacln. But I don't think there are any permission/ownership problems, as I've verified the symlinks are working.
Looks like you have messed something else, because the path in the error message looks wrong to me:
file_put_contents(/meta/services.json)
IMO, it should be something like:
file_put_contents(/var/www/webapp/app/storage/meta/services.json)
Because, if you have done the symlink correctly you did something like
mv /var/www/webapp/app/storage /mnt/ssd/
ln -s /mnt/ssd/storage /var/www/webapp/app/storage
PHP is trying to write a file in the root /meta folder, where probably it doesn't have right.
I wrote a little site with Symfony2 and I want to host it on my WebSpace. I only have FTP access, so I can not access any console/terminal!
Problem is: Symfony cannot create the cache directory properly! There might be a permission problem still?!
These are y steps so far:
Uploading my whole project with empty Cache directory (since I can't clean it due to no console)
Changing permissions of cache and logs directories using my ftp client
unmasking console, app.php and app_dev.php like explained here
Adding my IP to the whitelist in the files: config.php and app_dev.php
Checking the config.php to see if my configuration meets symfony's requirements (they do! no major problems!)
Checking PHP settings: PHP 5.3.3-7, SQLite3 and PDO-Driver there!
Opening app_dev.php/_configurator/step/0 concludes into a RuntimeException:
RuntimeException: Unable to create the cache directory (/var/www/userx/html/MySiteSymfony/app/cache/dev/twig/83/4c).
Opening app.php results in a 500 server error and no log file is being created
Someone an idea how to get symfony working?
Go into the app/ folder click "get info" on the cache folder and set the right permissions (make sure to click "Apply to enclosed folders/files").
Finally changed my provider. Seems like its OS was just deprecated.