Monthly Archives: March 2014

look up the geographic location of an IP address from the command line

curl ipinfo.io/121.97.151.32

Advertisements

Helm Custom Errors

I know, it’s old, but hey.

So setting the custom 500 in helm only gets applied to the iterations.

You need to go to the dom in iis 6, get up properties, go to Custom Errors tab and set as URL to what it says in helm.

Bingo!

plesk mail enable logs

Plesk and mail, there are many different ways to set it up.

When we saw an issue with imap making the cpu go crazy we wanted to see the que, but, no managment software, so we went to the logs and it shed light, wooha

C:\Program Files (x86)\Parallels\Plesk\Mail Servers\Mail Enable\Logging\IMAP

HTTP Error 404.4 – Not Found The resource you are looking for does not have a handler associated with it.

See this error, Plesk 11 on Win Server 2012, in plesk go to the domain and then Customizing Subscription, then the Permissions Tab, make sure ‘Hosting settings management’ is ticked, save.

Now check the versions of .net on the dom in plesk.

In IIS on the server make sure the IUSR for that dom is set on the dom.

(Also handler mappings may need to ‘Revert to Parent’

One thing I noticed is that trying this wiped the asp and .net settings at some point, so, I;ll keep an eye on that.

Most likely causes:

  • The file extension for the requested URL does not have a handler configured to process the request on the Web server.

Things you can try:

  • If the file extension does not have a handler associated with it, add a handler mapping for the extension.
  • Verify that the handler associated with the file extension is properly installed and configured.
  • Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.

Detailed Error Information:

Module    IIS Web Core
Notification    MapRequestHandler
Handler    Not yet determined
Error Code    0x80070002
Requested URL    http://cgp-engineering.com:80/
Physical Path    D:\domains\cgp-engineering.com\httpdocs
Logon Method    Anonymous
Logon User    Anonymous

More Information:

This error means that the Web server does not recognize the file extension of the requested resource. A module handler is not configured on the Web server for this extension. If the file extension being denied is required by the Web server, add the appropriate handler for the file extension.View more information »

Easy apache is your chum

Need to add a module to php on your whm/cPanel install, have no fear, easy apache is your chum

From here….

http://forums.cpanel.net/f5/enable-install-mbstring-module-158165.html

Let me give you the EasyApache 101:

1. You can access EasyApache by going to the Software section of WHM and clicking on EasyApache. Command-line folks can just use /scripts/easyapache.

2. If you’re asked to update, do so then come back to this screen. Updates often contain enhancements to allow EasyApache to support updated technologies.

3. On the first screen (“1. Profile”), select “Previously Saved Config (** DEFAULT **)” and then click on “Start customizing based on profile.”

This setting will display your current settings throughout the rest of the EasyApache interface. This way you don’t need to lookup what your current configuration is, you just change the items you want to have changed (e.g. adding mbstring support to PHP)

4. Continue clicking “Next” until you get to “5. Short Options List” then click “Exhaustive Options List” at the bottom of the page.

5. Under PHP, check the checkbox for “Mbstring” then click “Save and Build”

6. Follow any further on-screen instructions that appear.

The cool thing about EasyApache is that it will ensure everything will work before attempting to apply it to your server. In the relatively rare event that something fails, your current configuration is restored and you will be prompted to allow us to investigate what happened so we can resolve the issue.

Export table from database to csv file

From here

http://stackoverflow.com/questions/14212641/export-table-from-database-to-csv-file

From SQL Server Management Studio

 1. Run a SELECT statement to filter your data
 2. Click on the top-left corner to select all rows
 3. Right-click to copy all the selected
 4. Paste the copied content on Microsoft Excel
 5. Save as CSV

Using SQLCMD (Command Prompt)

Example:

From the command prompt, you can run the query and export it to a file:

sqlcmd -S . -d DatabaseName -E -s, -W -Q "SELECT * FROM TableName" > C:\Test.csv

More information here: ExcelSQLServer

Notes:

  • This approach will have the “Rows affected” information in the bottom of the file, but you can get rid of this by using the “SET NOCOUNT ON” in the query itself.
  • You may run a stored procedure instead of the actual query (e.g. “EXEC Database.dbo.StoredProcedure”)
  • You can use any programming language or even a batch file to automate this

Using BCP (Command Prompt)

Example:

bcp "SELECT * FROM Database.dbo.Table" queryout C:\Test.csv -c -t, -T -S .\SQLEXPRESS

More information here: bcp Utility

Notes:

  • As per when using SQLCMD, you can run stored procedures instead of the actual queries
  • You can use any programming language or a batch file to automate this

Hope this helps.

 

(it totally did 🙂 )

Unable to fetch the cPanel user file for

I was trying to change the domain name on an account in WHM and got the above error.

This fixed it

“Unable to fetch the cPanel user file for username”

The fix was:

open the file /var/cpanel/users/username and check the line

username=

Make sure that teh above entry is the current username

Also the ownership of the file should be root.username

from here…

http://vishnulinux.wordpress.com/2013/01/06/unable-to-fetch-the-cpanel-user-file-for-username/