Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
How to Properly Deploy Web Apps via SFTP with Git
Nov 29, 2016 @ 17:53:49

On the SitePoint PHP blog there's a new tutorial posted showing you how to properly deploy applications with SFTP and Git. In their examples they build a PHP-based deployment process that uses a few handy packages to make the flow simpler than a set of manual commands.

Uploading files is an integral aspect of any deployment process, and the underlying implementation can vary depending on the type of your server.

[...] The PHPSECLIB (PHP Secure Communications Library) package has an awesome API for routine SFTP tasks: it uses some optional PHP extensions if they’re available, and falls back on an internal PHP implementation otherwise. You don’t need any additional PHP extension to use this package, the default extensions that are packaged with PHP will do. In this article, we will first cover various features of PHPSECLIB – SFTP, including but not limited to uploading or deleting files. Then, we will take a look at how we can use Git in combination with this library to automate our SFTP deployment process.

They start with a quick command (Composer) to get the phpseclib library installed but then quickly move into using it and some SSH keys to:

  • authenticate to the server with public/private keys
  • uploading a sample file
  • automating the deployment with Git, pushing only changed files from a local git repo
  • getting the contents of a specific commit
  • the actual push of the files via SFTP

There's also a few other helpful hints included showing how to manage permissions on the remote server, execute remote commands and downloading files. The post ends with links to other similar tools if you're interested in more complete approaches.

tagged: deploy application sftp git deployment tutorial phpseclib example

Link: https://www.sitepoint.com/how-to-properly-deploy-web-apps-via-sftp-with-git/

PHPMaster.com:
Using SSH and SFTP with PHP
Jan 10, 2013 @ 17:31:52

On PHPMaster.com today there's a quick tutorial showing you how to use SSH and SFTP from inside your PHP applications (requiring the ssh2 package).

In today’s world with so many third-party integrations and content-sharing, it’s important to understand and make use of protocols like SCP and SFTP. PHP’s SSH2 extension, a wrapper for libssh2 which implements the SSH2 protocol, provides several functions you can use to securely transfer files.

Sample code is included showing how to make a SSH request to a remote server, define the key files to use and execute a remote command (like scp). They also mention the use of wrapper functions like mkdir that also work with SSH/SFTP connections. The post finishes up with an example class or two you can use to wrap your connection handling and make it a bit more OOP-friendly.

tagged: ssh sftp extension pecl tutorial oop

Link:

OpenShift Blog:
Integrate PHPStorm and SFTP into OpenShift
Nov 09, 2012 @ 18:47:45

On the RedHat OpenShift blog (platform-as-a-service PHP hosting) they have a new post showing you how to integrate PHPStorm into OpenShift and make deployment simpler.

"PhpStorm is a lightweight and smart PHP IDE focused on developer productivity that deeply understands your code, provides smart code completion, quick navigation and on-the-fly error checking. It is always ready to help you shape your code, run unit-tests or provide visual debugging." In this tutorial I will show you how to use build in functionality in PhpStorm to deploy PHP application to OpenShift.

Screenshots are included in the post to guide you through the process - creating a new project, setting up the SFTP configuration and where to go to upload the changes to your system to OpenShift.

tagged: phpsotrm openshift paas tutorial sftp deploy

Link:

Kevin Schroeder's Blog:
Setting up a connection to the Zend Developer Cloud on Linux
Dec 02, 2011 @ 16:04:10

Kevin Schroeder has a method in one of his latest posts for hooking your linux-based system into Zend's phpcloud platform, complete with an automatic upload (so you're not constantly sftp-ing).

Connecting with the Zend DevCloud in Linux is actually quite easy if you know how to use SFTP. [...] But, as I said in a previous post, I hate having to do command line stuff for each and every file or commit. I like things to work seamlessly. So what I did was write a PHP script that connects to the DevCloud (or any SSH-based endpoint for that matter) and then monitors all of the files and directories for changes, such as a creation, modification or deletion event.

His script (available on github) uses the PECL inotify package to work, but once its set up, you can have the PHP process running the script in the background, pointed at your web root, and have it upload automatically.

tagged: inotify phpcloud zend cloud sftp automatic push

Link:

Kevin Schroeder's Blog:
Connecting to the Zend Developer Cloud using NetBeans for PHP
Dec 01, 2011 @ 20:08:54

Kevin Schroeder has a new post for the Netbeans users out there wanting to work with the Zend Developer Cloud directly without having to mess around with other external software.

Getting NetBeans connected to the Zend Developer Cloud is actually pretty simple… if you have NetBeans 7.1 which is currently in RC. NetBeans 7.0 has a bug that won't allow you to connect to Git over HTTPS. NetBeans 7.1 fixes that issue. You will also need to make sure that you have the Git module installed.

His post includes the step by step process (including some screenshots to getting the automated deployment set up and working in this popular IDE. The key is setting up the SFTP connection to point to the right location on the cloud server (the path isn't very intuitive, he recommends finding it with another SFTP program for the initial setup).

tagged: zenddevelopercloud cloud zend netbeans git sftp tutorial

Link:

DevArticles:
Deploying your Site with phpEclipse
Mar 10, 2006 @ 13:13:10

With an excerpt from the Packt Publishing book "PHPEclipse: A User Guide" (Shu-Wai Chow), DevArticles has posted this first of a two part series looking at the use of phpEclipse to help with the deployment of your site.

Eclipse simplifies the process of deploying your site to a web server. You can even use Ant, traditionally thought of as a Java tool, to help you in the deployment.

Once again, Eclipse simplifies our work by including several tools that aid us in this process.

The key to deployment in Eclipse is the export function. Eclipse gives us many options in exporting our site. First, we will look at FTP, an old and common method of moving files.

They cover how to set up an FTP site inside the editor, making it a simple process to upload any chnages you've made instantly. They also discuss other methods like SFTP, WebDAV, and Ant support the client can adapt itself to. There are screenshots along the way to help you through each step, including some from other operating systems where the setup might be a bit different.

tagged: phpeclipse deploy site ftp sftp webdav ant phpeclipse deploy site ftp sftp webdav ant

Link:

DevArticles:
Deploying your Site with phpEclipse
Mar 10, 2006 @ 13:13:10

With an excerpt from the Packt Publishing book "PHPEclipse: A User Guide" (Shu-Wai Chow), DevArticles has posted this first of a two part series looking at the use of phpEclipse to help with the deployment of your site.

Eclipse simplifies the process of deploying your site to a web server. You can even use Ant, traditionally thought of as a Java tool, to help you in the deployment.

Once again, Eclipse simplifies our work by including several tools that aid us in this process.

The key to deployment in Eclipse is the export function. Eclipse gives us many options in exporting our site. First, we will look at FTP, an old and common method of moving files.

They cover how to set up an FTP site inside the editor, making it a simple process to upload any chnages you've made instantly. They also discuss other methods like SFTP, WebDAV, and Ant support the client can adapt itself to. There are screenshots along the way to help you through each step, including some from other operating systems where the setup might be a bit different.

tagged: phpeclipse deploy site ftp sftp webdav ant phpeclipse deploy site ftp sftp webdav ant

Link:


Trending Topics: