Page 1 of 1
Help - screen is displaying source code
Posted: Thu Nov 13, 2003 12:05 pm
by dangerousjohnny
Hi everyone,
I am fairly new to PHP, but I recently installed Apache and PHP and everything was working fine, but all of a sudden, when I run my perl scripts, the browser just displays the source code. These same scripts worked fine the other day, but now nothing works. help!
Posted: Thu Nov 13, 2003 12:07 pm
by maniac9
maybe i'm lost...but isn't this php?
Posted: Thu Nov 13, 2003 12:40 pm
by dangerousjohnny
Sorry, meant PHP.

Posted: Thu Nov 13, 2003 3:17 pm
by DuFF
Can you post the code of an example that is showing source code?
Posted: Thu Nov 13, 2003 3:48 pm
by Cruzado_Mainfrm
i don't think he needs to post source code, i think he has somehow misconfigured apache in the httpd.conf file, check that file and look where there php interpreter is aliased, maybe you changed php.exe to another folder, check that too
hope this helps
ps. this is a PHP Code forum, this post should be moved to the General forum
Posted: Thu Nov 13, 2003 8:47 pm
by scorphus
dangerousjohnny, let's strip your problem. Please take the time to answer some questions:
• What system are you running?
• Where is your Apache installed?
• What PHP version is installed?
Posted: Thu Nov 13, 2003 8:50 pm
by dangerousjohnny
scorphus wrote:dangerousjohnny, let's strip your problem. Please take the time to answer some questions:
• What system are you running?
• Where is your Apache installed?
• What PHP version is installed?
Windows XP
C:/Program Files/Apache Group/Apache
php version 4.3.3
apache version 1.3.27
Posted: Thu Nov 13, 2003 9:00 pm
by scorphus
Ok, now open the file C:\Program Files\Apache Group\Apache2\conf\httpd.conf and look for these lines:
Code: Select all
ScriptAlias /php/ "c:/php/"
Action application/x-httpd-php "/php/php.exe"
AddType application/x-httpd-php .php
Where is your PHP installed to? It must be C:\php\
Posted: Thu Nov 13, 2003 9:03 pm
by dangerousjohnny
scorphus wrote:Ok, now open the file C:\Program Files\Apache Group\Apache2\conf\httpd.conf and look for these lines:
Code: Select all
ScriptAlias /php/ "c:/php/"
Action application/x-httpd-php "/php/php.exe"
AddType application/x-httpd-php .php
Where is your PHP installed to? It must be C:\php\
Yes I have all of that in my httpd.conf and php is installed in c:\php\
I don't know why, it worked last week.
Posted: Thu Nov 13, 2003 9:08 pm
by scorphus
Are you sure about the file extensions? Create a new file inside C:\Program Files\Apache Group\Apache2\htdocs, name it test.php and write this:
to it. Point your browser to
http://localhost/test.php. What you get?
Posted: Thu Nov 13, 2003 9:12 pm
by dangerousjohnny
scorphus wrote:Are you sure about the file extensions? Create a new file inside C:\Program Files\Apache Group\Apache2\htdocs, name it test.php and write this:
to it. Point your browser to
http://localhost/test.php. What you get?
Hey, that worked! Maybe it was because I was using my browser then file->open and selecting the files that it wasn't working.
Thank you very much!
Posted: Thu Nov 13, 2003 9:22 pm
by Paddy
That is exactly why it wasn't working, not maybe.
With an html file you can just open it locally via the browser. With a php file you need to have php installed and then open it with a http address.
And just for you info. If you want an external computer to look at your php stuff you can swap "localhost" with your IP address. Not part of your problem but if you are new to this you may wanna know that.
Posted: Thu Nov 13, 2003 9:29 pm
by scorphus
You're welcome, I'm glad it works! Remeber all PHP execution is made by the webserver. So to see how your PHP pages are 'running' you have to request them from the webserver (Apache via HTTP,
http://localhost in your case) not to the file-system (Windows' file-system via file->open). Do this last when going to edit them...
Well, it's all nice now

have fun!
Regards,
Scorphus.
Posted: Fri Nov 14, 2003 2:59 am
by twigletmac
Moved to miscellaneous.
Mac