Discuss http://localhost.test.php PROBLEM! in the PHP Development forum on Dev Articles. http://localhost.test.php PROBLEM! PHP Development forum to discuss anything related to developing applications in PHP. Topics include architecture, coding standards, and debugging methods.
Posts: 3
Time spent in forums: 57 m 28 sec
Reputation Power: 0
http://localhost.test.php PROBLEM!
Help!
I have installed Apache and PHP on Windows 2000 but cannot get the test.php file to work. The file is in the root folder and when I check out http://localhost, I can see the file in the directory.
But when I try and open it, it gives me the open/save option. When I hit open, it says "access to the specified file, path is denied...etc etc".
If anyone knows why it wont simply open the file up, please let me know! - it's driving me completely loopy. I saw someone else had a similar prob in this forum but an answer wasn't posted.
Posts: 3
Time spent in forums: 57 m 28 sec
Reputation Power: 0
Quote:
Originally Posted by MadCowDzz
I trust the URL in your Subject line is a mistake...
If not, you should be using: http://localhost/test.php
A couple of issues could be that your web server isn't rendering the PHP...
It also may be sending the wrong MIME type back to the browser...
Cheers for getting back to me..
Yes the title I typed was wrong - my apols.
As far as I know, apache should be rendering the php ok - ive ensured its been configured with the below
LoadModule php4_module php/sapi/php4apache2.dll
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
...following set up from here..http://www.php-mysql-tutorial.com/install-apache-php-mysql.php
I am very new to this as Im sure you tell! so re:MIME etc Im not totally sure what you mean - but the browser should recognise the file type ok
Posts: 3
Time spent in forums: 57 m 28 sec
Reputation Power: 0
Quote:
Originally Posted by MadCowDzz
What does your test.php file look like?
judging by the tutorial, is it just phpinfo()?
[shouldn't be a problem]
If you choose "save" when you get prompted, do you basically save your PHP Source code? Not a rendered page?
When I go to http://localhost/test.php, it prompts me to either open or save.
When I open and when I save, it saves the file as a dreamweaver file. When I open this up, it just has what I typed in notepad (<?php phpinfo();?>) in code view.
Bizarrely, I tried the same tutorial on my home computer with XP and the same thing has happened! Even when I changed tutorials, the same open/save option box happened.
Apache is installed fine as http://localhost comes up sweet each time.
I'm completely lost! For some reason it isn't recognising php files and I'm in danger of eating my own arm off in frustration. I don't want to download a package so any ideas why it's not working would be greatly appreciated!
Posts: 1,030
Time spent in forums: 1 Week 12 h 34 m 39 sec
Reputation Power: 10
Try using the header() functionat the start of your code (before outputting anything!), like this:
PHP Code:
<?php
header("Content-type: text/html");
/* Rest of PHP file */
Your server SHOULD send this header by itself, but I'm not an Apache user, so I'm not sure if the config you posted is correct (apache uses a module instead of a cgi executable)
__________________ This is my code. Is it not nifty?
"The biggest problem encountered while trying to design a system that was completely foolproof, was, that people tended to underestimate the ingenuity of complete fools."
---Douglas Adams