Tuesday, November 23, 2010

Change domain for multisite Wordpress

#1. I need to add this to wp-config.php
...............................................
//FIXME: do comment/remove these hack lines. (once the database is updated)
update_option('siteurl', 'http://www.mydomain.com' );
update_option('home', 'http://www.mydomain.com' );
...............................................
note: as for multisite I don't get the general setting option to change the URL there ?
#2. and then would need to transfer the files to the new server , and update-import the database ....
#3. and then if needed use the Search and replace plugin .... to change the post links used by my websites' blog user.

Is this all ? or is there any thing else ?
Will this leave the multisite settings undisturbed and working ?
Thanks again for your spontaneous help and reply , so I'm much a novice, but this transfer knowledge is very essential for me.

Monday, November 22, 2010

testing, developing,production

"The Release management discipline covers moving code form a developers machine to live/production. This is done in the following order or there about:
Developer develops code and runs unit test, integration tests and re-factors the code prior to putting it in to the main build, which then leads to
Install and build test server, this is where the install team install the code which has come out of the build, if the build does not work then the release manager knows there is a problem, most companies have a code curfew where they make sure developers don’t submit code for the nights build unless hey have tested it. Then the Build is automatically run every night using the code cut form the curfew time.
If the install is ok a regression test is run and if this passes, then the code is release to the test team, on one or more ideally two test servers. The testers then run their test scripts against the test plan and test schedule, which is driven by the requirements and change control documents.
Once it is tested by the test team, the code is moved onto the staging server where the business test the code and sign off as to fit for productions, normally refereed to as UAT (User Acceptance testing), then there is OAT (Operational Acceptance testing) which is done on a server which is like production, this is where the staging server come into its own, as this is normally the same as production where the normal test servers are normally virtual servers and lower spec. On the staging server the company may also run performance tests which are linked to the acceptance criteria as agreed between the business and the development team/company.
Then once there is a signature on a release note, down time for production is planned and the release is moved to production and put live, make sure there is a roll back position, if not you could end up with production down for hours and a not very happy business. years ago in a roll for a telco, down time of the network was counted in millions per second, even a single cell or part of the min network could lose a Million every 15 minutes, so the pressure was on to make sure the code was tested and a signature was given before moving to the next stage of the release process."

Monday, November 8, 2010

32 bit or 64 bit windows?

To find out if your computer is running 32-bit or 64-bit Windows, do the following:
  1. Open System by clicking the Start button Picture of the Start button, clicking Control Panel, clicking System and Maintenance, and then clicking System.
  2. Under System, you can view the system type.

Thursday, November 4, 2010

Can not Start Windows Process Activation Service

Got an error message after uninstall IIS7 on windows 2008 R2, and deleted the C:\inetpub folder.

"The Windows Process Activation Service service terminated with the following error:
The system cannot find the file specified."


 http://technet.microsoft.com/en-us/library/cc734935.aspx, which has, as the first option for solving this problem:

To resolve this issue, make sure that the appPools directory meets the following requirements:
- The directory must exist.
- The directory cannot be on a UNC path.
- The directory must be available to WAS and should have the following permissions:
* SYSTEM: Full Access
* Administrators: Full Access
* IIS_IUSRS: Read

Thursday, October 28, 2010

Install MySQL connector

Installing MySQL connector (Specifcally the ADO.NET Driver for MySQL):
http://www.mysql.com/products/connector/

Correct the WordPress site URLs

I accidentally changed the WordPress HOME and SITEURL to the root of my domain, which is pointing nowhere (default IIS start page) and I locked myself out of the WordPress admin.  After  a few minutes of research I managed to get the site running and login back to admin area again.

