what to install
Posted 16 May 2006 - 02:40 PM
Im trying to get PHP installed on a server at work , i only want to run php scripts, when i installed and then tried to run a script through a web brower it just gave a page cannot be displayed error, Ive look through these forums and lots of people seem to be mentioning apache - do i need this also , any help at all is appreciated. How do i get php scripts to run
Posted 16 May 2006 - 04:04 PM
NOTE: if you are on windows then [a href=\"http://mirrors.dedipower.com/ftp.apache.org/httpd/binaries/win32/apache_2.0.58-win32-x86-no_ssl.msi\" target=\"_blank\"]click here[/a] to download it.
Note: when you go to install apache it will ask you for your network/server name settings just put localhost in both boxes and then your or a fake email address in the third box.
Now before you can run your php scripts via a web browser you need to tell Apache to parse any .php files with the PHP Intepreter. I will be able to help if you confirm you are on Windows.
Posted 16 May 2006 - 04:47 PM
Posted 17 May 2006 - 09:05 AM
Thanks for that, yes im on windows server 2000
As you are on windows i can provide infomration on setting up php to parse .php files with the PHP Intepreter.
OK by now you should have apache installed on you computer and that Apache is working. You can test this by openning up a web browser such as Internet Explorer and typing in [a href=\"http://localhost\" target=\"_blank\"]http://localhost[/a] when you go to that address you should see the Apache Welcome page which confimrs apache is working.
Now to configure apache. First find where your Apache httpd.conf file is located to and open it up. You can easily retrieve the file by going to Start > All Programs > Apache HTTP Server 2.0.58 >and click Edit the Apache httpd.conf Configuration File
Your httpd.conf file should now be open in wordpad/notepad for editing. Now scroll down and find the following line:
#LoadModule ssl_module modules/mod_ssl.so
And place the following lines after that line:
#PHP5 LoadModule php5_module "C:/php/php5apache2.dll" PHPIniDir "C:/WINDOWS"NOTE: As I didn't kwo the version of PHP or where you have install PHP i presumed you had PHP5 and PHP was installed in C:\php
If you have PHP4 the change the LoadModule php5_module... line to the following instead:
LoadModule php4_module "C:/php/isapi/php4apache2.dll"
Now scroll a little further and fine the following line:
DirectoryIndex index.html index.html.varNow append index.php after index.html.var seperared by a space. The line should now look like this:
DirectoryIndex index.html index.html.var index.php
Now find this line:
AddType application/x-gzip .gz .tgzand place the following lines after it:
#PHP AddType application/x-httpd-php .php .phtml AddType application/x-httpd-phps .phps
Save your httpd.conf file.
Now to setup PHP a little. You need find a file called php.ini-recommended and rename that file to just php.ini. Now copy the renamed php.ini file to C:\WINDOWS folder. The php.ini-recommended file should be in the root for the PHP installation folder (C:\php)
And thats it! If you have setup the LoadModule line correctly then Apache should start with no beeps or errors when you restart it and you should now be able to run you PHP scripts via the web browser by going to [a href=\"http://localhost/filename.php\" target=\"_blank\"]http://localhost/filename.php[/a]
To restart Apache you should see a little icon in the bototm right hand corner of the window in the system tray which has small green triangle pinting to the right inside a white circle and purple line coming out from the circle. That is the Apache system tray icon. If you click on that and select Apache 2 from the menu and click on Restart. Apache will attempt to restart itself allowing for the new configuration settings to become available.
Note: You have to store your PHP, html and any other files you want be seen by the server in the htdocs folder whcih is in your Apache installation folder (the location of the folder is someting like C:/Program Files/Apache Group/Apache 2/htdocs)
There will be files in that folder already. I would either delete these files or move them to a new folder called htdocs_old. That way your htdocs folder is empty and you dont keep getting the Apahce welcome message everytime you go to [a href=\"http://localhost/\" target=\"_blank\"]http://localhost/[/a] instead you'll see a file directory with a list of your files and folders currently in your htdocs folder.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users