PHP Installation
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Installation

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old February 28th, 2006, 05:11 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 25
problem getting even basic php program to run

Hi, I hope this hasn't been asked before (I did check and couldn't find it) but here goes:

I have just installed mysql server 5.0, apache 2 and php 5 on windows XP. They all seem to be working fine - i.e I can use mysql server to add databases, tables etc no problem. I can access php files from my apache root folder - things like phpinfo() work ok.

The problem appears (or rather it doesn't) when trying to access a mysql database. I have this code:

<HTML>
<p> "at least do something!" </p>
<?php
$db = mysql_connect("127.0.0.1", "mike", "mike");
echo "connected!";
mysql_select_db("learndb",$db);
$result = mysql_query("SELECT * FROM personnel;",$db);
...

Nothing after the mysql_connect function seems to be processed. There are no error messages even. When I open the page in a browser I just get "at least do something!" and then nothing else. Needless to say the database exists and has data in it - I'm confused!

On a possibly related note when I try to run the command:
mysqladmin -ublah -p create blah in command prompt
I get this error msg:

mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to MySQL server on 'localhost' (10061)'
Check that mysqld is running on localhost and that the port is 3306.
You can check this by doing 'telnet localhost 3306'

subsequent telnetting does allow me onto port 3306 (it seems to just be spewing out some spurious symbols - though i'm guessing this is normal) so I know that the server is running.

I'd really appreciate any help
Mike

Reply With Quote
  #2  
Old February 28th, 2006, 05:33 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 25
RE: problem getting even basic php program to run

just as a bit of further clarification - i'm pretty sure that my php instalation is set up to use mysql ok (I used the manual method) as i'm not getting any undefined reference errors when I try to use mysql functions.

Reply With Quote
  #3  
Old February 28th, 2006, 05:46 PM
cplmckenzie cplmckenzie is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 13 cplmckenzie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: problem getting even basic php program to run

Uhhh, I am not quite as far along as you are, as I have yet to get php to process .php files in the /htdocs directory.

Could you post the changes that you made for apache 2.05 httpd.conf file and the changes that you made to the php.ini file to get them to work together.

Also, what files did you move to the /system or other directories..

thx

cplmckenzie

Reply With Quote
  #4  
Old February 28th, 2006, 05:59 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 25
RE: problem getting even basic php program to run

the lines that i added to httpd.conf:

#lines to make php work
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
# configure the path to php.ini
PHPIniDir "C:/php"

as for the ini file, I didn't really make any changes, I just uncommented the mysql module so that it loads automatically. Appart from that I used the php.ini-recommended that comes with the binaries.

You shouldn't have to move any files outside the php folder. mine is at c:php
You just need to add this destination the your systems PATH. (you can do this via system properties->advanced->env variables) call the new variable PHPRC and make it point to wherever your php folder is. You'l need to restart your system after this - not just log off.

Reply With Quote
  #5  
Old February 28th, 2006, 11:49 PM
lig's Avatar
lig lig is offline
"Forum Nazi"
Codewalkers Demi-God (4500 - 4999 posts)
 
Join Date: Apr 2007
Location: Jacksonville, Fl
Posts: 4,731 lig User rank is Private First Class (20 - 50 Reputation Level)lig User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 2 h 57 m 51 sec
Reputation Power: 7
RE: problem getting even basic php program to run

php5 doesn't come with mysql automagically enabled - you have to do it. The manual page for mysql tells you how (it is reletively easy in Windows). Also since you are using php5 I would recommend you use the mysqli extension rather the mysql extension (see its page in the docs also - for activation). It takes advantage of the new MySQL security and with the prepare and execute - helps stop SQL injection attacks. There is also the new PDO extension that many seem to be talking about... you may want to check into that also.

Reply With Quote
  #6  
Old March 1st, 2006, 05:48 PM
cplmckenzie cplmckenzie is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 13 cplmckenzie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: problem getting even basic php program to run

Thx anoynomous,

I will be trying the fix shortly...

regards....

Reply With Quote
  #7  
Old March 1st, 2006, 10:48 PM
lig's Avatar
lig lig is offline
"Forum Nazi"
Codewalkers Demi-God (4500 - 4999 posts)
 
Join Date: Apr 2007
Location: Jacksonville, Fl
Posts: 4,731 lig User rank is Private First Class (20 - 50 Reputation Level)lig User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 2 h 57 m 51 sec
Reputation Power: 7
RE: problem getting even basic php program to run

As for problems with your connection:
php Code:
Original - php Code
  1.  
  2. $db = mysql_connect("127.0.0.1", "mike", "mike");
  3. if(!$db)
  4. {
  5.   echo 'Connection failed. Reason: '.mysql_error();
  6. }

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Installation > problem getting even basic php program to run


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT