How to use PHPMailer via Composer on FTP - php

i have started making my own site where i want to use PHPMailer!.First of all i installed PHPMailer via Composer(cmd) on my desktop then used localhost to run my page where the PHPMailer was running just fine.I then tried to just transfer my page files and files that were generated in there from PHPMailer (those are:vendor directory ,composer.json,composer.lock) to FTP.When i tried running it on live page it didn't work and threw Error:
Fatal error: require(): Failed opening required '/www/sites/0/site25740/public_html/vendor/composer/ClassLoader.php'
(include_path='.:/usr/share/php:/usr/local/zend/share/ZendFramework/library') in
/www/sites/0/site25740/public_html/vendor/composer/autoload_real.php on line 12
I think that my problem is that i generated those files into my desktop directory and therefore they are not working on live page.
Is there any way to maybe generate those files on my FTP server or maybe changing the structure of those files to work on live page?

You need to use SSH not FTP.
Once you SSH into your server, you can run the composer install command to install dependencies the same as you have on your desktop.
[Edit] An FYI - Yes, we can upload the vendor folder. Composer is a deployment tool. Uploading a vendor folder is NOT using a deployment tool.
If I am deploying 100 applications - and uploading 50mb of dependencies 100 times from a branch office on a cable/dsl ... how fast & efficient is that? If we offload that 50mb download to the server, how fast is that?
We have an option to do deployments wrong, or to do deployments properly.
I do not condone doing it wrong. It's clearly an option, however it is wrong.

Related

Updating composer library after files deployed to shared production server

I created a website using laravel.
I uploaded the site to my shared server, and site was running fine.
After that I had to add a library called Intervention. In local, I used this command and everything is working fine.
php composer.phar require intervention/image
I made changes in files and everything is working fine in local.
Now, I need to upload the updated files. So rather than deleting whole online folder, and re-uploading, I just want to upload changed files (I know the controller, view files that were changed).
But, as it is a shared server there is no way or place to execute composer update command or get that one library (thus now I am getting intervention Image class not found error).
So, what would be ideal thing to do in this case?
The easiest one maybe delete the whole folder and upload it again but the files are almost 500mb so do not want that.
Any suggestions to handle this situation? (updating composer libraries after deployment)
Not really a php or laravel question, but if you're using ftp to upload there's usually an option to only upload changed files.
For example in filezilla you can set the over-ride option here:

Composer updates at ftp-only hosting

I am working on a project where composer (https://getcomposer.org) is used. My problem is, the destination server is equipped with only FTP access (no shell, ssh, rsync). Each time I run "composer update" or another "require" at my dev machine, I need to upload all the vendor directory. As for now, +16k files are not a big problem yet, but even a small change requires a transfer of relatively huge amount of data.
I have tried to git the vendor directory, and use "git ftp" to deploy only the changed files, but as some libraries are seen as subprojects and/or have their own .gitignore files included - this method doesn't work quite well.
Runnig a script exec("composer update") seems to be not working either. Probably, the "exec" function at the live server is disabled, which on other hand, doesn't seem to be a bad idea on a public server (security issues, to be investigated by me).
I would love to find something like "composer remote synch" or similar method to transfer only the new installed or updated libraries to the remote server (composer.json, autoload.php of course included, but these obvious files are not a problem). Any tips, ideas?

How can edit deployed laravel project

I have website that create from laravel. I want to do some customization to that. Project files does not have in my local machine. I have files that deployed to my hosting. I need to help for edit it. How can i do it
Simply download your files from remote host, edit anything you want and re-upload them.
It's good to remember that you don't need to download the vendor folder,
since you can use composer install when you have the files in your local machine.
After finishing the update, upload the files back to the server, and, if you have ssh access, run composer update, to update your dependencies. If you can't use ssh, just overwrite the vendor folder on remote host.
Hope it helps.
I will assume that you are using a IaaS
First:
You can do it by accessing via ssh with PuTTY, if you're completely sure what to change. Anyways it is the easy way but not the best one.
Second: (What I suggest)
You can use a version-control system, via Github. You can use to upload your local changes and pull them in your deployed server.
Third
You can use filezilla to tranfer your files to the server fia FTP.

Can I Install Laravel 4 package without using Composer?

I want to install intervention/image package on my web server i had installed on my localhost , and i want to install it on my web server , Can I Install Laravel 4 package without using Composer? because i don't have acces to use command prompt on my web server.
How are you installing Laravel and the other dependencies already?
Just install it locally like normal then copy your vendor directory along with the rest of your project to your host.
it's possible for you to just upload your vendor directory with ftp, but I wouldn't advise it to you.
Couple of reasons:
You don't want to upload your dev-dependencies, so you would have to handpick which folder to upload - everytime you want to update your dependencies
Uploading over ftp is very slow, so that might take a long time
You don't get the latest versions of the dependencies (which could resolve some security issues)
You wouldn't get any warning if some package isn't compatible with your environment.
I suggest you to use a host that gives you CLI, or even better that can directly run composer when you push up your files, as hannesvdvreken said, fortrabbit (Disclosure: i work there).
If you are running PHP on a shared host without composer you still have some options left:
Install composer on the server in the same folder as your project,
Upload composer.phar to your server,
Change your hosting provider (try fortrabbit),
Upload your vendor folder from your local computer to your server. (Last resort)
Yes you can download it via LaraPack. It provide you ready-to-use Laravel instalation, so you don't have install it with Composer. It also gets weekly update.

How to install Propel on a normal hosting account?

I'm on the propel website now (http://www.propelorm.org/wiki/Documentation/1.5/Installation), and as I expected, there's a lot of command-line instructions for installing it, but how do I get it to work on my www.winhost.com server? Do I just upload the propel folder, and that's it?
Just download the tarball available at the download page (http://files.propelorm.org/propel-1.5.5.tar.gz) and extract it on your web space. More instructions can be found in the tarball in the INSTALL file :)
If you can't run a command line on your server, you can generate the model files on your local computer and upload them. You only need the runtime part of the Propel installation on your server, the generator part is only used for creating the files.

Categories