Showing posts with label xampp. Show all posts
Showing posts with label xampp. Show all posts

Monday, January 24, 2011

Firing Up CodeIgniter over XAMPP

 

So you want to develop web sites/applications using CodeIgniter framework on XAMPP? Here are the initial steps to make your first page work:

We will assume (1) you have successfully installed XAMPP at C:\XAMPP\ folder on your Windows machine. Otherwise, you have to read about it. (2) you have downloaded (and extracted)CodeIgniter.

STEP 1: Copy the extracted CodeIgniter files to at C:\XAMPP\htdocs\somewebfolder\

image

At this point you can open your favorite browser and navigate http://localhost/somewebfolder/ and you’ll see something like the below:

image

I know you want to see your own work! Let’s move to the next step.

STEP 2: Open \somewebfolder\system\application\config\config.php and change as follows:

FROM:

   $config['base_url'] = http://example.com/;

TO:

   $config['base_url'] = http://localhost/somewebfolder/;

STEP 3: Open \somewebfolder\system\application\config\routes.php and do the following change:

FROM:

   $route['default_controller'] = "welcome";

TO:

   $route['default_controller'] = "home";

Now, if you try to navigate http://localhost/somewebfolder/ you’ll be seing a 404 Page Not Found message. That’s fine! We just need to add home.php at the controllers folder and add another home_view.php file at the views folder.

Initial content of home.php can be

<?php

class Home extends Controller {

    function Home()
    {
        parent::Controller();   
    }
   
    function index()
    {
        $this->load->view('home_view');
    }
}

/* End of file home.php */
/* Location: ./system/application/controllers/home.php */

 

While home_view.php can have as follows

<html>
<head>
    <title>Home Page</title>
</head>
<body>
<h1>This is the home page!</h1>
</body>
</html>

There you have it! You have successfully created a home page in CodeIgniter over XAMPP.

Tuesday, August 17, 2010

How to Configure Virtual Hosts with Apache using XAMPP

If you are using XAMPP (in Windows box), the easiest way to add a new website is to create a folder at /xampp/htdocs/ and place all your PHP or HTML files there.

But, I want to make use of the existing codes stored at some other folder in my machine!

Have no worries! Simply follow these steps:

STEP 1: Open httpd-vhosts.conf found at /xampp/apache/conf/extra/.

STEP 2: Append the following lines

# My New Website
Listen *:9000
<VirtualHost *:9000>
ServerName localhost:9000
DocumentRoot "D:/path/to/your/existing/code"

<Directory "D:/path/to/your/existing/code">
   AllowOverride All
   Options +Indexes
   DirectoryIndex index.php index.html
   Order allow,deny
   Allow from all
</Directory>

ErrorLog logs/error.log
CustomLog logs/access.log common
</VirtualHost>


STEP 3: Save the file.

STEP 4: Restart Apache.

STEP 5: Navigate http://localhost:9000/ and your website should show up! Voila!

NOTES:

(1) 9000 is just some port number, you may use your preferred port number.
(2) the forward slash (/) to indicate path is necessary.

Monday, July 5, 2010

#1045 - Access denied for user 'root@localhost' (using password: YES)

Problem:

When you installed XAMPP and tried to access MySQL via phpMyAdmin you would encounter something like this



#1045 - Access denied for user 'root@localhost' (using password: YES)

Connection for control user as defined in configuration failed.

phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.

Solution:

Navigate http://localhost/security/xamppsecurity.php and provide the 'root' password.