Click to See Complete Forum and Search --> : No PHP displayed in browser?


Bknvc1
12-11-2005, 10:35 AM
I am new to setting up servers and am tring to set up a server to test my websites so I do not have to rent web space anymore.

I have Apache 2.0.55 running on my machine now. I used the windows install version because I do not know how to build it from the source. I have configured PHP 5.1.1 like the install files explained. the service starts without any errors that I can see.

My problem is when I try to test a simple PHP script I get nothing in my browser. The browser will display regular html though. If from a command prompt window I type php -i I get the list of settings I am suppost to see in my php script with phpinfo(); .

Can anyone tell me what I missed or something to try and help?

Thanks,
Bknvc1

rincewind456
12-11-2005, 10:51 AM
Are you running the php files from your web folder, usually htdocs in apache unless you set up a different folder during setup.

Bknvc1
12-11-2005, 10:57 AM
Apache's path is C:\Program Files (x86)\Apache Group\Apache2 and from there I can access my htdocs folder.

PHP's folder is simply C:\PHP

The steps I followed had the setup configured like this. Do I need to put my php file in the htdocs folder?

Does the fact I am using a 64 bit proccessor and windows 64bit version matter?



Bknvc1

rincewind456
12-11-2005, 11:00 AM
Apache's path is C:\Program Files (x86)\Apache Group\Apache2 and from there I can access my htdocs folder.

PHP's folder is simply C:\PHP

The steps I followed had the setup configured like this. Do I need to put my php file in the htdocs folder?
Yes, and then call them like 127.0.0.1/yourfile.php in the browser.

Does the fact I am using a 64 bit proccessor and windows 64bit version matter?
Bknvc1
No.

thorpe
12-11-2005, 11:03 AM
did you add the line...

AddType application/x-httpd-php .php

to your httpd.conf file?

Bknvc1
12-11-2005, 11:55 AM
I have moved the php folder into my htdocs folder and reconfigure the path in the config file. Now it wants to open the php files with dreamweaver but still will display html only pages in my browser. In the php config file I am not sure if I need to set this line or if has anything to with the problem:

; The directory under which PHP opens the script using /~username used only
; if nonempty.
user_dir =


And yes this is at the end of my apache config file:

AddType application/x-httpd-php .php


Bknvc1

rincewind456
12-11-2005, 12:09 PM
You dont and shouldn't move the PHP folder into the htdocs directory, what you need to do is put any PHP FILES, that you create in the htdocs dierctory (or any sub-directorys that you place there) then through the browser call the file you have created, remembering to add the .php suffix.

The line in the httpd.conf file that your interested in is around line 228 and is: DocumentRoot "C:/www" where I have www as my base directory you will probably have the default which will be your path to htdocs

Bknvc1
12-11-2005, 12:29 PM
I have my php file for testing in the htdocs in a folder labeled examples I was using the following to try and test the page:

http://localhost/examples/php_test.php (using 127.0.0.1 gives me the same results)

I have reconverted the files back but still having problems dreamweaver. I must have missed something but I will figure that out.

As far as my document root settings they are:

doc_root = "C:\Program Files (x86)\Apache Group\Apache2\htdocs"

Does this look right to you?


Bknvc1

rincewind456
12-11-2005, 12:46 PM
Yes that looks right.

Bknvc1
12-11-2005, 01:00 PM
Okay then my give up. I guess I will concide to the fact I can not get this to work. I apreciate you taking the time to help.


Bknvc1

naycoder
12-29-2005, 06:38 PM
If you are using the short style tags (<? .... ?> instead of <?php .... ?>), you have to make sure that the "short_open_tag" directive in php.ini is set to on

jborges
01-14-2006, 09:57 PM
Where can I change to have the short directives done???

I found the following statements:

short_open_tag = Off

#Allow ASP-style <% %> tags.
#asp_tags = Off

I'm close to the right lines???

Popcorn
01-15-2006, 07:36 AM
If people don't want the hassle of loading up all the components separatly then i suggest a one click installation program, i wouldn't normally recommend a program like this but this one works perfect with no bugs and causes no hassle.

www.appservnetwork.com

rincewind456
01-15-2006, 07:54 AM
Where can I change to have the short directives done???

I found the following statements:

short_open_tag = Off

#Allow ASP-style <% %> tags.
#asp_tags = Off

I'm close to the right lines???
Change short_open_tag = Off
to short_open_tag = On

Houdini
01-15-2006, 06:08 PM
Ether that or write your code with
<?php
all your php related stuff in here
and maybehere also then when done
?>
If you can save <?php echo phpinfo();?>
and get a table full of stuff about PHP with a blue background then your server has PHP on and running now you just need to set it up the way you wish to write code. If you are using short tags then you need to just open with <? and end with ?> if not you need <?php and ?> and that is set in the php.ini, don;t give up just make it work the way you want.

bpat1434
01-17-2006, 02:32 AM
I have PHP5, Apache2, mySQL 5, PostgreSQL, MS SQL all running in Windows XP Pro x64. It does work.

What you need to do is in your httpd.conf file (Located In: C:\Program Files (x86)\Apache Group\Apache\conf\) is add this at the bottom:
LoadModule php5_module "C:/PHP/php5apache2.dll"
PHPIniDir: C:\PHP

This will load the PHP module in Apache, and point Apache to the php.ini file which is needed for Apache to initialize PHP properly.

Then, you also need to add "C:\PHP" to your Path variable. You can do that by:

Right-click My Computer
Choose Properties
Select "Advanced" Tab
Click "Environment Variables" buttton (bottom area)
In the bottom group, where it says "System Variables", scroll down and select "Path".
It should already have a value of something like: "%SystemRoot%\system32;%SystemRoot%;"
Go to the end, and add this: ";C:\PHP"
Click "Ok", Click "Ok", Click "Ok"
Restart computer
Start Apache (if not automatically configured to do so)
Try and run a PHP script

If that still doesn't work, may I suggest you uninstall everything, and work through this tutorial:
Installing a new web server: Apache2, PHP5, mySQL, phpMyAdmin (http://www.webmasterstop.com/86.html)