Complete Novice - help appreciated

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Complete Novice - help appreciated

Postby aimee_richardson » 14. December 2007 02:06

Hello,
I am trying to help a friend with his website. It is written in PHP and MySQL. I downloaded all the services using the xxamp installer with almost no trouble. I put all my webfiles into htdocs like the directions said to. I am able to view .html files using my localhost, but all the php files are displaying the php code in the browser. I really have no idea what I am doing. Any help would be appreciated.

Thank you,
Aimee
aimee_richardson
 
Posts: 5
Joined: 14. December 2007 01:46
Location: California

Postby Izzy » 14. December 2007 02:19

What do you see when you type into the address bar of your browser http://localhost

What do you see when you double click on xampp\xampp-portcheck.exe - as I see you use Skype which conflicts with Apache on port 80 and the SSL port 443.

All ports that XAMPP needs should be Free.

Which leads me to ask is your Apache server even running?

Double clicking xampp\apache_start.bat may give you error messages that may be a clue.



This may help solve any Skype issues:
Skype uses port 80 and 443 by default.
You can alter that behaviour by going to:
Tools\Options\Connection
Untick
Use port 80 and 443 as alternative for incoming connections
You will have to decide a different port to use for incoming connections before Skype lets you save your changes.

With Skype using these incomming ports you become a supernode:
Basically you relay others calls, and messages.
Look here for more:
http://forum.skype.com/viewtopic.php?t= ... =supernode

Info from this thread:
http://forum.skype.com/lofiversion/inde ... 51147.html

Quote from this site:
http://en.wikipedia.org/wiki/Skype
wikipedia wrote:The use of end-user bandwidth in the form of supernodes, the use of closed source software in general, the use of closed source software for encryption of network traffic in particular as well as security of the software, have caused concern among open source advocates. Independent analyses of the software have addressed the latter to some degree.

And with Skype you really don't have a choice to not be a supernode.



===========================================
1. The new DeskTopXampp Launch Control for XAMPP / XAMPPlite
Posted by Ridgewood available from Ridgewood'sDTX web site

2. Build Rich AJAX Applications - Faster
TIBCO General Interface Pro Edition but FREE and Open Source
Fully working with NO donations required to get a user/password
===========================================
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Complete novice - help appreciated

Postby aimee_richardson » 14. December 2007 03:22

Thank you Izzy for your help. I did figure out the Skype thing. My apache server is running and I did get the php files to display. I am now getting error messages about access being denied to the database "ODBC@localhost" access denied. Anyway, I'm frustrated because I don't really have any background for this. I hope I get to talk to the original programmer soon and hopefully he can help me set this up in a local environment.

Best wishes,
Aimee
aimee_richardson
 
Posts: 5
Joined: 14. December 2007 01:46
Location: California

Re: Complete novice - help appreciated

Postby Scory » 14. December 2007 14:09

aimee_richardson wrote:I am now getting error messages about access being denied to the database "ODBC@localhost" access denied.


If you supply us the fully qualified error message (instead of this useless short version), we possibly could tell you to edit which file and what to change there.

Greets
Scory
Scory
 

Postby aimee_richardson » 14. December 2007 15:20

Hi Scory,
I am brand new at using any type of technical forum, so forgive my lack of savoir faire. Thanks in advance for any assistance. Aimee

Here are the error messages I am getting


Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\htdocs\include\connect_inc.php on line 6

Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in C:\xampp\htdocs\include\connect_inc.php on line 6

Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\htdocs\inc_calendar.php on line 145

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\xampp\htdocs\inc_calendar.php on line 145

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\inc_calendar.php on line 146

Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\htdocs\inc_calendar.php on line 145

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\xampp\htdocs\inc_calendar.php on line 145

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\inc_calendar.php on line 146
aimee_richardson
 
Posts: 5
Joined: 14. December 2007 01:46
Location: California

Postby LooseCannon » 14. December 2007 16:48

Hello aimee_richardson. A belated welcome to the forum for the wonderful XAMPP.

Note that it's not really XAMPP that's complication in my opinion, it's all the variations and options with Apache, PHP and MySQL, which all have to work together. One error can stop the whole show.

I'll just look at the first error, regarding the PHP function "mysql_select_db" This connects the web site with a database. The PHP code in 'your' file connect_inc.php needs to know the database name and a user account name and password for that database. That's three bits of information and the error suggests that one of them is wrong. Also, the user ODBC might have inappropriate access rights to the database and or its tables.

Before continuing, do you have access to this information and know how to connect with a MySQL database in any way?

Some general references:
http://uk2.php.net/
http://www.mysql.com/

EDIT: When you paste error messages or sections of code/script into a forum post, it may be better to use Quote or Code tags. One reason is that it's easy to read for some of us. ;)
Like this.

EDIT2: I just noticed another pet hate of mine.... It's very helpful to give threads a title that's related to the issue to be discussed. Your thread might be better named something like "PHP code appearing in browser"?

