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

Delicious Brains Blog:
Automating Local WordPress Site Setup with Scripts Part 3: Automating the Res
Feb 22, 2017 @ 16:36:38

The Delicious Brains site has posted a new tutorial, the third part in their "Automating Local WordPress Setup" series, covering the automation of "the rest" of the setup steps. This includes virtual host setup, plugin installation and cleanup.

In my last post in the Automating Local WordPress Setup series, I created a WP-CLI package for quickly installing and uninstalling WordPress. I’ve been using this package for a while now, and have been itching to make it more useful for a typical development workflow.

[...] I also still catch myself doing things that I know should be automated. Things like deleting unnecessary data, removing the default themes/plugins, and installing new plugins, are things that can be automated to make development easier. In this post we’re going to take a look at some ways to make all that possible.

The article is then broken down into three sections with scripts/code that can help with these automations:

  • Working with Virtual Hosts (and MAMP)
  • Cleaning Up the Install (deleting extra themes, plugins, etc)
  • Installing Frequently Used Plugins (your custom list based on a "plugin list" file

The post finishes out with a screencast showing this plugin installation that makes it easier to come up with easy to reproduce, simple to spin up WordPress environments.

tagged: tutorial automation wordpress part3 virtualhost cleanup plugins installation

Link: https://deliciousbrains.com/automating-local-wordpress-site-setup-scripts-part-3-automating-rest/

ProDevTips.com:
Proxying with PHP in Ubuntu 14.04 (Apache 2.4, PHP 5.4+)
Jan 21, 2016 @ 16:46:38

The ProDevTips.com site has a tutorial posted showing you how to proxy requests with PHP on Ubuntu using Apache 2.4 and PHP version 5.4 or later.

I’ve just had to evade a Russian block of one of my employer’s sites, let’s call it CasinoX. Presumably they had blocked both www.casinox.com and www.casinox.com’s IP address (which is a Cloud Flare IP btw).

Simply pointing ru.casinox.com to the real IP address of www.casinox.com’s server was a not a viable solution though as that would expose the real IP publicly which is a no-go in the online casino business as it is basically an invitation to be DDoS’ed.

The solution they came up with was to set up a server that operates as a proxy and sends all traffic to the actual web server, save the assets (images, Javascript files, etc). They include the changes you'll need to the .htaccess configuration on the proxy server to forward the requests. Then they show the updated version of your virtual hosts configuration to match these changes. From there the rest of the handling lives in PHP. They include the code for the index.php proxy handling, a Proxy class that makes curl requests to the actual web server and an ip_in_range function to get the actual IP of the user/client making the request.

tagged: proxy server apache webserver tutorial htaccess virtualhost

Link: http://www.prodevtips.com/2016/01/16/proxying-with-php-in-ubuntu-1404-apache-24-php-54/

Konstantin Kudryashov:
Autohosts for Symfony projects on Mac
Oct 18, 2012 @ 15:39:43

Konstantin Kudryashov has posted a helpful hint for any web developer out there that knows the pain of constantly setting up VirtualHosts and local hostnames during their development. His suggestion makes setting them up simple using Apache2's "autohosts" support.

We all know, that web development is not as easy as it sounds and that it involves lot of different and sometimes really complex tools to just run or test stuff. We also know, that bootstrap (setup) of the project could take more time than you want it to. It’s not a big deal if you’re working on single project full time, but at KnpLabs, i’m bootstraping new sf2 project every 2 weeks. So this manual crafting of virtual host, edition of /etc/hosts and maintaining of those temp hosts everywhere made me really sick. So, at some point i’ve started to look for an elegant solution. Here is it.

He gives you all the commands, file contents and software you'll need to install (he uses Homebrew) to install dnsmasq and get it configured. The only Symfony-specific part of the process is the last step - getting the latest version of the framework and installing it.

tagged: autohost apache2 configuration virtualhost localhost automate

Link:

Joshua Thijssen's Blog:
Setting up a development environment
Feb 06, 2012 @ 15:27:41

In a new post to his blog Joshua Thijssen gives a guide to how he usually sets up his development environments when working in PHP. It includes working with virtual machines, configuring DNS and setting up his tools to work with it all.

Doing development on multiple projects can be a burden from time to time. One project would be running on PHP 5.3, while another still needs 5.1. Sometimes you need a MySQL server, while on other occasions, you need a NoSQL solution like couchDB or MongoDB together with all kind of gearman functionality. This article shows you how I’ve setup such a development platform that allows you to quickly create new projects, and still maintain flexibility when you need it.

He uses VirtualBox with either a Debian or CentOS installation as a base platform. He uses Vagrant to set up and configure the machines to make setup almost automatic. He still has to go in and configure a few things like the VirtualHost and DNS settings for the site/application he's working on. Next up is setting up the tools he uses, specifically XDebug and setting up his editor of choice (PHPStorm) for remote debugging.

tagged: development environment virtualbox debian centos mysql vagrant xdebug phpstorm dns virtualhost

Link:

Millwood Online Blog:
Multi-site Drupal installations
Nov 06, 2009 @ 17:37:39

On the Millwood Online blog there's a quick step-by-step about getting multiple Drupal sites up and running on one code installation.

One of the great things about Drupal is that you can run more that one site off one installation. This saves disk space and load on your server, it also saves maintenance time. With only one installation to manage and update the time spent administering your site drops greatly.

The process is pretty simple - install Drupal normally and set it up for the main domain, then change the directory name for the settings and add another for the new domain name. Go update your Apache virtual host configuration file to point to the new location and restart the web server. Both of your domains should be set and ready.

tagged: druapl multiple website virtualhost apache

Link:

SitePoint Web Tech Blog:
How to Test Multiple Websites on One PC With Apache Virtual Hosts
Apr 24, 2009 @ 15:24:31

On the SitePoint.com Web Tech blog, Craig Buckler explains how you can test multiple PHP/MySQL/Apache websites on your local machine without having to change your Apache configuration each time - the magic of VirtualHosts.

It is rare to find a web developer with responsibility for just one website. In this article, we will configure your development PC so you can test any number of websites using a dedicated domain name for each one. You will require a local installation of Apache 2.2 and, optionally, PHP and MySQL.

He explains the only two parts you'll need to get it up and running - changes to your hosts file and updates to the Apache configuration file to add in VirtualHost records for each site. He also throws in a bonus tip about detecting which host the script is being used on via the $_SERVER['HTTP_HOST'] variable.

tagged: multiple website apache virtualhost tutorial host file configure

Link:

Dave Dash's Blog:
symfony and the .htaccess file
Aug 16, 2007 @ 20:14:00

Dave Dash has another performance tip for Symfony users involving a simple change involving your .htaccess file.

One performance boost that can be garnered from a symfony app (or any app for that matter) is disabling .htaccess. .htaccess does not need to be parsed on each visit to your app. Disabling .htaccess is trivial in your VirtualHost or another relevant part of your apache configuration place.

The information (like routing rules) that was inside of the .htaccess is then moved back into the VirtualHost inside the Apache configuration to make for less files the Apache instance needs to open to get its job done.

tagged: symfony framework htaccess file virtualhost symfony framework htaccess file virtualhost

Link:

Dave Dash's Blog:
symfony and the .htaccess file
Aug 16, 2007 @ 20:14:00

Dave Dash has another performance tip for Symfony users involving a simple change involving your .htaccess file.

One performance boost that can be garnered from a symfony app (or any app for that matter) is disabling .htaccess. .htaccess does not need to be parsed on each visit to your app. Disabling .htaccess is trivial in your VirtualHost or another relevant part of your apache configuration place.

The information (like routing rules) that was inside of the .htaccess is then moved back into the VirtualHost inside the Apache configuration to make for less files the Apache instance needs to open to get its job done.

tagged: symfony framework htaccess file virtualhost symfony framework htaccess file virtualhost

Link:

Tim Bromhead's Blog:
Super friendly URLs - handling spaces with URL Rewrites and PHP
Feb 20, 2007 @ 19:35:00

In a new entry today, Tim Bromhead shares his method for creating "super friendly urls" for a site's users using mod_rewrite:

Today we are going to show how to make the URLs with spaces super easy to type for users. bla.st uses dashes in the URLs to represent spaces eg. http//bla.st/web-design/. We chose dashes over underscores because underscores can get lost with underlined links, and we think they look nicer.

He includes the Apache config information for working with the VirtualHost entry and the simple PHP script to handle the requests. It looks in the SERVER superglobal, at the QUERY_STRING to see what the user is requesting and does an append and redirect accordingly. This example is made to take any form of a space in the URL (including underscores and %20), parse it out, and pass the user along correctly to the page they want.

tagged: friendly url space virtualhost apache modrewrite friendly url space virtualhost apache modrewrite

Link:

Tim Bromhead's Blog:
Super friendly URLs - handling spaces with URL Rewrites and PHP
Feb 20, 2007 @ 19:35:00

In a new entry today, Tim Bromhead shares his method for creating "super friendly urls" for a site's users using mod_rewrite:

Today we are going to show how to make the URLs with spaces super easy to type for users. bla.st uses dashes in the URLs to represent spaces eg. http//bla.st/web-design/. We chose dashes over underscores because underscores can get lost with underlined links, and we think they look nicer.

He includes the Apache config information for working with the VirtualHost entry and the simple PHP script to handle the requests. It looks in the SERVER superglobal, at the QUERY_STRING to see what the user is requesting and does an append and redirect accordingly. This example is made to take any form of a space in the URL (including underscores and %20), parse it out, and pass the user along correctly to the page they want.

tagged: friendly url space virtualhost apache modrewrite friendly url space virtualhost apache modrewrite

Link:


Trending Topics: