Archive for category php

Dummy Image Generator

’nuff said!

No Comments

WordPress 500 Error when submitting a blank comment form under IIS7 and PHP5

I recently noticed an issue on this very blog and a couple i have hosted on this server when people just hit submit on the comment form without entering anything into the comment field- i would get a 500 server error back.

error_pagesI spent ages googling figuring it was some kind of config error on the server as it happened across all of the wordpress blogs on this server- I eventually found it wasn’t an error at all- The skins used across these blogs didn’t seem to validate the forms so it was falling back to wordpress which was returning an error like “Error: please type a comment.”- however IIS seemed to be intercepting this as a full error and rendering a 500 error- the solution was simple!  Turn on detailed error’s.  Obviously this isn’t good on a production box running dot net, but for PHP you can control the error reporting from within the php.ini file anyway, so this just makes sure IIS doesn’t add an additional layer of error filtering confusing matters.

Update: Thanks to Kanwaljeet Singla on the comments for pointing out a better fix for this as detailed on Kern Handa’s blog here.  This can basically be fixed easily by setting a web config entry to tell IIS to let errors pass through, like so;

<?xml version="1.0" encoding="UTF-8"?>
        <httpErrors existingResponse="PassThrough" />


Permissions problems with WordPress on PHP5/IIS7 (Windows Server 2008 SP2) with FastCGI

I recently rebuilt a Windows 2008 server and set it up with PHP5 and FastCGI under IIS7 for a bunch of word press blogs. I came to the end of the install and was setting rights to the wp-content folders so people could upload attachments, but ran into some troubles.  I dunno if this changed because of Service Pack 2, but I found I now have to assign the rights, not to “Network Service” which is the Identity of the app pools, and not to “ISS_IUSRS” group, but to an account simply called “IUSR”.  I’m sure previously i just assigned permission to the network service account?  And surly IUSR would be a member of IIS_IUSR’s by default?  I dunno!  Anyway I had to use procmon to monitor the requests and see which account was actually being used.

So to conclude; You need to give modify permissions to the wp_content folder, to the IUSR user and the user your App Pool runs as (eg; ‘IIS APPPool\’)


PHP Basics @ Smashing Magazine

I’ve not touched PHP for a couple of years now and everytime I have to come back to pimp out a wordpress theme or write something simple which can consume a dot net web service or something else quick and dirty in php, its always the basic syntactical stuff that I find I’ve forgotten (seriously.. a full stop to concatinate a string!?) – anyway; for those occasions, here is a handy article;

No Comments

WordPress import from – 500 Server Errors & Timeout’s!

I’ve recently setup a wordpress blog to use when we’re on holiday to post pictures and let people know how we’re getting on. I had an existing hosted blog up at which I wanted to import to my new self hosted blog, but ran into a whole world of pain while trying to run the built in importer.

I ran an export from the hosted blog which gave me an xml file which contained wordpresses own variant of rss. I then selected import from my new wordpress’s tools menu and gave it the xml file- all went well but when i asked it to download the attachments it all started to go to shit!

There were two main issues which i had to fix- the first was wordpress goes mental when it hits a 302 redirect when trying to grab an image, but there is a fix available for the download function in wordpress;

From :

< //ini_set("display_errors", true);
< $response = wp_remote_request($url, $options);
< $headers = wp_remote_retrieve_headers($response);
< $cd = (string)$response['response']['code'];
< if ($cd == '301') {
< $response = wp_remote_request($headers['location'], $options);
< $headers = wp_remote_retrieve_headers($response);
< }
> $response = wp_remote_request($url, $options);
< //$headers = wp_remote_retrieve_headers( $response );
> $headers = wp_remote_retrieve_headers( $response );

Then i’m hit with timeouts coming from the FastCGI module- I’m running PHP 5.2 under IIS7 on Windows 2008 Web Edition- the error I was now getting when trying to run the import was;

The FastCGI process exceeded configured activity timeout

I found the fix for this one here: It was down to the FastCGI module timeout being hit, so it was just a matter of increasing that from the command line i executed;

