corinnem Posted May 16, 2006 Share Posted May 16, 2006 Hello 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 :( Thanks Quote Link to comment https://forums.phpfreaks.com/topic/9780-what-to-install/ Share on other sites More sharing options...
wildteen88 Posted May 16, 2006 Share Posted May 16, 2006 If you want to run your php scripts through a web browser then you are going to need to install a secound piece of software which is called Apache.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. Quote Link to comment https://forums.phpfreaks.com/topic/9780-what-to-install/#findComment-36274 Share on other sites More sharing options...
trq Posted May 16, 2006 Share Posted May 16, 2006 php (when used for web developement) is a server-side language, hence, you need a server (apache). Quote Link to comment https://forums.phpfreaks.com/topic/9780-what-to-install/#findComment-36293 Share on other sites More sharing options...
corinnem Posted May 17, 2006 Author Share Posted May 17, 2006 Thanks for that, yes im on windows server 2003 :) iis6 Quote Link to comment https://forums.phpfreaks.com/topic/9780-what-to-install/#findComment-36547 Share on other sites More sharing options...
wildteen88 Posted May 17, 2006 Share Posted May 17, 2006 [!--quoteo(post=374598:date=May 17 2006, 09:12 AM:name=coz)--][div class=\'quotetop\']QUOTE(coz @ May 17 2006, 09:12 AM) [snapback]374598[/snapback][/div][div class=\'quotemain\'][!--quotec--]Thanks for that, yes im on windows server 2000 :)[/quote]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 FileYour httpd.conf file should now be open in wordpad/notepad for editing. Now scroll down and find the following line:[code]#LoadModule ssl_module modules/mod_ssl.so[/code]And place the following lines after that line:[code]#PHP5LoadModule php5_module "C:/php/php5apache2.dll"PHPIniDir "C:/WINDOWS"[/code]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:\phpIf you have PHP4 the change the LoadModule php5_module... line to the following instead:[code]LoadModule php4_module "C:/php/isapi/php4apache2.dll"[/code]Now scroll a little further and fine the following line:[code]DirectoryIndex index.html index.html.var[/code]Now append index.php after index.html.var seperared by a space. The line should now look like this:[code]DirectoryIndex index.html index.html.var index.php[/code]Now find this line:[code]AddType application/x-gzip .gz .tgz[/code] and place the following lines after it:[code]#PHPAddType application/x-httpd-php .php .phtmlAddType application/x-httpd-phps .phps[/code]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. Quote Link to comment https://forums.phpfreaks.com/topic/9780-what-to-install/#findComment-36552 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.