Enable curl with XAMPP
cURL is disabled by default in your XAMPP installation. To enable it, you have to modify the php.ini files in your XAMPP folder. Follow the steps below to get it up and running.
- Locate the following files:
C:\Program Files\xampp\apache\bin\php.ini C:\Program Files\xampp\php\php.ini C:\Program Files\xampp\php\php4\php.ini
- Uncomment the following line on your php.ini file by removing the semicolon.
;extension=php_curl.dll
- Restart your Apache server.
- Check your phpinfo if curl was properly enabled.
How to setup a local web server on your computer using XAMPP
Web development work should always be done locally. When developing a website, all the development work should be done on a local LAMP Stack environment installed on your computer. That way, the production time is greatly reduced and you can fully test your work before launching.
When you are completely done developing your project, the migration to the live server is seamless. Here are the simple steps to install a local server on your PC to easily develop websites.
This article applies to the installation on Windows 98, NT, 2000, 2003, XP and Vista, of Apache, MySQL, PHP + PEAR, Perl, mod_php, mod_perl, mod_ssl, OpenSSL, phpMyAdmin, Webalizer, Mercury Mail Transport System for Win32 and NetWare Systems v3.32, Ming, JpGraph, FileZilla FTP Server, mcrypt, eAccelerator, SQLite, and WEB-DAV + mod_auth_mysql.
Installing XAMPP on your computer
- First, download XAMPP for Windows Installer
- Then run the installer on your computer and make sure that your Windows firewall unblocks Apache.
- Run the Apache administrator.
- Open your browser and go to http://127.0.0.1 – If all went well, a screen will appear where you can choose your language.
- Go to http://127.0.0.1/security/xamppsecurity.php and setup a password (it ill be used for your databases), and click on “Password Changing”.
Congratulations! You’re done! Now put your website’s files in a new directory under C:\xampp\htdocs\ (if you installed xampp in C:\xampp). For example: C:\xampp\htdocs\myproject\; and setup your databases using PHPMyAdmin located here http://127.0.0.1/phpmyadmin/.
Configuring Mod Rewrite
To finalize your installation, and make your development work much easier, go through the following steps to enable Mod Rewrite. This enables you to use fancy permalinks without the index.php appendage.
- Navigate to C:\xampp\apache\conf\httpd.conf
-
Open up httpd.conf in notepad and look for this line:
#LoadModule rewrite_module modules/mod_rewrite.so
-
Uncomment it so that it reads:
LoadModule rewrite_module modules/mod_rewrite.so
- Next, search for AllowOverride None and change it to AllowOverride All.
- Restart Apache by typing services.msc in either the command prompt or Start Search prompt in Vista.
Personalized Domain for your Local Environment
I’ve set my local environment to mimic my live environment as much as possible. For example, to access the local environment for my blog, I type this in my browser (http://richardcastera.dev). Here is how to set that up for each project:
- Navigate to C:\Windows\System32\drivers\etc\ and open the host file in a notepad editor. Make sure the following lines are written in the file:
127.0.0.1 localhost ::1 localhost
- Now add the following line to access your website locally via the URL myproject.dev (or any other URL you’d like):
127.0.0.1 myproject.dev
- Finally, open the file C:\xampp\apache\conf\extra\httpd-vhosts.conf in a notepad editor, and add the following lines:
NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot “C:/xampp/htdocs” ServerName localhost </VirtualHost> <VirtualHost *:80> ServerName myproject.dev ServerAdmin webmaster@localhost DocumentRoot “C:\xampp\htdocs\myproject” </VirtualHost>
That’s it! Hope you enjoyed the post!
How to Create a Custom 404 Error page with .htaccess
Everyone’s encountered those standard 404 error pages that yield little or no information. Most new systems have this feature built in by default and often times are pretty fancy with informative to funny graphics and lots of options on what to do next but, if your working on updating an old site not using dynamically based web pages then, your going to have to add one manually. For your user’s experience, it’s better to provide a helpful error message and links to where they can continue on their quest for information. You don’t want to scare your visitors away do you? Here’s how to add your own custom 404 error page to your website:
If you don’t already have an .htaccess file in your servers root, go ahead and create one. Now you need to instruct .htaccess where your custom error page is. In this example, I have the 404 document which I created with my editor that provides lots of useful information for users to continue browsing my site. Now add this line to your .htaccess file and that’s it!
ErrorDocument 404 /404.html
Disallow hotlinking while allowing requests from robots.txt and favicons
We all hate Leechers. Here’s how to stop them in their tracks from stealing your images and your bandwidth!
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !(^/robots\.txt|\.ico)$
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp|pdf)$ [F,L]
Creating an .htaccess file on Windows
Everyone who has tried creating a .htaccess on windows knows that Windows Explorer does not accept the ‘.’ character as the first character of a file. For most of you this may be old stuff, but for the newbies, the quick way to create a file that starts with a ‘.’ is actually pretty simple.
Open notepad and save the document with file name .htaccess with the ‘save as type’ set to ‘All Files’; or save the document with file name as “.htaccess” including the quotes. Hope this helps someone!
htaccess – How to redirect all http (port 80) requests to https (port 443)
Sometimes you may need to redirect http requests on port 80 to (https) on port 443. This can easily be accomplished with .htaccess.
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [NC,R,L]
Using SSH and Unix commands
Having some basic knowledge of SSH and Unix commands is very useful. Developed in 1995, SSH (Secure Shell) was created as a secure alternative to Telnet. Telnet is a protocol allowing for command line access to a Unix, Linux or FreeBSD based remote computer. I’ve listed some basic commands to get you familiar with them.
The cd command is used to move to a specific directory.Command: cd Format: cd /directory/to/browseThe cp command will copy the file or folder from the source, to the destination.
Command: cp Format: cp /directory/source /directory/destinationmkdir creates a directory.
Command: mkdir Format: mkdir /directory_to_createThe rmdir command deletes a directory.
Command: rmdir Format: rmdir /directory/to/deleteThe rm command deletes a file.
Command: rm -f Format: rm -f filenameThe mv command will rename or move a file stated in the first portion to the name or location stated in the second portion.
Command: mv Format: mv /directory/you/want/to/rename/or/move /new/directory/name/or/locationThis command will tar zip the files in the directory specified in the second portion into a tar file specified in the first portion.
Command: tar cvf Format: tar cvf filename.tar.gz /directory/you/wish/to/archiveThe tar -xvf will extract all files from the tarball specified into the directory you are currently in.
Command: tar -xvf Format: tar -xvf filename.tar.gzThis will create a zip file, with the name specified in the first portion from the file or directory listed in the second portion.
Command: zip Format: zip filename.zip /file/or/folder/you/want/to/zipThis command will unzip or un pack the named zip file, into the directory you’re currently in.
Command: unzip Format: unzip filename.zipThe Ls command lists files, and folders within the directory you specify
Command: ls Format: ls /directory/you/wish/to/list/files/This will add a forward slash to the directory names within the directory you specify
Command: ls -f Format: ls -f /directory/you/wish/to/list/files/This will show “hidden” files in the directory you specify
Command: ls -a Format: ls -a /directory/you/wish/to/list/files/This command shows detailed info about each file in the directory you specify.
Command: ls -l Format: ls -l /directory/you/wish/to/list/files/
Also, a lightweight, freeware application which supports SSH commands that I use is, PuTTY.
-
Beware the heat-seeking Nerf machine-gun coming to a cubicle near you http://om.ly/svHF #fb
- Follow me
Last Tweet
-
Archives
Categories
My Favorites
- 37 Signals
- Andrew Warner
- Chris Coyier
- Chris Shiflett
- Collis Ta'eed
- Development Seed
- Drupal
- HubSpot
- James Padolsey
- Joel On Software
- John Resig
- jQuery
- Kevin Rose
- Life Hacker
- Magento
- Mashable
- Matt Cutts
- Matt Ryan
- MySQL
- NetTuts
- Noupe
- Photoshop Tutorials
- PHP
- Smashing Magazine
- Tech Crunch
- WoorkUp
- Wordpress