1. The first method is so easy so I figure I should give it a try:
->modify the wp-config.php file to add two lines:
define('WP_HOME','http://my.website.com/correctlocation');
define('WP_SITEURL,'http://my.website.com/correctlocation');
Problem: after you did above, the site is running and you will be able to login to the admin interface. However, the Home and site URL values are no longer available for editting (they are greyed out) through the general settings.

2. I restored the wp-config.php to it was and tried the second method. which works great.
->modify the current active theme's functions.php file, to add two lines right after <?php line:
update_option('siteurl','http://my.website.com/correctlocation');
update_option('home', 'http://my.website.com/correctlocation');
Site is running and had no problem to login, the general setting shows the correct urls for my site and home. save the change and logout.
**Important: Remove the two lines you just added from functions.php. Put the file back where it belongs. login and logout and everything should be fine.

3. there are other methods, like to edit directly in database. I did not try it. Hopefully I will not need it. Do a search "Changeing the site URL" in WordPress Codex will lead to more answers.

Wednesday, October 27, 2010

Theme, Template for one single install of WordPress

You can have a different Layout for Pages v.s. Posts v.s. the single home page of your blog site because the Template files can be different for each. The disadvantage I can think of, for sharing a single WordPress installation for both blog and CMS, is that you would have to limit yourself to a single Theme for both. You'll have to decide whether you can live with the same Theme for both the blog and main site. If so, you can have a single installation do both, and save yourself a lot of grief.
The same Theme really means the same CSS file for both. And a sharing of the header.php and footer.php files. Though, with some careful php coding, you can even work around those commonalities.

There’s a fundamental difference between using themes in a single WordPress intallation and the new WP 3.0 multisite. The themes you install (when enabled), are available to be used for ALL subdomain sites. So, if you customize your theme code for the main site (or a subdomain blog) – those changes will be in every site using that theme. This could be good or bad. Let’s say that you decide to add adsense code in the homepage of one theme. It would show on every site using that theme. If your intention was to have adsense ads on all the blogs on the network (because you can edit theme files and they can’t) – then this worked out just fine. But if you were using the theme on the home site only, and then another sub-blog user enabled it, they would have the theme with all the customizations you’ve made for just the home site.

However, there’s a way to enable a theme for just a blog(or site). Read this: http://wpmututorials.com/themes/enabling-a-theme-for-just-one-blog/

Configure Pretty Permalinks for WordPress on IIS 7+

Using Permalinks

Permalinks are the permanent URLs to your individual weblog posts, as well as categories and other lists of weblog postings. A permalink is what another weblogger will use to link to your article (or section), or how you might send a link to your story in an e-mail message. The URL to each post should be permanent, and never change — hence permalink.

Permalink Types

There are three basic types of WordPress permalinks:

Default: "Ugly"

The default looks like
http://example.com/?p=N
where N is the Post ID number. It works on all server environments, but it doesn't look as nice as some of the other options.

mod_rewrite: "Pretty Permalinks"

Using mod_rewrite or lighttpd you can produce much nicer permalinks (see Pretty Permalinks). There are many different formats, but the most common, and most versatile looks like
http://example.com/category/post-name/
or  http://example.com/year/month/day/post-name
Some people eliminate some or all of the date elements (day, month, year) to have a shorter permalink format.
Pretty permalinks are available under
  • Apache web server with the mod_rewrite module
  • Microsoft IIS 7+ web server with the URL Rewrite 1.1+ module and PHP 5 running as FastCGI
  • Microsoft IIS 6+ using ASAPI_Rewrite
  • Lighttpd using a 404 handler or mod_rewrite (see See Also)

PATHINFO: "Almost Pretty"

PATHINFO permalinks look very much like mod_rewrite permalinks but for one exception: they have /index.php inserted before them, like so:
http://example.com/index.php/yyyy/mm/dd/post-name/
Otherwise, they are the same as the "pretty" mod_rewrite permalinks, and are similarly flexible. Anything that mod_rewrite permalinks can do, PATHINFO permalinks can do, with the help of that /index.php part.
There is a helpful plugin that displays the type of permalinks being used and detailed information on the internal rewrite rules used by WordPress.

Choosing your permalink structure

In the Settings → Permalinks panel (Options → Permalinks before WordPress 2.5), you can choose one of the "common" structures or enter your own in the "Custom structure" field using the structure tags.
Please note: You never, ever put your site url in the permalinks slot. You must use one of the structure tags, or a combination of tags only.
%year% 
The year of the post, four digits, for example 2004
%monthnum% 
Month of the year, for example 05
%day% 
Day of the month, for example 28
%hour% 
Hour of the day, for example 15
%minute% 
Minute of the hour, for example 43
%second% 
Second of the minute, for example 33
%postname% 
A sanitized version of the title of the post (post slug field on Edit Post/Page panel). So “This Is A Great Post!” becomes this-is-a-great-post in the URI (see Using only %postname%). Starting Permalinks with %postname% is strongly not recommended for performance reasons..
%post_id% 
The unique ID # of the post, for example 423
%category% 
A sanitized version of the category name (category slug field on New/Edit Category panel). Nested sub-categories appear as nested directories in the URI. Starting Permalinks with %category% is strongly not recommended for performance reasons.
%tag% 
A sanitized version of the tag name (tag slug field on New/Edit Tag panel). Starting Permalinks with %tag% is strongly not recommended for performance reasons
%author% 
A sanitized version of the author name. Starting Permalinks with %author% is strongly not recommended for performance reasons

Using "Pretty" permalinks (IIS)


Permalinks without mod_rewrite

"Pretty" permalinks usually require mod_rewrite, and IIS (common on Windows servers) does not support mod_rewrite. (If you are using Apache 2.0.54, on Windows, mod_rewrite may work, provided it is enabled in apache\conf\httpd.conf.)
If you are using IIS 7 and have admin rights on your server, you can use Microsoft's URL Rewrite Module instead. Though not completely compatible with mod_rewrite, it does support WordPress's pretty permalinks. Once installed, open the web.config file in the WordPress folder and add the following rule to the system.webServer element
<rewrite>
    <rules>
        <rule name="Main Rule" stopProcessing="true">
            <match url=".*" />
            <conditions logicalGrouping="MatchAll">
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            </conditions>
            <action type="Rewrite" url="index.php/{R:0}" />
        </rule>
    </rules>
</rewrite>
There's a full installation guide on the IIS site.

Download URL Rewrite Module 2.0
  • English: WebPI / x86 / x64
  • Tuesday, October 26, 2010

    Download and Install Database Manager 1.0 to manage MySQL

    To configure IIS to manage MySQL: IIS DB Manager, it can be obtained from the IIS Extensions site.
    Us this link below to download:
    Download Database Manager 1.0

  • English: WebPI / x86 / x64



  • If you have installed WebPI, then click "WebPI" link will run the Web Platform installer and install the Data Manager.  The WebPI will find the dependency and install them for you.

    Friday, October 22, 2010

    DNS issues when login to Wordpress admin interface

    I had a problem when try to login as WordPress adminstrator while remote-desktoping to my Wordpress server: The page is blank! If I go back to the blog and it shows I am logged on already(as it has the 'sys admin' link displayed).  If I click on "sys admin" link I can see the admin page, however, it shows that I do not have javascript enabled.

    The problem was resolved by using ip address (LAN IP, or 127.0.0.1) instead of "localhost". This is something not related to Wordpress but it has been bothering me for hours. The network guys knows this is something related to the DNS that did not resolve the name correctly.  I thought I just record this here.

    Allow LAN user to view locally installed Wordpress

    Instead of the localhost alias, changed the WordPress address (URL) and Blog address (URL) to the LAN ip address, which needs to be a static IP address.

    login to wp admin >Settings>general>change URLs> save changes.

    Thursday, October 21, 2010

    Enable Multiple sites in WordPress

    To enable this feature, simply open your wp-config.php file located in your WordPress root folder. Then add the following line anywhere in the file:
    define('WP_ALLOW_MULTISITE', true);
    Once you have done that, you should be able to access the network page from Tools » Network

    (WordPress 3.0)

    Change siteURL in wordpress

    WordPress stores two addresses inside the database. These determine where your blog files are, and where the main index is. On a normal install, these addresses are the same.
    There are two occasions where you will need to access the database to alter one or both of these settings:
    1. If you have tried to alter the Blog URL or WordPress URL in Settings, and an error has occurred.
    2. If you have moved to a domain/subdomain with a different name.
    BACKUP your database before you begin and store the backup off your site server, like on your hard drive. See: Backing Up Your Database.
    Edit wp-config.php

    It should be possible to fix the site URL using a new feature -
    Add these two lines to your wp-config.php, where “example.com” is the NEW location of your site.
    define(‘WP_HOME’,'http://example.com’);
    define(‘WP_SITEURL’,'http://example.com’);
    Change your IIS settings to reflect the new URL.

    Old way-- change in database
    Wordpress stores the host url in the database.  Open your wordpress db and open the table called "wp_options" (since you said you used web pi, you can download the database manager add-in to the IIS manager so you can open MySQL database from within IIS manager), and look for the record with the "option_name" field value of "siteurl".   The "option_value" field contains the host url that's being used for every wordpress object.  Change the base URL to your desired value (like wordpress.domain.com) and all objects like pictures and links will use the base URL you set in that record.

    Friday, October 8, 2010

    Uninstall MySQL on windows

    If you run into trouble and want to start over. Follows these steps ot uninstall MySQL:
    1. Open the Control Panel and Choose Add or Remove Programs. Find the MySQL 5.0 OR MySQL 5.1 entry and choose the UNINSTALL/REMOVE button.
    2. After it uninstalls, click on Start-->Run . Type "regedit". Open
    HKEY_LOCAL_MACHINE --> SOFTWARE-->MySQL AB
    Delete MySQL AB if it exists
    3. Go to C:\Program Files . Look for "MySQL" Folder and delete it
    Restart your system. Now you should be able to re-install MySQL .

    Thursday, October 7, 2010

    Configure IIS so it can run PHP scripts (on development machine)

    1. Your server roles is as an Application Server
    2. Install FastCGI from http://www.iis.net/expand/fastcgi (I’m using the latest release version and not the 1.5 RC)
    3.  Install PHP for Windows, which you can get at  http://windows.php.net/download (currently version 5.3.1). You may select the ‘non-thread safe version’, as recommended by http://learn.iis.net/page.aspx/247/using-fastcgi-to-host-php-applications-on-iis-60 (section entitled ‘Download and Install PHP’)
    4.  Select ‘IIS FastCGI’ and it will associate the FastCGI ISAPI filter with IIS , meaning you can skip the section ‘Configuring FastCGI Extension to Work with PHP’ on the iis link above.
    5. To test PHP has been installed successful, create a folder and add a file index.php to it (e.g. put the file under C:\phpwebs\phpinfo with the  the following code in it:
      1. <?php phpinfo(); ?>
      • Then go into the IIS Manager in administrative tools, and under Websites/Default Web Site, create a new virtual directory. Give it a name (e.g. phpinfo) and select the folder you created, ticking Read and Execute permissions.
      • Open up a browser and navigate to http://localhost/phpinfo. You should see the classic PHPInfo screen with the Server API down as CGI/FastCGI.

    Verify or install ASP.NET and IIS on Windows Server

    The ASP.NET component also may or may not be installed by default along side IIS.  Verify or install as follows:
    Windows Server
    -   IIS and ASP.NET are most easily installed using the “Manage Your Server” tool.  They are both installed by adding the “Application Server” role to the server.  Add this role via “Manage Your Server” if this role is not already displayed.
    -   Sometimes an IIS installation or installation of a service pack or security patch will turn off the ASP.NET extension in IIS as a security exposure.   Either select “Manage this application server” from the “Manage Your Server” tool, or start the IIS Manager tool directly from Start/Administrative Tools/IIS Manager.  Once there, expand “Internet Information Services” the “local computer” then click “Web Service Extensions” in the tree view.  This will show the installed extensions and whether they are enabled or prohibited.  Any line that starts “ASP.NET” needs to show “Allowed”.  If it shows Prohibited, select that entry and click “Allow” in the right hand window.