Well in my room I have this PC which isnt connected to the internet. Now instead of me just using it to play games and to create random and rubbish web designs it would be better if I put it to some use.
How can I install PHP on it so that i can run PHP scripts?
Because i want to learn PHP and this would be a good place where i good try stuff out and practice my scripts.
you will need IIS or another program forgot what it is called though installed on your computer (it might be apache)
what operating system have you got on the computer?
go to start - programs - administrative toold - then look for Internet Informations Systems (IIS)
you need that installed to be able to run php - this is where i dropped out of uni so i cant be much more help now i dont know how you set it up how you do anything with it but i know you should have a file called wwwroot on your computer somewhere and your php should be kept in that
Forget IIS, Apache works perfectly on Windows (and with less of the overhead).
Go download Apache2 and install. Then go download PHP (Zip archive). You can read the Install.txt file, but in a nutshell what you want to do (installing PHP as a SAPI module):
1. Extract the PHP archive
2. Copy php4apache2.dll and php4ts.dll and php.ini to your Apache2 directory.
3. Open up conf/httpd.conf and add these lines to the bottom:
[code:1:ece3d40b97]LoadModule php4_module php4apache2.dll
AddType application/x-httpd-php .php[/code:1:ece3d40b97]
You might want to stay away from PHP5 until at least the next release, there are a few annoying bugs that'll kill some stuff.
well i tried it and when i go to test the configuration setting sof rapache it says that there is invalid syntax on line 971 - which is where i placed that bit of code in conf/httpd.conf
ok well apache the actual program is already started because its down in the taskbar(bottom right) but it says that its not actually running the service.
so because it wont start running it i went to test configuration and i got that error.
oooo sweet. ok i took away those lines and apache is running fine and its running the service.
The thing in the notification area is just the Apache service monitor, you can even exit that if you want.
You have to tell Apache to load PHP as a module, which is what those lines are supposed to do. Not sure why it's giving you an error. Even if the were missing files somewhere, it'd complain about missing files, not syntax errors. Here, even read the install:
Web server configuration
========================
Installing PHP on Windows with Apache 1.3.x
ATTENTION: Apache 2 Users
At this time, support for Apache 2 is experimental. It's
highly recommended you use PHP with Apache 1.3.x and not
Apache 2. Documentation for installing Apache 2 on windows
can be seen here:
With the basic difference being that when installing as a
module you'll use php4apache2.dll instead of php4apache.dll
Both files are included within this release.
There are two ways to set up PHP to work with Apache 1.3.x
on Windows. One is to use the CGI binary (php.exe),
the other is to use the Apache module dll. In either case
you need to stop the Apache server, and edit your
httpd.conf or srm.conf to configure Apache to work with PHP.
We'll refer to either of these files with httpd.conf in the
text.
Although there can be a few variations of configuring PHP
under Apache, these are simple enough to be used by the
newcomer. Please consult the Apache Docs for further
configuration directives.
Installing PHP for Apache as module
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Now that version 4.1 introduces a safer sapi module, we recommend
that you configure PHP as a module in Apache.
To accomplish this, you have to load the php4apache.dll in your
Apache httpd.conf.
!! NOTE !!
Whereever you load php4apache.dll from, php4apache.dll also
needs the php4ts.dll also included in the PHP4 distribution.
php4apache.dll depends on php4ts.dll which is loaded as soon as
Apache loads php4apache.dll. If php4ts.dll can't be found, you
usually get an error like (also see the "Problems?" section at
the end of the file):
Cannot load c:/php/sapi/php4apache.dll into server
So where does php4ts.dll has to be to be properly loaded ?
php4ts.dll is searched in the following order:
1) in the directory where apache.exe is start from
2) in the directory where php4apache.dll is loaded from
3) in your %SYSTEMROOT%\System32, %SYSTEMROOT%\system and
%SYSTEMROOT% directory.
Note: %SYSTEMROOT%\System32 only applies to Windows NT/2000/XP)
4) in your whole %PATH%
Note: What is %SYSTEMROOT% ? Depending on your Windows
installation this may be for example c:\winnt or C:\windows
Usually you would just copy it over to %SYSTEMROOT%\System32.
But if you want to have multiple PHP installations (for
whatever reason) this is a bad idea. For this circumstance the
safest thing is to let php4ts.dll reside in the same directory
where php4apache.dll is loaded from (see point 2 above).
After you've set up the file layout properly, you're ready to
finally configure Apache to load the PHP4 module. Just add the
following lines to your httpd.conf:
Note: Especially newer versions of Apache do not need the
AddModule directive anymore, your milage may vary.
Where do I have to put the php.ini ?
The php.ini files is only searched in two places:
1) in your Apache installation directory (e.g. c:\apache\apache)
2) in your %SYSTEMROOT% directory.
Installing PHP for Apache as CGI binary
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you wish to install PHP as a CGI binary, read this first:
Note, we consider installing PHP like this suicidal.
As a further precaution, we recommend you change the "/php/"
ScriptAlias to something more random, to prevent the binary being
called directly, which is a security risk.
Remember when you have finished to restart the server, for example,
NET STOP APACHE
followed by
NET START APACHE
To use the source code highlighting feature, add the following
line to your apache httpd.conf file:
AddType application/x-httpd-php-source .phps
Note, this will only work when you install php as a sapi module.
If you wish to use this feature with the cgi binary, create a new
file, and use the show_source("path/to/original_file.php"); function.
Forward or backslash in pathnames ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
On Win-Apache, path names can contain either forward- or backslashes.
Example:
I was able to install a service that emulates a webserver as well as PHP4 on Windows XP, independently being Pro or Home (and everything almost with just clicking a button PLUS I am talking free-ware): just go to http://www.freeguppy.org/ and get the freeGuppY package.
Comments
what operating system have you got on the computer?
The Royal Ram
The Royal Ram
you need that installed to be able to run php - this is where i dropped out of uni so i cant be much more help now i dont know how you set it up how you do anything with it but i know you should have a file called wwwroot on your computer somewhere and your php should be kept in that
The Royal Ram
Go download Apache2 and install. Then go download PHP (Zip archive). You can read the Install.txt file, but in a nutshell what you want to do (installing PHP as a SAPI module):
1. Extract the PHP archive
2. Copy php4apache2.dll and php4ts.dll and php.ini to your Apache2 directory.
3. Open up conf/httpd.conf and add these lines to the bottom:
[code:1:ece3d40b97]LoadModule php4_module php4apache2.dll
AddType application/x-httpd-php .php[/code:1:ece3d40b97]
You might want to stay away from PHP5 until at least the next release, there are a few annoying bugs that'll kill some stuff.
Webmaster-Talk.com
Chroder.com
The Royal Ram
this is really confusing!
The Royal Ram
Webmaster-Talk.com
Chroder.com
The Royal Ram
Webmaster-Talk.com
Chroder.com
thats about it
The Royal Ram
Webmaster-Talk.com
Chroder.com
so because it wont start running it i went to test configuration and i got that error.
oooo sweet. ok i took away those lines and apache is running fine and its running the service.
but how does php come in to this?
The Royal Ram
You have to tell Apache to load PHP as a module, which is what those lines are supposed to do. Not sure why it's giving you an error. Even if the were missing files somewhere, it'd complain about missing files, not syntax errors. Here, even read the install:
Webmaster-Talk.com
Chroder.com
maybe it just cant load the dll
The Royal Ram
Webmaster-Talk.com
Chroder.com
im gonna uninstall apache totally and start over. maybe i messed something up but i doubt it.
The Royal Ram
I hope that helps. :rolleyes:
http://www.RadcliffeRiverside.co.uk
http://www.Browser-X.com