I have a Laravel project, I want to deploy it into the server, the thing is that normally we have index.php and .htaccess inside the public folder, but in my case, I have brought these two files into the root. So I want to know, what are the changes needed in serve?
How can I upload this to server?
Solution 1
Somehow you need to get the ssh access as a shared user from your hosting provider and then you can use git to clone your repository into your server.
Solution 2
You can copy paste all of your project into the server using ftp from your cpanel or relevant control panel.
Solution 3
Use Amazon as your hosting as it gives 1 year free tier access, and also gives you ssh service. Follow the solution 1 after getting this.
Put back the files to the public folder. You can change the root path of your server to your project's public folder.
Follow the steps to do:
Go to /etc/apache2/sites-enabled/
Open the .conf file inside this folder
Change the docuementRoot to /etc/var/www/html/project_name/public
Restart the apache server using the following command:
sudo systemctl restart apache2
Related
I've searched everywhere for a solution. Plus, I tried tracking the error using echo("teste");, but can't find exactly what is wrong, since it works on my local host.
From index.php -> bootstrap/autoload.php -> vender/autoload.php:
I could print a msg until before the foreach in getLoader method of ComposerAutoloaderInitxxxxxx class.
I see it can't complete the require in both bootstrap/autoload.php or bootstrap/start.php
my directories levels are:
public_html/
|__laravel/
|__app/
|__bootstrap/
|__vender/
|__index.php
|__artisan
|__robots.txt
I've changed the paths correctly when moved the files from public/ to laravel root, since I can get into the files required (it just can't finish loading).
I get
500 (Internal Server Error)
Ps.: I uploaded the project through Filezilla, and I only have the FTP access.
Please, could someone help me with this?
Ok first you should not upload a Laravel project via FTP, if you only have an FTP access then you need a real hosting provider that has SSH. You should be able to use the composer command on your production server or you will be in big trouble later :)
Also, assuming this is a cPanel host (based on the public_html folder) the proper way would be to git clone the Laravel project under a folder, remove the public_html folder and create a symbolic link like this.
ln -s ~/laravel/public ~/public_html
This way your document root will point to Laravel's public folder.
Here is more information:
https://laracasts.com/discuss/channels/general-discussion/how-to-install-laravel-in-the-root-directory
I'll straight to my point. I have an machine which installed gitlab and nginx, and I have an fresh laravel project that already has commited, but I need to access the source code of "public" directory of laravel for my nginx. how to get source code of public directory, so I can put into line "root path" in files "sites-enabled" nginx, so nginx can access those files ?
The GitLab API doesn't expose the filesystem location directly so you need to stitch the url together.
To get the entry point of all your repositories check you GitLab configuration. (Normally /etc/gitlab/gitlab.rb). Find the key gitlab_git_http_server['repo_root'].
In there you will see folders which represent your namespaces in these folders are your project.
I am using Laravel with PHPStorm and a custom server where I connect via SFTP. The problem is that being SFTP, it's not in sync. So everytime I generate files via php artisan command, I have to download the file(s) with PHPStorm. I know that I can get around that by using Homestead and Shared folders, but this project requires a custom VPS.
I know that no SFTP "drive" is currently working ok with Windows. Also, the server is remote, not on the same network, so Samba can't do the job.
Thank you!
This is a workflow I use, you may simply need to do the following, assuming you have already setup a default deployment server.
Editing remote files
If you are editing the remote files instead of a local copy, don't; instead:
create a local copy/git clone/etc of you project files.
create a new phpstorm project with the local copy.
Setting up a sync
If you already are working off a local copy but just need sync setup:
ctrl+shift+a
type deployment
select options
change the option: Upload changed files automatically [..] to always
enable upload external changes
As an added bonus, this also automatically syncs assets from say gulp watch too.
If you haven't setup a deployment server
ctrl+shift+a
type deployment
select configuration
create a new server with you method of connection to it.
enable as default server (last icon on the top left column)
Important: if you don't select the server as the default, it will not be able to auto upload changes.
Also don't forget to setup the excludes in the configuration menu, I usually exclude bower_components, and node_modules from deploying to my servers, and only send the build assets. (But it's up to you)
EDIT: Don't run commands remotely, run them locally and let them sync back to the server.
I execute the artisan commands on both sides... i do it on this way on my linux maschine
<?php
unset($argv[0]);
$params = implode(' ', $argv);
$remoteOutput = shell_exec("sshpass -p password ssh -o StrictHostKeyChecking=no user#1.1.1.1 'php /path/to/artisan $params'");
if(!empty($remoteOutput)){
shell_exec("php artisan $params");
}
Save it and add it as commandline tool in phpstorm.... in windows i think you can use the PHP SSH library or somthing else.
I have created a laravel 5.0 project with php artisan serve, now i need to know how to run laravel 5.0 project run without start php artisan serve, i have already browse lot of websites no one help me..
You need to change "server.php" to "index.php" then copy ".htaccess" from public to root directory.
See: https://stackoverflow.com/a/30053989/3948755
Laravel sever Folder is "public". There is an index.php so you can run you project from there.
Suppose if you using UbuntuOS then you have to create your local server in public directory. Suppose your folder name is laravel_test then go in that directory and run some thing like this
php -S localhost:8000 -t public
If you using windows then access public folder from URL.
localhost/laravel/public
Actually it's bad practise to access folder from URL but for local its good. You also can go with host entry. Just make sure that your target folder is "public" directory.
Normally you would have WAMP/XAMPP installed. You can access Laravel project like below
localhost/laravel/public
But this is not recommended. You should create Virtual host for example
laravel.local that pints to server-root/laravel/public.
this is how you create virtual host.
Or even better go for a Laravel Homestead .
How is your .htaccess file configured?
Try with localhost/laravel/public/index.php
Use http://localhost/projectName/public
It will be work. but in case if you have another Route and you can not access that Route and get the error like " Page Not Found " then please use the following command
sudo a2enmod rewrite
Now open the http://localhost/projectName/public/yourRoute
This is a little late but still applicable, what I like to do (using ubuntu 14.x+) is put my laravel project (let's say Project1) in my var directory, so it would be in /var/Project1, then symlink the public folder to somewhere in /var/www(+/html depending on apache version).
Symlink can be done something like this:
ln -s /var/Project1/public /var/www/html
This keeps your internal files off the grid so to speak, this is untested so if I've missed anything just comment and I will amend this post.
EDIT:
Obviously if your http root is /var/www/html you can put your project in /var/www/Project1
If you have access to xampp or wampp on your operating system you can more or less configure your virtual host like in the instruction below:
https://bestin-it.com/creating-virtualhost-on-your-local-computer-to-start-simple-index-php/
This instruction shows how to run it locally on your PC, but it works generally the same on any hosting portals. In most case in payed portals you have any web panels to configure your public folder that reference to /public folder in laravel folder's structure.
I built a project using Laravel 5 on my dev machine and now I'd like to deploy it.
One solution that came to my mind is to upload everything using FTP but I guess there is a better way.
I uploaded the composer.json but I receive tons of errors.
I have ssh/root access but using GIT is not an option.
Make sure you can use composer binary on your server and you are set
upload every file except vendor folder (you may use some FTPS manager that reads git-ignore file and does not upload ignored files)
set permissions to ./storage folder (browse thru this severfault thread)
make sure your web server root is ./public
create env file (that is not going to be changed ever, until you want) and do not overwrite it with "local" env file.
$ composer install (installs everything from composer.lock)
$ composer update (updates from repositories again, do test on local before updating on production)