refine Posted March 19, 2009 Share Posted March 19, 2009 I am -running Vista Ultimate 64 Apache 2.2 PHP-5.2.9-1 MySQL 5.1 I installed and configured everything, seemingly correctly. I call phpinfo() and it shows mysql and mysqli sections. C:\php is added to path. Its reading the correct php.ini file. Everything in this indicates that php is working well. However, when I try to run other php scripts, for example: <?php mysql_connect('localhost','root','password') or die('Couldn\'t connect to server.'); ?> I get a blank screen. Nothing appears when I "view source" Secondly, http://localhost does not work, so I am accessing through http://127.0.0.1 nection) I also tested this out which got me another blank screen: <html> <head></head> <body> <?php /* if the "submit" variable does not exist, the form has not been submitted - display initial page */ if (!isset($_POST['submit'])) { ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> Enter your age: <input name="age" size="2"> <input type="submit" name="submit" value="Go"> </form> <?php } else { /* if the "submit" variable exists, the form has been submitted - look for and process form data */ // display result $age = $_POST['age']; if ($age >= 21) { echo 'Come on in, we have alcohol and music awaiting you!'; } else { echo 'You're too young for this club, come back when you're a little older'; } } ?> </body> </html> any help would be welcomed thanks Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted March 19, 2009 Share Posted March 19, 2009 Make sure you're saving your PHP code within .php files. As for this issue Secondly, http://localhost does not work, so I am accessing through http://127.0.0.1 You may need to add the following line 127.0.0.1 localhost to your hosts file, which is located in C:\Windows\System32\drivers\etc NOTE: To edit the hosts file in Vista you'll need to run your editor with Administrator privileges (right click your text editor icon and select run as administrator) Quote Link to comment Share on other sites More sharing options...
refine Posted March 21, 2009 Author Share Posted March 21, 2009 yep its all in php files the localhost thing works now, thank you! Quote Link to comment Share on other sites More sharing options...
refine Posted March 22, 2009 Author Share Posted March 22, 2009 i uninstalled everything and installed wampserver: http://www.wampserver.com/en/download.php everything works perfect now (though with one script i had to remove the apostrophes inside the echo function) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.