%windir%\system32\inetsrv\appcmd set config -section:system.webServer/fastCgi /[fullPath='C:\php5\php-cgi.exe'].activityTimeout:600

In the end, I STILL didn’t get all the images over as some of them were quite large and the wordpress file server timed out while the script was trying to grab them, but i thought i would post this none the less, to save anyone else having to experience the evening i just had.


, , ,

No Comments

Move from to WordPress 2.7.1!

I’m a .net developer by day, so am always keen to use .net technologies where ever possible.  For the past few months I’ve been persevering with, a dot net blogging platform which I run on my Windows 2k8 IIS7 box from home, however I can do it no more!  I’ve found myself looking on with envy at the features in the newer builds of WordPress as i struggle on with the various “quirks” of BlogEngine and finally decided I could no longer put up with it- I’ve made the switch to WordPress which I’ve used in the past and I have to say I’m pleasantly surprised- not only is it as good as i remember, but it’s come on leaps and bounds both feature and interface wise since I last used it.

To get WordPress up and running I had to setup PHP5, mySQL (and phpMyAdmin to save me the pain of mySQL command line syntax again) under IIS7 which I also found to be easy (all up and running within an hour!) following the guides over on the TrainSignal training website

No Comments

MySQL 5 / phpMyAdmin Installation – root account not accepted

I recently installed mysql 5 under Windows 2003, with phpMyAdmin running under IIS 6 and came across an issue trying to get phpMyAdmin to access the database- I found that the root credentials were’nt accepted. The error i receive was

“#1251 – Client does not support authentication protocol requested by server; consider upgrading MySQL client”

Apparently this is to do with me using an older version of phpMyAdmin and how the passwords are encrypted- I found an article on WebMasterWorld detailing how to resolve it;

Login from the command line to your MySQL database;

mysql -u root -h localhost -p
  • -u lets you set the username to use, in this case I’m using the root account
  • -h sets the host- I’m logging in from the local machine so used localhost- I havn’t enabled root access from any remote machines
  • -p indicates that you will be supplying a password

You will then be prompted the enter the password for your database. Once you’re in, execute the following sql to update the password

UPDATE mysql.user
SET password=OLD_PASSWORD('somepassword')
WHERE user='someuser';
AND host='somehost';

Once that’s done you will also want to flush the priviledges;

flush privileges;

You can now safely quit the mysql client with ‘exit’ and you are set!

This is also covered on the mySQL documentation site.


Google Code Highlighter

You may have noticed that the little snippets of code I’ve been dropping into these post’s suddenly got a bit swankier looking. This is down to a new javascript tool I found for use on blogs and the like, for highlighting code you post on your pages.

Basically you download the zip file- unzip it and copy the javascripts and css files over, then add a few lines of code to the head of your page;

You then put your code in-between >pre< tags and set a name attribute to “code” and set the class to whatever syntax you have- it has support for a whole bunch of languages including c#, vb, php, javascript, css, sql and a whole bunch of others. You can grab this plug-in from here

The install was easy- but a couple of bits did catch me out- the code sample above was the example they give you in the install page. So I blindly copied over this code to the head of my blog, and copied all the files from the zip file over to my sites js and css folders. I found that html highlighting worked fine and so did c# but vb and sql weren’t happening… It eventually clicked that you need to add the references to the additional syntax types you need as the example only has a line for the CS and XML/HTML “brush” libraries. So I popped those lines in and it worked fine.

The other problem that I had, and indeed still have until I get home to actually edit the code, is compatibility with TinyMCE which is the editor used by default in BlogEngine. I found a couple of articles which might help with this but won’t know till tonight;

As mentioned on the Wiki pages there is also the issue that adding a name value to a pre tag, isn’t valid xhtml.

No Comments

I absolutely love these. They came at the lace wigs are good quality, and very soft. Absolutely love these extensions. I just love this hair. Hair came on time, I waited until after hair extensions uk very full, no shedding and it is been installed for 3 weeks now and yes I jus ordered 3 more bundles. Lol. I definitely recommend this company for your bundles ladies. They are soft, hair bundles on the head for human hair wigs and I would continue to recommend them. I have thinner hair so they cover and blend nicely.