WP Smith

Creating WordPress & Genesis Websites Since 2010

  • Home
  • About
  • Services
  • Blog
  • Contact

Mar 05 2014

Setting Up a Local Environment via XAMPP: Configuring PHP

PHP comes installed with a preset configuration. In local environments, I tend to set things a lot higher than I normally would in a production site simply because it is for me and for strenuous testing, auditing, developing, debugging, etc.

So navigate to the C:xamppphpphp.ini file and open within Notepad++.
Open php.ini

The file will look like this initially.
php.ini

Go to line 451, and make the following changes:
https://gist.github.com/9318470
This will allow you to do a bit more with the PHP instead of it timing out on you periodically.

And then on line 922, change upload_max_filesize to upload_max_filesize=100M
This will enable you to be able to upload large files to the WordPress Media area.

Then on line 1045, change the default timezone. For more information as to what value to place there, see http://php.net/date.timezone.
This obviously sets the server default timezone.

Now, there are other customizations you can make to the INI file, but these basic changes are all the essential ones.

Written by Travis Smith · Categorized: WordPress

Mar 04 2014

Setting Up a Local Environment via XAMPP: Creating a Database via phpMyAdmin

4. Create a New Database

After you’ve installed XAMPP, run it by opening a browser and going to localhost, which will take you to the splash page.
XAMPP Splash

Click on your preferred language. It should take you to the start page, http://localhost/xampp/.
XAMPP Home

Now click on phpMyAdmin at the bottom left.
XAMPP phpMyAdmin

In the phpMyAdmin page, create a new database by clicking on Databases at the top.
XAMPP phpMyAdmin Databases

Since this is local anything will do (eg. prefix_wordpress). However, you want a more complicated database name than this to protect yourself from SQL injection on the internet. Adding a prefix will create folders to help with the organization.
XAMPP phpMyAdmin Create Database 1
XAMPP phpMyAdmin Create Database 2
XAMPP phpMyAdmin Result

Now go to phpMyAdmin, and create a new database (eg. prefix_wordpress) by typing in your database name (e.g. wordpress) and pressing CREATE.

Written by Travis Smith · Categorized: WordPress

Mar 03 2014

Setting Up a Local Environment via XAMPP: Installing XAMPP

Before You Get Started

WordPress needs PHP and mySQL to run. This tutorial installs via XAMPP, not WAMP or MAMP (Mac), so I will not be going into any details regarding WAMP or MAMP, but some of the things will apply to them as well.

1. Install XAMPP, a Local Server

In order to run any PHP/database application on a local computer, you need a local host (ie. Apache + MySQL). So go and download the most recent version of XAMPP or the version from this tutorial is XAMPP 1.8.3 (Sourceforge Old Versions, Windows Version, 128MB).

[browser-shot width="600" url="http://www.apachefriends.org/index.html"]

Setup XAMPP
Setup XAMPP Modules
Setup XAMPP Location

I personally disable BitNami, but feel free to include it.
Setup XAMPP Disable BitNami
Setup XAMPP Ready to Install
Setup XAMPP Installing
Setup XAMPP COMPLETED!
Setup XAMPP COMPLETED!

Once installed, move to the next step. You may go ahead and launch the Control Panel, but do not do anything yet. First we must configure the PHP modules to ensure that we have everything set as we need.

Written by Travis Smith · Categorized: WordPress

Mar 03 2014

Beginner Developer Series: Setting Up a Local Environment via XAMPP (Apache, PHP, mySQL)

When developing, it is always good to have a local site. Many skip this and use only a staging site and the production site. However, having a local environment will make life easy with testing scripts quickly and easily. Change a file, save, and run. However, using a staging site, you have to FTP up and down, and with WordPress and Windows, this sometimes can get you into trouble if not done correctly.

So, we need to install Apache (the server software), PHP (the language that WordPress runs on), and MySQL (the database). To do this on an Apple machine, use the Make WordPress Tutorial for MAMP or see the older tutorial in the Codex: Installing MAMP. For Windows machines, there is XAMPP, which stands for Apache + MySQL + PHP + Perl.

Quick Summary

Here are the simplified steps on how to install WordPress on your local computer that we will walk through this week:

  1. Install a local server ( XAMPP).
  2. Configure PHP
  3. Launching Apache & Troubleshooting with Skype
  4. Create a new database via phpMyAdmin.
  5. Setup XAMPP Security
  6. Download WordPress from wordpress.org and install into the htdocs folder (typically C:/xampp/htdocs).
  7. Run the famous 5 minute install and follow the instructions: wp-admin/install.php.
  8. Done!

Written by Travis Smith · Categorized: Tutorials

Mar 01 2014

Plugin Uninstall: How to Delete Terms & Taxonomies from WordPress Database

Many developers do not consider what they should do when a person deactivates a plugin (like flush_rewrite_rules()), much less what to do with the data the plugin created, much of which is useless. In my opinion, this is partly because creating an extra uninstall.php file is a bit problematic to test over and over.

So, in this snippet, here is how you can delete ALL the terms and the associated taxonomy when a plugin is deleted by a user. First create a file called uninstall.php which appears at the root of the plugin. Then add this code:

<?php
/** Delete All the Taxonomies */
foreach ( array( 'my_first_custom_tax', 'my_second_custom_tax', 'my_third_custom_tax', ) as $taxonomy ) {
// Prepare & excecute SQL, Delete Terms
$wpdb->get_results( $wpdb->prepare( "DELETE t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s')", $taxonomy ) );
// Delete Taxonomy
$wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => $taxonomy ), array( '%s' ) );
}
view raw uninstall-terms-taxonomy-1.php hosted with ❤ by GitHub

Sometimes, however, you may need to do something else between the code. For example, you may have custom term meta within the options table that would need to be deleted as well.

<?php
/** Delete All the Taxonomies */
foreach ( array( 'my_first_custom_tax', 'my_second_custom_tax', 'my_third_custom_tax', ) as $taxonomy ) {
// Prepare & excecute SQL
$terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy ) );
// Delete Terms
if ( $terms ) {
foreach ( $terms as $term ) {
$wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $term->term_taxonomy_id ) );
$wpdb->delete( $wpdb->terms, array( 'term_id' => $term->term_id ) );
delete_option( 'prefix_' . $taxonomy->slug . '_option_name' );
}
}
// Delete Taxonomy
$wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => $taxonomy ), array( '%s' ) );
}
view raw uninstall-terms-taxonomy-2.php hosted with ❤ by GitHub

Written by Travis Smith · Categorized: WordPress

  • « Previous Page
  • 1
  • …
  • 5
  • 6
  • 7
  • 8
  • 9
  • …
  • 61
  • Next Page »
  • Twitter
  • Facebook
  • LinkedIn
  • Google+
  • RSS

Copyright © 2025 � WP Smith on Genesis on Genesis Framework � WordPress � Log in