|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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.
|
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
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. |
|
#5
|
||||
|
||||
|
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.
|
|
#6
|
|||
|
|||
|
RE: problem getting even basic php program to run
Thx anoynomous,
I will be trying the fix shortly... regards.... |
|
#7
|
||||
|
||||
|
RE: problem getting even basic php program to run
|
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Installation > problem getting even basic php program to run |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|