jessgramp.net

My recipe blog

Category: Technology

Tips and tricks to help web developers.

Avoiding PHP and mySQL timeouts

Share

add the following to the start of the php file:

<?php
set_time_limit (0);
ini_set('mysql.connect_timeout', -1);
ini_set('mysqlnd.net_cmd_buffer_size', -1);
ini_set('mysqlnd.net_read_buffer_size', -1);
?>
Share

How to create a wordpress test site

Share
  1. Duplicate the files in cpanel to a website.ext.test folder
  2. Export the database from the live website
  3. Create a new test database with a new user and password
  4. Edit the wp-config with new database, db user, password and unique keys and salts (generate using URL in config file)
  5. Import the database into the test database
  6. Run the SQL commands below on the new test database.
  7. Add a redirect in cpanel to send all non www addresses to www.newsite.ext
  8. Add a redirect in the .htaccess file in cpanel’s file directory to send the subdirectory to the test.newsite.ext address instead
  9. Change the WordPress settings > Privacy to block search engines
  10. Change the WordPress settings > General > Site title to include “test”
  11. Enable sign-in before viewing any pages by installing and activating ‘registered users only’ plugin.
  12. Disable the WordPress settings > Media > ‘Organize my uploads into month- and year-based folders’
  13. Select and change the WordPress settings > Permalinks > Custom Structure to ‘/%category%/%postname%/’

UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-url.com', 'http://www.new-url.com') WHERE option_name = 'home' OR option_name = 'siteurl'; 

UPDATE wp_posts SET guid = replace(guid, 'http://www.old-url.com','http://www.new-url.com'); 

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-url.com', 'http://www.new-url.com');

(These SQL queries are sourced from: http://wordpress.org/support/topic/create-a-test-site)

If you are using Category Redirect to Post or Page plugin:

UPDATE `wp_cat_redirect` SET url = replace(url, 'http://www.uk-move.com', 'http://www.test.uk-move.com');

Update any hard coded menu items manually via the GUI WordPress interface. Most should be relative to the site’s root and not require updating.

 

 

Share

Things to change/add on new WordPress installs

Share

Here’s some things I change/add on new WordPress installs:

  • Upgrade to latest version
  • Delete Hello Dolly and Askimet (unless it’s a personal site) plugins after each upgrade
  • Settings>Media> Uncheck ‘Organize my uploads into month- and year-based folders’
  • Settings>Discussion>Uncheck ‘Allow people to post comments on new articles’ (unless you want comments enabled)
  • Settings> Permalinks>Custom Structure = /%category%/%postname%/
  • Posts> Categories: Rename ‘Uncategorized’ category to ‘Uncategorised’
Share

Things to backup before you reformat your computer

Share

Here’s some things you shouldn’t forget to backup before you reformat your computer.

Continue reading

Share

My Favourite Firefox Addons

Share

These are the firefox plugins I can’t live without…

Continue reading

Share

Cookie limits

Share

I discovered there were limits on the size of cookies recently while trying to save search form data to a cookie. In the end I had to save each search form in to a single cookie as a delimited list (a kind of ad-hoc array). I hope this saves someone the time it took me to work out why my cookies were being deleted…

Continue reading

Share

What to do if you can't view source in IE

Share

If you want to know how to get your “view source” to work again in IE read on. Continue reading

Share

© 2017 jessgramp.net

Theme by Anders NorenUp ↑