Re: PHP 5.2.9 Apache 2.2.11 outputs php code on Vista

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Solved: In Windows 'Explorer' in Vista, set User permissions for the htdocs - go to htdocs folder within the Apache folders, right click, Properties, Security, Edit, select your name as User, allow Full Control, Modify etc. Now open the files you created like test.php or index1.html and save them again. Then they will be accessible like http://localhost/test.php etc. Whereas without this they will be 'file not found'.

Even if there is only one User in Windows and it is also the Administrator, you need to be recognised as Administrator for the action being done, normal log on to Windows will be as User only.

I got to the above solution when I noticed the http://localhost/index.html showed Apache working, in the browser using the index.html that comes with the installation, but index1.html saved in the same folder did not appear in Windows Explorer and also was 'page not found' in the browser, even though it saved OK and was visible and loadable in the html editor. php now also works with Apache, I think I was missing from httpd.conf within <IfModule mime_module> </IfModule>:

   AddHandler application/x-httpd-php .php
   AddHandler application/x-httpd-php-source .phps


John

ioannes@xxxxxxxxxxxxxx wrote:
I still have the strange thing of saving a file in htdocs within the Apache folders (on Vista, you need to right click on Notepad from Start and Run as Administrator), but then not seeing it in Windows Explorer - must be something to do with UAC. But main problem is getting php to work with Apache. Please let me know if there is anywhere else I should look. I took the time to read the php installation notes carefully and the Apache notes (which seemed to be mostly about meeting someone in a computer fair to check their fingerprint, I joke), but to no avail.

Does anyone have a working, full, step-by-step set of instructions for Vista, PHP 5.2.9 Apache 2.2.11 ?

Thanks,

John


Original post [ed]

I have a working Apache 2.2.11 server and php 5.2.9 installed.

APACHE CONFIGURATION

Files are in: C:/Program Files/Apache Software Foundation/Apache2.2/
As per installation instructions, Apache httpd.conf is amended to add at the end of the LoadModule lines (though not between any tags):

   LoadModule php5_module "C:/PHP/php5apache2_2.dll"

   PHPIniDir "C:/PHP"

And at the end of the file:

   AddModule mod_php5.c

(Would this be .conf, not .c?). , (per php notes 'Installing as an Apache module'). On clicking Start Apache http server, this gives "Invalid command 'AddModule' perhaps misspelled or defined by a module not included in server configuration." The PHP Installation guide says to add this at the end of the AddModule section. There is no AddModule in the default http.conf of Apache 2.2.11. So for now have commented it out.

Between <IfModule mime_module> and </IfModule>, I have added:

   AddType application/x-httpd-php .php


PHP CONFIGURATION

The php.ini file is in C:/PHP.

php.ini has been amended as follows:
doc_root = "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs"

WINDOWS CONFIGURATION

I have added ;C:/PHP to the end of the string for Environment Variables.

I have re-booted and re-started.  I am testing this file:

C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php

which has
<?
print("test");
?>

and this outputs as code rather than as 'test' or it does not output at all.

When I start the Apache http server, I get:

httpd.exe: Could not reliably determine the server's fully qualified domain name
, using 10.0.0.4 for ServerName
(OS 10048)Only one usage of each socket address (protocol/network address/port)
is normally permitted.  : make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs

My ISP has a dynamic IP address system, what do I use for ServerName? Do I need a static address or registered web site name to run on home computer?

Apache httpd.conf has:
# ServerName gives the name and port that the server uses to identify itself. # This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName

Any idea what might be wrong with the php code showing?

Thanks,

John





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux