PHP
Help: Uploading MP3s on WordPress doesn’t work
Today I ran into a minor issue with WordPress.
When uploading an MP3 file (in my case, although I’m sure many other file types) — I was getting an “HTTP Error” or “Internal Server Error” depending on how I uploaded the file. The file wasn’t even that big, just a 150K test file.
There were 2 things that had to happen..
Add an MP3 Mime Type
Out of the box, WordPress doesn’t want you to upload an MP3 file to the Media Library. You have to add it.
You can do this by using the “upload_mimes” hook in your functions.php file:
function addMimeTypes($mimes) {
$newmimes = array_merge($mimes, array(
'mp3' => 'audio/mpeg'
));
return $newmimes;
}
add_filter('upload_mimes', 'addMimeTypes');Disable FastCGI
Yes, unfortunately FastCGI use of PHP was causing me to have problems so I had to switch back to PHP being run as an Apache Module.
To do this, you’ll have to find out per your hosting provider how to do this. I’m at Media Temple and it was pretty easy.
Keep in mind that FastCGI lowers your memory usage, and disabling it may have other negative effects.
SOPA Protest Today
It seems like quite a number of sites have joined in the SOPA protest.
Some interesting one’s that I’ve seen have been:
- Google
Given their high profile, I was happy to see the logo was blacked out today in protest of SOPA. - Ars Technica
I like the way they blended a protest, with staying functional. Personally I’d prefer to show the site “down” as in “black”, but they were creative with an inverse color scheme. - Wired.com
This is one of my favorites. It looks much more like “censorship” than any other just black site. SOPA is about both censorship, and the shutting down of innocent sites.
If you want to join in the protest against SOPA and PROTECT-IP (remember, they are BOTH problems, not just SOPA) you can check out instructions (it’s very easy):
- SOPA Blackout JS – My quick writeup on how to deploy the SOPA Blackout javascript utility
- SOPA PHP snippet – pop this in the header of your includes, and you can participate too
WordPress 3.2 Gershwin Released – new interface, and much more
While we were all celebrating July 4th, WordPress 3.2 was released.
The purpose of the release seems to be in streamlining the administrative control panel for both speed and ease of use.
Included in major release, are the following:
- Heavily improved admin interface
- IE6 Support dropped (yay, don’t worry, this is only for the admin, and likely the default theme — sites will still work in IE6 if designed for it)
- PHP 5.2.4 required (does not support PHP 4 anymore)
- MySQL 5 required
- New Twenty Eleven default theme (built for us to play with, in HTML5)
- New “Zen Mode” editor removing all the distractions
Facebook Like Button: It says “likes http://example.com/page/to/like on example.com”
If you’re implementing a Facebook Like Button, and copied the code from the Like Button page to paste generically into a template, then you may have a problem.
Using the iFrame code, by default, you will end up liking the same page that hundreds of thousands of others have liked, an example button.
You need to insert your current page’s URL into that. If you’re working on a dynamic site, it’s pretty easy to insert your current page URL in many languages (ASP, PHP, ColdFusion, etc). Otherwise, just type your URL in statically.
Hosting: How to pick a WordPress Host
WordPress is a popular CMS platform (and has evolved from a purely blogging platform). If you have virtually no technical knowledge at all, start off very basic with a WordPress.com account. There are a number of things to consider.
This article will cover:
- What you need for WordPress hosting?
- What will WordPress hosting cost?
- What else is important for WordPress?
- What hosts are any good?
- What about Email hosting?
PHP Email – A Beginners Guide
Saw a nicely done introduction tutorial to sending email with PHP:
PHP has a very simple mail function which is used very often for basic text mail messages. What if you need to attach files or if you need to send your e-mail messages via SMTP? Than it’s time to use a more advanced script. This is because the standard mail function has only limited standard capabilities. There are many reasons to use SMTP transport for sending e-mail messages from your web application …
You can also check out:
- mail – the basic PHP function for sending email
- PHP mail() Function
How web developers protect PHP sites from SQL injection attacks
Web developers are responsible for writing websites that work today, but also years or even decades from now (though I would argue the average website shouldn’t be left alone for a decade).
It can be difficult to protect a website against all future attacks. There is one big one we all have to be prepared for (because it is just so easy to fix)… SQL Injection attacks.
Formatting Stock Data from Yahoo Finance
Yesterday I was playing with manipulating information pulled from stocks. I ended up pulling data from Yahoo Finance, because it is just so easy to do in PHP. I ran into a problem, how would I pull all the data I needed?
I found very little documentation online, it seems that pulling data from Yahoo Finance is more of a clever manipulation of Yahoo offering CSV downloads of financial data. Yahoo mentions on discussion boards that it does not support, or help, those who use Yahoo Finance like this. I don’t believe it is against any agreements. › Continue reading
NETTUTS: 5 Helpful Tips for Creating Secure PHP Applications
NETTUTS posted an article, 5 Helpful Tips for Creating Secure PHP Applications.
Frequently PHP sites have security issues, as some things make sense but are just not fully thought out.
When doing web development, it’s nice to program for the ideal input, but we also have to assume all other possible input.
Here’s the list of 5 tips that are explained in detail in the article:
- Use Proper Error Reporting
- Disable PHP’s “Bad Features”
- Validate Input
- Watch for Cross Site Scripting (XSS) Attacks in User Input
- Protecting against SQL Injection
Favorite Software for Web Development
Sometimes when you start out doing something on computers, it seems so hard until you get the tools that everyone else uses.
In this post I’m asking everyone else for feedback, what do you like to use? Go ahead and comment it in there, I’ll add it to the article as I see em.
Below are some of my favorite pieces of software for web development, some will be very obvious (Flash, Photoshop, etc.) … some maybe not so much:
TextPad
I love textpad for basic text changes from everything PHP, to HTML, to writing notes. It’s great to have multiple documents, line numbers, quick global / file / local search and replaces etc. I use this when I’m working with source files, XML definition files, CSS files, to CFM or other formats. I love it.
HomeSite
Those of you who know homesite, will know it’s pretty much gone nowadays. The heyday was many years ago. The direct FTP editing was amazingly useful. It has some features that I still go back to now and then. Mostly search and replace functionality, FTP based editing (right on ther server … mostly), document formatting (code sweeper), and other utilitarian functions.
CuteFTP Pro
Working on the web, we all are in constant use of FTP (more so than we should be). Cute FTP has always been a staple of my software toolbox. It’s so easy to launch connections to all the FTP servers you use throughout the day, keep them open for jumping between projects. The number of protocols it supports is flexible (FTP, FTP w/ SSL, SFTP, HTTP, HTTPS, etc.), and it always seem to be able to connect. The speeds and setting are highly configurable. It’s nice having 50 simultaneous downloads going at a time.
Tortoise SVN
Whoever isn’t using SVN, should be using SVN (or CVS or whatever other version control system you can think of). Tortoise SVN is an essential windows interface enhancement to integrate SVN into the file browser. For those of you who use CVS, there’s a Tortoise CVS as well. It is easy to look at version histories, compare files based on modification dates, and to pull down new updates.
Subversion
Source control is underutilized in my experience. So many sites aren’t run with source control. Think of the advantages: automatic source control, automatic offsite backup (if you use an external host — which I would love to recommend svnrepository.com, a very cheap hosted SVN repository). Read about it, get used to it, it will save a project.
Eclipse
You were waiting for me to say it weren’t you? An open source IDE. Technically it started as a Java IDE (most Java developers should be intimately familiar with this). Thanks to add-ons developed by the community, it supports, quite adeptly, PHP and other web development technologies. It has built in SVN support, supports deployment scripts… its amazing. Try it, explore the community around it. Check out the Subclipse add-on, as well as the Web Developer Tools, and Eclipse XML Editors and Tools.
Adobe Flash (Adobe Creative Suite 4 Design Premium)
Pretty much a no brainer, you need Adobe Flash to develop flash. It’s a great tool, worth every penny.
Adobe Photoshop (Adobe Creative Suite 4 Design Premium)
Another obvious one. Photoshop is a requirements for all web development. No, you shouldn’t be doing web design work as a developer. However, there is always the need to look at colors, size things, cut up images, process original artwork, the list goes on forever. I really recommend the Adobe Creative Suite, we use almost all of the software anyway.
Microsoft Word (Microsoft Office)
You will always need this (or another decent word processor). Yes, you can get by without it. However the sheer amount of things Word can handle: Estimates, Proposals, Letterheads, Envelopes, Labels, the list goes on and on.. you will wish you had it someday.
Microsoft Excel (Microsoft Office)
Another one that you don’t always think about, but excel makes writing estimates so much easier. You can update your entire estimate based upon a new discount, manage hours, track changes. I’ve used Google’s online spreadsheets before – they are great. But they aren’t fully able to replace excel yet.
Microsoft PowerPoint (Microsoft Office)
Those proposals are much better with an accompanying presentation. Tell your clients what you do, what they need, in a way that can impact people in a conference room. Everyone yawns when it comes to yet ANOTHER powerpoint presentation, but you look unprofessional without one in most cases.
MySQL
Normally this is on a hosted platform, but you need a database to do the cooler web development projects. MySQL is cheap, but if you want you can substitute in Microsoft SQL Server, or even Oracle. In my experience if you know why you want MS or Oracle, you can pay for them. If you don’t know why you want either of those, just go with MySQL.
PHP MY Admin
Administration software is just as important as the backend engine, at least for development. It lets you manage a database online, easily, and export simply. If you haven’t used it, try it.
SQL Server Management Studio
Another tool for development on SQL servers. Same as PHP My Admin, arguably much more helpful, but it is a client app. If you’re working with Oracle, or prefer these desktop applications to the PHPMyAdmin web interface — check out Aqua Data Studio.
There are really dozens more tools I consider very useful. Not exluding:
- Versions of all browsers
- VPN Connectivity software
- Remote Desktop
- VNC Client
- pcAnywhere (not so much anymore)
- Outlook / Email Client
Last but not least, is Google. It is the best tool you will have when working in web development.
Please share, it makes me happy:
Subscribe to Email Alerts
Make a Donation
Popular Posts
Follow Me
Recent Posts
Archives
Tags
Blogroll
- 456 Berea St
- ActionScript 3 Design Patterns
- adactio – home of Jeremy Keith
- ajaxian
- Boxes and Arrows
- Chris Brogan
- CSS Globe
- InsideRIA
- Jarrod Michael Studios
- Johan Brook: Designer and Developer
- Mad Vertices
- NETTUTS
- Portsmouth Community Calendar
- Roomware Blog
- Signal vs. Noise
- Six Revisions
- Snook
- Style Grind
- Tiago’s Weblog
- Viget Extend
- Vitamin
- Whats the latest
- Woork
- zupko.info
