I am using localhost as my development server in which I added Composer and installed the Stripe dependencies.
Since I have a shared hosting account, I want to transfer the Composer files to my server since I don't have root access to run the Composer install locally.
Which files do I move, and where do I put them? I have moved composer.json composer.lock and the vendor folder into my sites root directory with all of my sites files and folders.
However, when I go to run a Stripe command I get errors in which I have to include each file in the directory. Obviously, Composer is not correct on the new server since I have to include each file.
How can I get it so that Composer works properly on the new server?
First of all, you don't need root access to use Composer. Just download (or transfer from your local machine) composer.phar and use it on the server.
About copying: I advice to copy the whole project directory as is (with all src, vendor, bin dirs and other file). It's in your interests to make local and remote environments the same.
Related
I have working SS v3.4 project locally. Now I want to deploy it. I've copied files to the server, run composer install to install vendor libraries. When I run install.php all requirements are fine except for missing mysite folder errors. That's intended because I renamed my project folder to let's say mydomain and it works fine on localhost. AFAIK SS should pick up the custom folder and recognise it as THE page folder. Somehow it doesn't happen. Any ideas why?
This is expected, since the installer specifically looks for "mysite".
You probably have two options:
Rename app to mysite on the serve, re-run the installer then rename the folder back to app
Don't run the installer at all - if you configure your own _ss_environment.php file and ensure assets folder is writeable you shouldn't need it
I tried to run inststruction from the official website but I cannot understand why I cannot access my website and what do I need to fix?
My website is in the directory /var/www/drupal8.
The files are as follows:
I installed it using composer from here https://www.drupal.org/node/2718229
What do I need to do next? I want to access my website in the browser as I can in Drupal 7 just typing my local website name, for example drupal7.loc
Configure your VirtualHost entry to point to drupal8/web. The actual Drupal root directory is the web directory. That's where the index.php file, etc. are.
Also, your screenshot doesn't show it, but make sure you have a drupal8/web/core directory. It should be there if you ran the composer create-project command, but if not, you'll need to run composer install in the project root (/drupal8) before your site will load.
How to upload my project to server , migrate my database , and edit my project using github or any other way .
i tried this way and it seems to be very stupid.
i uploaded myproject.zip and extracted .
then created database and imported a backup from my localhost database.
suggest any helpful easier way to do it .
thanks.
Maybe git-ftp is something for you.
You can use git-ftp for script based projects like PHP.
Most of the low-cost web hosting companies do not provide SSH or git support, but only FTP.
Git-ftp provides an easy way to deploy git tracked projects. Instead of transferring the whole project, it only transfers the files that changed since the last time.
Even if you are playing with different branches, git-ftp knows which files are different. No ordinary FTP client can do that.
First of all create a repository on github. And then on your local computer initialize git if you are on Linux (ubuntu to be precise) navigate to your project folder and run
git init
it will show an output about initialized a working directory or something like that. Navigate to .git folder and edit config file with your favorite editor, the content looks like the following
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = https://your-username#github.com/your-user-name/your-repository.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
after modifying this file navigate back to your project root folder and run
git add .
git commit -m 'first commit'
git push origin master
now login to your server via putty or any ssh client you use navigate to your project root folder initialize git by
git init
navigate to .git folder and edit the config file paste the same code you pasted on your local machine and then navigate back to your project root folder(on server) run
git pull origin master
You are in sync now. No anytime you make any changes to your localhost you should perform following commands from your project root folder
git add .
git commit -m 'any custom message about these changes'
git push origin master
and from your server
git pull origin master
Never make any changes on your development server in ANY CASE. you should add the files you want to ignore while upload and download in the .gitignore file under your project root in your localhost. e.g to exclude a folder from uploaded add following in your .gitignore file
/foldername/*
I use Laravel 4 to develop my projects.
I develop on my Mac, commit to Git, then clone it on the server (linode 1G VPS).
Since "vendor" folder is by default "GIT-ignored", I usually do "composer install" after cloning the project on the server.
After that, any other packages I install locally, I do "composer update" on the server.
Yesterday, I reported this problem - PHP Composer update "cannot allocate memory" error (using Laravel 4)
So far, I have not found a solution. I even tried to do a "fresh" cloning and "composer install", it's giving me the memory error. This is extremely frustrating.
My question is then, is it ok to just upload my entire project to the server? Since "vendor" folder is only thing that is "git-ignored", if I just copy everything there, would it work? (I haven't tried it since my server is alive at the moment and I don't want to damage anything).
What is the actual role of "compiled.php" file? Is it platform dependent? Can I copy that file too?
I've seen this memory issue quite a few times now and read other people reporting the similar issue. I hope I can just upload the entire project folder and cross my fingers that it will work.
Thanks for your help!
I do not have VPS, or even shell access to my custom/shared hosting from my provider, but I can run git and composer commands without that.
Use sshfs http://osxfuse.github.io/
sshfs actually does SFTP connection to your server and mounts server to local directory.
This way, you can run git and composer commands localy. You do not depend on your VPS/hosting server. sshfs sends files in background to remote server.
To mount VPS to local dir, run this
sshfs user#serverip:. /path/to/existing/local/dir // to mount root dir
cd !$ // to get into mounted dir
// or
sshfs user#serverip:foldername /path/to/existing/local/dir // to mount specific dir
cd !$ // to get into mounted dir
Now you can do whatever you want.
a good thing to know for you - it is possible to set up Laravel config in such a way, that the same app (the very same copy of code) can act differently on different servers (environments).
I am wrtiting that, because if you sync your remote server with a local copy of the code sooner or later you will stumble upon issues like changing the db credentials or app setup after every sync - which of course doesn't make sense :)
Check out Laravel 4 Docs Environment configuration to read more about that, or follow this tutorial by Andrew Elkins - How to set Laravel 4 Environments
The environment is based on url matches.
You’ll find that configuration in /bootstrap/start.php
$env = $app->detectEnvironment(array(
'local' => array('your-machine-name'),
));
Now say you are developing locally and use the prefix/postfix local. E.g: my-new-site.local or local.my-new-site
$env = $app->detectEnvironment(array(
'local' => array('local.*','*.local'),
));
That sets the environment, now to use it you’ll need to create a local folder in /app/config/
1 mkdir app/config/local
And so you want to have a different database configuration for local. Just copy the database config file in to the local directory and modify it.
1 cp app/config/database.php app/config/local/database.php
To sum up and answer your question:
1) I guess it's OK to copy the whole project dir to remote server (although, if your copying vendor it might take a lot of time - it usually contains a big number of files)
2) if you do so, remember to have the updated composer.json on remote server (to reflect all the necessary requirements)
3) If you are using different database servers local and remote - you obviously have to run migrations and seeders on the remote server (this concernes also package migrations/seeds)
4) after you migrate all your files, do
composer dump-autoload
php artisan optimize --force --env=YourProductionEnvironmentName
which should rebuild the bootstrap/autoloaders
5) if you are using the Laravel Environments setup mentioned above, remember to have your remote server seen as production (if your local is testing/staging).
I had phpmailer running fine on a hosted server. I moved to a VPS which is linux/ubuntu so most of the installation is done via the console.
Previously my include was simply:
include('phpmailer/class.phpmailer.php');
include('phpmailer/class.smtp.php');
Both those were inside the root folder, when i ran the install via the console it stored the files in usr/shar/php/libphp-phpmailer
I have never worked with files outside the root, is there a special way to reference them in include()?
For reference, my root folder is: var/www/
This may work for you now
include('/usr/share/php/libphp-phpmailer/class.phpmailer.php');
include('/usr/share/php/libphp-phpmailer/class.smtp.php');
Since you have console access to that machine, cd in to /usr/share/php/libphp-phpmailer and make sure those files are there. If they aren't, you can try to locate those files.
In ubuntu/debian you can find files using 'sudo updatedb; locate class.phpmailer.php' (updatedb ensures your file name database is up to date)
use the following ../ as move back to directory
like if are at www/html/ and want to access file in www/lib/
include(../lib/filename) ;