a site about nothing
Share

In this section:

Main Tips Windows
PHP-HTML-Unix
Running 16-Bit
Linux @ Windows
Modular Website
Optimize Website
Expiring Domains
Optimize Dial-Up
Decode URL

Apps
Firefox
Indesign
Photoshop
Illustrator
Shortcuts

PHP
Top PHP Scripts
SMF 1.1
SMF 2.x
PhpList
Talkback
Sphider
EditThisPagePHP

Other
Storage
Top 3 SEO Tips
SEO Traps
Spam Revenge
Holy Apple
Links


Awesome book


Server Tips: Unix—PHP—HTML

Page copy protected against web site content infringement by Copyscape

Coming from dos and windows, unix and server software are a different world. In that world, I am always amazed how hard it is to get an answer to the simplest question despite the profusion of bulletin boards brimming with experts. It always seems that they give you the information one bite at a time, so that you have to reply "I don't understand" about five times until you get to the bottom of the question. Why this hazing process evolved in that world, I don't know. Since I find it so hard to locate information for dummies like me, I started documenting the things I learn in this page.

What is the equivalent of a batch file in unix?

In DOS you can type a list of instructions and save then in a file with the .bat extension.
In Unix, you can type your instructions in a file with the .sh extension. Upload the file via ftp. Connect to a command line prompt via telnet (shell). To run the sh batch file, type sh myfile.sh (replacing "myfile" with the name of your file).

How to unpack a tar.gz file on a unix server

Upload via ftp. Connect via telnet.
gzip -d filename.tar.gz
tar -xvf filename.tar


How to customize items of an html list?

If you'd like to change the color (size, font etc) of certain lines in a list, proceed like this. In your css, create new "li" styles like so. (My second style here is called "latest".)

#avmenu li#latest a { color: #ffc500; }
#avmenu li#latest a:hover { color:#ffe077; }

In your html list, distinguish the two styles like so:

< ul>
< li> < a href="page1.html" rel="nofollow">Normal Style < /a>< /li>
< li id="latest"> < a href="page2.html" rel="nofollow">Latest Style! < /a>< /li>
< li> < a href="page3.html" rel="nofollow">Normal Style < /a>< /li>
< /ul>


Note that the rel="nofollow" is not necessary. I am using it here to tell crawlers not to visit these pages, as they don't exist on my site.

HTML: special characters for pretty text

Here are the codes for a few special characters to embellish text. Don't leave out the semi-colon (";"), it's part of the code.

Em dash, En dash ( —, – ): &mdash; &ndash;
Ellipsis ( … ): &hellip;
Non-breaking space (   ): &nbsp;
Smiley ( ☺ ): &#9786; (in the next html spec, it may be &smiles; )
Single curly quotes ( ‘, ’ ): &lsquo; &rsquo;
Double curly quotes ( “, ” ): &ldquo; &rdquo;
Copyright, Trademark ( ©, ™ ): &copy; &trade;
Euro, Pound, Cent ( €, £, ¢ ): &euro; &pound; &cent;
Fractions ( ½, ¼, ¾ ): &frac12; &frac14; &frac34;
Notes ( ¹, ², ³ ): &sup1; &sup2; &sup3;
…and here's more and more.

How to have nice urls in a forum

This tag doesn't work everywhere, but I came across many sites where it did.
[url=http://yoursite.com]tag text[/url]
I like it because I thought the [url] tag did not allow you to have linked text in there, just the url.

Adding a "Play" button to play MP3s

There are several free solutions, but I paid $20 for Wimpy Button Bridge by Wimpy, because the code required for each track is extremely compact (and some of my pages have many tracks). You can see the script in action on my Southern Accent page. The best-known open-source equivalent is XSPF, which I haven't tried yet as it looked like a bit more code to add on the page.

Wiki Markup: The Wikipedia Language

This is a placeholder for tidbits I learn about Wiki markup, the language for editing Wikipedia.

To link to another Wikipedia entry, use [[double brackets]].

To create a reference, use the <ref> tag in the middle of the text, like so:

...and that was just amazing.<ref>[http://www.mindblowingstories.org Mind-Blowing Stories], an authority on amazing stories.</ref>

The reference will be automatically appended to the reference section.

Get php to Parse your html files on Hostgator

Add this to your .htaccess file:
AddHandler application/x-httpd-php5 .php .htm .html

Cannot Delete File

Sometimes you just cannot delete a file or folder using FTP or file manager. Chances are your permissions are messed up. If you have SSH access, ask your host to install the "perms" script or run it for you.

Once the script is installed, on a Hostgator VPS, login to your Power Panel. Select "SSH Connection", login, then place yourself in the root of the problematic account:
cd /home/YourAccountName

From there, just type "perms" and wait for the script to do its magic!

Troubleshoot "500 Server" Errors

Sometimes, whatever you do to install an application, the browser throws a 500 error at you when you try to run it. Here are a couple things you can try:

1. Check the .htaccess file at the root of the folder where the application resides (and also in subfolders). Chances are there is an offending line.

2. Run "perms" as explained above under "Cannot delete file".

Ho to remove cPanel lock-out

cPanel is super sensitive to passwords. If you change your passwords and change it again in the next minute, you have just performed a "brute force attack", and you'll be locked-out of your account! If this happens and you have a VPS with Power Panel,

1. Log in to your Power Panel. Click on "SSH Connection", login and type this line:
echo "delete from brutes; delete from logins;" | mysql cphulkd

2. You should now be able to login to WHM. Login. Under "Security Center", choose "cPHulk Brute Force Protection". At the bottom, you'll see links to flush the database and to add yourself to the list of trusted IPs (go to what is my IP to find out your IP).

3. Go to "Account Functions", "Password Modification". That's a better place to manage your passwords than the individual cPanels.

Apache Tips

To find out what mods are installed (e.g., mod_deflate, mod_expires), in an SSH window, go to root and type: httpd -l

By the way, httpd -h will show you a lot of other options for the httpd daemon command (httpd). For instance,
httpd -v will show you which version of Apache you are running.

.htaccess Tips

Options -Indexes prevents users from viewing the index of a folder and the folders below it.

DirectoryIndex index.html index.htm tells Apache the priority in which index files should be used if they exixt (files can be added to the list, e.g. index.php or strange.name.html)

Redirect /myfolder http://www.mynewsite.com helps when you're ready to move a subfolder to a standalone site. It can also be used to redirect individual files.

Must-Have PHP Scripts

This section got too big, so I made a page just for the top php scripts that one might consider installing when building a new website.

Links

When you're done moving a website, Webslug helps you compare how fast they load.

Here's a great article about CSS Form design.

Warm regards,

Andy

ps: If you have enjoyed this page, I would be immensely grateful if you would link to it, bookmark it or share it. You can also comment using the form below.


There is 1 comment
psychicdog – Australia
May 27, 2009 - 05:34
Subject: Great stuff for Webmasters here

Thanks for the tips Andy. Love your work! I've just developed a member's login site: psychicdog.net. Check out roscripts.com if you're ever looking for member's login stuff. Also, CodeIdol if you're looking for a great registration form in php that processes errors in the form. Let me know if you need more info.

Leave a Comment






To prevent automatic spam, we require that you type the two words below before you submit your comment.

Powered by TB

(c) Copyright asiteaboutnothing.net