... Also, if a topic changes much, a new thread can help. However, this thread we're in is short and it's not an issue. I'm guessing you'll take my thoughts in a constructive manner! :D
User avatar
LooseCannon
 
Posts: 162
Joined: 18. September 2007 12:07
Location: Hampshire, UK

PHP code appearing in browser

Postby aimee_richardson » 14. December 2007 17:13

Hi Loose Cannon,
Thank you for the tips. I will include a subject line from now on. I was wondering why the subject line isn't just carried over from the original thread. Also, I will include the quote option when including code too.

Regarding the inability to connect to the database, I'm going to have a technical friend help me out with this. I do not have any experience connecting to a database, but I will look at the URLs you sent to me.

BTW, I notice you're from the UK. I love the Brits.

Best,
Aimee
aimee_richardson
 
Posts: 5
Joined: 14. December 2007 01:46
Location: California

Postby Izzy » 15. December 2007 02:57

Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\htdocs\include\connect_inc.php on line 6

Aimee, this error message is telling you that your script connect_inc.php has not been configured with the database credentials needed to access the MySQL database and so you are presented with this default error message.
All the other error messages are a follow on from the first error.


The database access details that usually need to be entered normally consist of these four items:
Code: Select all
define('DB_NAME', 'wordpress');    // The name of the database
define('DB_USER', 'wp');     // The user name for this database
define('DB_PASSWORD', 'pw'); // ...and the user's password
define('DB_HOST', 'localhost');    // 99% chance you won't need to change this value

Your code may appear different than the above WordPress wp-config.php or the place that you would type in these details may appear different but the script configuration requires these 4 details before it can proceed to function.

To create a database in phpMyAdmin and so have these items available to enter in your connect_inc.php file or some other included configuration file it uses to get the details, try and follow the how to below.
(I have tried to make it flow and easy to follow so please let me know if you have any issues with it.).

This example relates to WordPress, the blog, but you can easily adapt the instructions and insert your own details that your script needs where applicable.

Or let me know which script you are trying to install, commercial or open source it doesn't matter which as more than likely I have installed it at some time or another.
I could then possibly give you specific related instructions for your particular script.

Most of the instructions needed for creating a database for your script may be contained within your script's installation instructions.



If we use the info I supplied in the wp-config.php file - in the above code snippet - as an example then we create a database "wordpress", a user "wp" with a password "pw" on host "localhost" with "all privileges" to only use this "wordpress" database, like so:

Create A Database
Go into phpMyAdmin from the XAMPP welcome Page
http://localhost
Find the Tools menu
Click on
phpMyAdmin:

or go direct to phpMyAdmin using this URI
http://localhost/phpmyadmin

In phpMyAdmin
In the text box "Create New Database" type
wordpress
click on
Create

In the left hand frame find the Home icon near the top and click on it.
You will return to the first screen we just typed "wordpress" in.
In the left frame you should see "wordpress (0)".
The wordpress database is now created.

Create User
Click on
Privileges

Click on
Add a new User
Fill in the blanks
User name: wp
Host: Select Local from the drop box
Password: pw
Re-type: pw
Click on
Go (bottom right)
Click on the Home icon in the left frame again.
This will put you back to the home page once again.
We now have a user wp with a password pw.

Now we have to give the user wp privileges to our wordpress database only.

Give User Database Privileges
Click on
Privileges
In the list, find your wp user and click on the Edit Privileges icon at far right of the name.

Find the box "Database-specific privileges".
Select the wordpress database in the drop box Add privileges on the following database:
In the next screen that is displayed after selecting the wordpress database
Click on
Database-specific privileges ( Check All )
Click on
Go
Click on the Home icon in the left frame once again to return you to the phpMyAdmin home page.

We now have a database on localhost called wordpress with a user wp who has a password of pw with all privileges to use that database only.

To Check All Is Correct
Click on the database wordpress (0) in the left frame.
Click on the Privileges button in the top menu.
Check that you have the following in the Users having access to "wordpress" table.
Code: Select all
User     Host              Type                  Privileges        Grant
wp     localhost      database-specific       ALL PRIVILEGES        Yes


Thats it and you are set to go and complete your script (in this example the Wordpress script) installation.

You can use the above method to create any database with any username with any password for any script you want in the future, so keep a copy of this procedure handy for reference.

This how-to may save you some time, also it may possibly help with your learning curve for XAMPP.
Good luck!


===========================================
1. The new DeskTopXampp Launch Control for XAMPP / XAMPPlite
Posted by Ridgewood available from Ridgewood'sDTX web site

2. Build Rich AJAX Applications - Faster
TIBCO General Interface Pro Edition but FREE and Open Source
Fully working with NO donations required to get a user/password
===========================================[/code]
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby LooseCannon » 19. December 2007 17:13

:shock:

...

Izzy wins the 'Most Thorough and Well Thought Through' post award... again.

:applause:
User avatar
LooseCannon
 
Posts: 162
Joined: 18. September 2007 12:07
Location: Hampshire, UK


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 170 guests