I created my new project in Symfony 3.4.* and but not using the build-in webserver. I am using a shared Hosting with runs on Nginx. I change the root .../public_html to root .../public_html/web which includes the app.php etc. I am now able to visit domain/app.php which shows that Symfony is running. But if i change the DefaultController route from "/" to "/home" its not working for some reason. It says "File not found."
Whats going wrong exactly? I did try to create an symbolic link from /web to ../public_html but this did not work.
Please assist.
Take a look at this, from the Nginx site.
https://www.nginx.com/resources/wiki/start/topics/recipes/symfony/
You shoud modify that according to your needs.
Related
I'm in the dev environment and I have preference on using Apache instead of symfony default server.
I installed symfony/apache-pack as suggested in documentation but my app is currently under public folder - http://localhost/SITENAME/public/.
I.e. If I type http://SITENAME in a browser I get a list of folder structure which I believe is unsafe. Will adding .htaccess "Options -Indexes" rule file inside root folder fixes the problem?
I believe the default path shoot be: http://localhost/SITENAME or http://localhost/SITENAME/route-name. How do I achieve that?
Currently my directory is var/www/
but i have other projects in this directory .for example:
var/www/wordpress/
laravel tell me :
Sorry, the page you are looking for could not be found.
how can change laravel directory to var/www/cms ?
does work another project?
how can do that?
I commented earlier .. But I think to make the comment more clear I am going to go ahead and answer this:
First what you need to do is cd into /var/www/cms
Next you need to create your Laravel application. While in the cms directory, issue your Laravel creation command IE composer create-project laravel/laravel your-project-name. Once it is finished .. You should have a directory in the cms directory named whatever you named your Laravel Project IE var/www/cms/your-project-name.
You then need to point your hosts file (whether Nginx or Apache) to the directory var/www/cms/your-project-name for whatever domain.
I hope this was simplified enough for you, and good luck!
Laravel Valet could be one of the Solution.
You could create seperate Host for your Specific Application at Localhost.
Explained here : https://stackoverflow.com/questions/19425086/alias-hostname-for-localhost
You could Create new Directory and run your Laravel Project there too.
I started studying CodeIgniter Web Framework and I am trying to work with PHPStorm 8.0.3 on Kubuntu 14.04. When I unzip CodeIgniter downloaded archive to root Apache folder /var/www/html and go to
localhost/index.php
then it works okay and I see "Welcome to CodeIgniter!" page. Also I
can use
localhost/index.php/welcome/index
and see the same page as it should be.
When I created a new PHP project in PHPStorm and try
localhost:63342/codeignitor/index.php/
then I see welcome page, but if I use
localhost:63342/codeignitor/index.php/welcome/index
then I get 404 page. Also all my own controllers are not available and
cause 404.
I can call my own controller only if I make it default
$route['default_controller'] = 'mycontroller';
I think that this problem occurs because the URL contains name of my project /codeignitor/, but I'm not sure about it. So I need your advice how to set CodeIgniter environment in PHPStorm correctly to solve this problem. Thank you!
Codeigniter uses the URL to determine routing, therefore /codeigniter/index.php/welcome/index and /index.php/welcome/index are not equal paths. I would recommend using one or the other, and adjusting your /index.php and /config/routes.php to accommodate for your desired path.
References:
Codeigniter Subfolder
https://www.codeigniter.com/user_guide/general/urls.html
https://www.codeigniter.com/user_guide/general/routing.html
https://www.codeigniter.com/user_guide/general/environments.html
I just installed laravel following the instruction on Larvel docs. I chose to use install via composer create project command.
In the routes. php i created a dummy route
Route::get('/', function(){
return 'Front Page';
});
When i access http://localhost/mysite/ It shows directory listing of mysite folder. However when i use http://localhost/mysite/server.php It runs my route closure.
I also tried alternate .htaccess code provided at Laravel's docs but that doesn't work either.
I want to remove the server.php from url.
Thanks in advance for help.
This behavior is expected and this is how Laravel works. The public folder is meant for assets and is also (supposed to be) the webservers root directory.
If you are working on localhost that is not the case and the root directory contains multiple projects.
In order to get rid of public you would have to change virtual host settings.
As mentioned here in the site.
The problem with doing virtual hosts is that other projects in localhost will become inaccessible.
Just starting with Laravel.
I've installed it on my wamp server and setup a virtual host in apache. The standard home controller works fine. I've installed the scaffold bundle and generated a blog according to the description at the bundle's github page. There was no errors.
I've added Route::controller(Controller::detect()); to my routes.php but none seem to be working. I've tried http://laravel.dev/blog/posts/create and http://laravel.dev/blog/post/create. The scaffold created 3 controllers, users.php, blog/posts.php and blog/comments.php.
laravel.dev is a virtual host pointing with D:\wamp\www\laravel\public as DocumentRoot.
What are the possible issues? Where do I start looking?
Dont use Route::controller(Controller::detect()) - its known to be buggy and causes alot of issue.
Just define each controller individually in the routes.
I suspect you might have to include "index.php" (http://laravel.dev/index.php/blog/posts/create) in your URLs for it to work. This is a default option set in Laravel.
If you would like to turn this off for cleaner URLs, set "index" to an empty string in config/application.php.
You can read more about this in the documentation: http://laravel.com/docs/install#cleaner-urls