Laravel's documentation does not explicitly say where to execute "laravel new project_name"? Should it be executed at the webserver's root that is htdocs or www? I use WAMP server in Windows.
It should be executed at the parent folder of htdocs or www.
The laravel folder can't live in htdocs, as it will expose all sensitive files.
After that, you must map laravel_myapp/public to something as htdocs/myapp.
You can also symlink the laravel_myapp/public folder to where you want in htdocs.
Depending on your needs, but I would put it in htcdocs/www because is the default folder configured in apache by WAMP, anyway you can change the documentroot of your server if you want.
As long as you have the right folder permissions and the project is created under your root folder laravel shouldn't have any problem with that.
Hope this helps you :)
Related
I want to move moodle lms from local server to live server, I moved moodeldata to httpdocs and tired to figure out httpdocs directory path on shared Linux based Plesk server. I appreciate any one helps me!
I tried like this
$CFG->dataroot='\httpdocs\moodledata';
but the result is
Fatal error: $CFG->dataroot is not configured properly, directory does
not exist or is not accessible! Exiting.
On Linux, they should be forward slashes
$CFG->dataroot = '/moodledata';
Also, its a really bad idea to put the data root in a web directory (httpdocs) that's publicly available - put the data root in a directory that's outside of the web root
https://docs.moodle.org/401/en/Installing_Moodle#Create_the_.28moodledata.29_data_directory
If you are migrating, then you probably need to backup the old data root too
https://docs.moodle.org/401/en/Moodle_migration#Copy_moodledata_from_the_old_server_to_the_new_server
Thanks all for your help! And now I changed as
$CFG->dataroot ='/data/www/example.com/moodledata'; then
I moved moodledata from httpdocs to home-directory and it worked correctly.
Whenever I use the following PHP code:
header('Location:/account/login.php');
It goes to the localhost/account/login.php but I wish it would go to the something like this: localhost/MyCurrentProject/account/login.php
Cause when in the webserver the code works fine, since the server considers the root the folder of my website. Is there a way to make this automatic?
I am using XAMPP on Windows, but the principle can be applied to Linux version.
XAMPP starts apache, and the folder with files to execute depends on its config. There are 2 main configs for that:
Virtual hosts config: <XAMPP>\apache\conf\extra\httpd-vhosts.conf
Base config: <XAMPP>\apache\conf\httpd.conf
You can play with ServerRoot & DocumentRoot values in them.
Where should I put a larval project on server directory?
I put my larval file ~/[larave_project_name]
DocumentRoot is /var/www/html/.
I moved public/index.php into DocumenRoot.
But I found In DocumentRoot, Those files can’t load files from outside of var/www
My Server environment is Cent OS7 / Apache 2.4 /PHP 7.4
The intent is for the webserver to have a document root of the public directory within your laravel project.
A good starting point would be:
Move the files from ~/[laravel_project_name] to /var/www/[laravel_project_name]
Update the default for the web server configuration to change the document root from /var/www/html to /var/www/[laravel_project_name]/public
I have a VPS of blueMix, My cPanel's file Manager have folder public_html where i dropped a file index.php having some php echo 'tesing'; which wasn't loading up, After some research i found out that my root Directory is /var/www/html. But any how i dropped my project there like /var/www/html/project and then came up checked like example.com and that redirected me to the hosting default page, example.com/project show project root files and folders, example.com/project/public returned internal server error 500. Permissions seems ok.
What am i missing, Is there a slandered way ? Please help out.
Q1 : How can i set my root directory public_html.
Q2 : How to deploy laravel in /var/www/html or public_html.
modify this Lines from Public->index.php to the public_html .
require __DIR__.'/../public_html/bootstrap/autoload.php';
$app = require_once __DIR__.'/../public_html/bootstrap/app.php';
and check..
After hours of research, I easiest way is to have a server with out a lamp stack, Install a custom lamp stack, One by one component, Look for the apache configuration, Set the permissions, And you are good to go.
I installed wamp stack and then installed netbeans ide. The port number for apache is 100.
Created one PHP project at
C:\Users\aaa\Documents\NetBeansProjects\PhpProject2
and project URL http://localhost:100/PhpProject2/
When I click on run, I see the message "http://localhost:100/PhpProject2/index.php URL not found on the server".
What else I need to do to connect http://localhost:100/PhpProject2/index.php to C:\Users\aaa\Documents\NetBeansProjects\PhpProject2?
Please help.
You need to configure Apache's webroot to be C:\Users\aaa\Documents\NetBeansProjects (search for DocumentRoot in the file httpd.conf).
Or you can move/copy your files to the existing webroot, which may be something like c:\wwwroot.
Apache doesn't just magically know where you put your website files, and setting the URL inside NetBeans doesn't actually configure the webserver (I think it's just so that auto-generated links are right).
If you go to http://localhost:100/, what do you see? What is your web root? The folder needs to be in your web root, and I would be surprised if it is C:\Users\aaa\Documents\
I did a Google search for "wamp stack" and found a product by Bitnami... if this is the one you are using, the default web root is C:\Program Files\BitNami WAMP Stack\apache2\htdocs\. If that is indeed the case, then you'd need to move the NetBeansProjects folder to there. (source: http://bitnami.org/files/stacks/wampstack/5.3.6-0/wampstack.pdf page 7)
You need to look into aliasing. That will let you more or less assign directories in the url path to arbitrary directories on your file system.
You have to move your files to your root folder of the Apache installation (htdocs). You should refer to your WAMP installation for where that is located. Personally, I like to use XXAMP for installation.
Netbeans is just an IDE, it doesn't serve the files.