|
kambo (m)
|
INSTALLING APACHE,MYSQL AND PHP on WINDOWS ============================================ Assumptions: ---------- your using windows NT technology ( any later than win ME. i.e 2000,xp,nt,more likely xp.) i your root drive is C:\
I assume your installing packages for development purposes(web dev. etc ) on a local machine.
Lay hands on the following tools (windows version) php,apache,mysql. download, zip versions(for php) and windows installer versions for mysql and apache .
MYSQL ===== DOWNLOAD MYSQL FROM -------- DOWNLOAD THE ONE WITH THE .zip /msi installer. open on your machine and by double clicking, when installing , install as typical,choose the 'typical' option. when requested to 'create a new account' click 'skip sign up'. uncheck the 'configure mysql server now ' check box. click finish button to finish the database server installation.
To start mysql server under windows : open your 'command prompt window' click Start button on windows xp windows screen(bottom left of screen)->all programs->accessories->command prompt. click the command prompt icon to open a new command prompt window. on the window u'd most likely see : boot drive:\Documents and Settings\computer name> e.g C:\Documents and Settings\[your computer name] > navigate to the directory where Mysql was installed: > easiest way is by backing out of current directory till your at the systems root directory. so type : cd, [press Enter] i.e C:\Documents and Settings\computer name>cd, cd, [press Enter] " " "" when u got only root drive on the screen stop. [next navigate to the Mysql 'bin' directory: type: >cd P* * /My*/M*/b* [ - takes u straight to server 'bin' directory] the objective is to start the database server daemon , without it being started u cant begin using the database. >type mysqld[space key]--standalone[Enter key] i.e. mysqld --standalone [enter] the cursor should be blinking on a new line, signifying the start of the database. Now the database daemon thread has been start , u can now access the database. > Open another command prompt window. [by clicking ]start button->all programs->accessories->command prompt. navigate to the 'bin' directory of the Mysql server ,as u did before,previously. but this time u want to create or manipulate a database. >type at the command prompt.[bin directory] mysql -u root [enter] u should see the following message on the command prompt screen: "Welcome to the Mysql monitor. Commands end with ; or \g. Your Mysql connection id is [number] to server version: [server version] " Type 'help;' or '\h' for help. Type '\c' to clear the buffer. " the "-u " command signifies "user"and the "root" is the username. " mysql> to quit mysql> prompt type: \q; " if u see this your database start up was successful! to access a database or view the list of databases type at the 'mysql' prompt. show databases[semi colon] ie. mysql>show databases; dont forget the semi-colon; That's all about setting up mysql. next. Setting up Apache web server. ========================================= installing Apache web server ========================================= Apache http server is the free web server for serving your html pages and other resources to the web. it's your web server. download it from -apache.org. i'll assume u have the installer downloaded to your system. - to install Apache: >double click the installer icon to begin installation. >click 'next' on the Welcome page. >accept the license terms and click next >on the server information screen your required to enter network Domain. i assume your installing the package for development purpose, on a local machine. in the 'Network Domain' text box, enter -> localhost for server name : enter -> localhost -> enter an email address of your choice. in the Email Address section.->ur_email_id@localhost finally click the 'for All users radio button.' localhost is the name of your localmachine for development purposes.
>click the 'next' button to proceed with installation select the 'typical' set up option >click the 'next' button. >Accept default destination folder, and click 'next' >click the 'install' button to commence installation [- the install wizard commence installation , may take some time ] >Click the 'finish' button to complete the apache http server installation. - when successfully installed a purple feather appears on the bottom left side of your windows tray with a green light on ,signifying that the web server is on and running. >u have to configure the web server but hold that off until after the php installation.
====================================================================== INSTALLING PHP VERSION 4. ===================================================================== download the zip file and click on it to open. > unzip it to a directory on your system. e.g C:\unzipped\php4.0.4 etc > FOR unambiguity or to avoid clustering it with other zip files u can change the destination folder to sth more meaningful. e.g C:\PHP\ (from C:\unzipped\php[version no) > i use C:\PHP next step is to configure the PHP files to work with the web server . your going to move some files around and modify some things. so lets go. >navigate to the where u unzipped the php files to. e.g C:\unzipped\php[version no] this example uses php 4. the folder should contain the following files and sub folders. FOLDERS {cli,dlls,extensions,mibs,openssl,pdf-related,PEAR,sapi} Files {php4ts.dll,php.ini-dist,php.ini-recommended,etc} for web development purposes, php will be installed as an Apache[the webserver] module. it will work with the web server to parse your php script embedded web pages.
-> rename the php.ini-dist file to php.ini. the file should change to a notepad with a gear icon. or an iconified notepad. -> open the php.ini configuration file and make the following changes. a) look for the following lines : short_open_tag = On. //this allows u to contain php script in <? ?> tags. it unsafe and unrecommended except for learning and testing purposes. to turn it off. set the value to 'Off'[Off without the inverted commas] i.e short_open_tag = Off [no semi-colons permitted.]
b) switch of 'magic quotes' magic_quotes_gpc = On after 'switching off' it should read : magic_quotes_gpc = Off resave the php configuration folder and close it. > i.e save as php.ini and exit notepad.
look for the following line and set its value to 'Off' > since your setting up php to run as a server module u'll have to transfer the interpreter to the web server's bin directory. > copy the php file , php4ts.dll to apache's 'bin' directory. server's bin directory should be: root drive[or wherever Apache was installed]/ e.g C:\program files\Apache Group\Apache2\bin > copy [or cut] php4ts.dll [ the script interpreter] to the 'bin' directory . if u've come this far u aint doing bad at all. your almost there. Finally copy the configured php.ini file (notepad with gear icon) to your window's directory[folder]. ie. C:/Windows next : configure the web server to work with the script interpreter================================================================== > Open the server configuration file. click Start menu->All Programs->Apache HTTP Server [version no]->(sub menu)Configure Apache Server->(sub menu) Edit Apache httpd.conf Configuration file (click on this file to begin server configuration)
>make the following changes to the httpd.conf file. [Web server configuration file ]
a) indicate the directory where your web pages will be stored. This is a folder where all web pages u create will be stored.
Create the folder and place the location address in the httpd.conf file. e.g lets create a folder called -"MyWebFolder" in C: (c drive.) and point apache to it. Change the following line in httpd.conf file DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs" to [where your web folder is located i.e C:/MyWebFolder (enclose with quotation marks )] [ your config file should like this after the change ] DocumentRoot "C:/MyWebFolder" repeat the same change to the following lines-still httpd.config file. <Directory "C:/program Files/Apache Group/Apache2/htdocs">
change it to this : <Directory "C:/MyWebFolder">
Recap: So far we've transfered php script engine to web server directory, Included command to Load server module, and pointed the web server to a designated public folder for our web pages. next. include commands to enable the web server distinguish and process code embedded pages [by calling the php interpreter saved in 'bin'].
> Find the following lines in the httpd.conf file that begin with the phrase:'AddType application/' e.g AddType application/x-compress .z
type:(include the following two lines note the space b4 the .php ) AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps
c)Load the web server module engine module: Look for the following line: LoadModule foo_module modules/mod_foo.so # type on a new new line below the '#' sign the following. [there should be no '#' before this instruction set ] type: LoadModule php4_module PHP/php/sapi/php4apache2.dll if using php5 it willbe php5_module, the core thing is to point the web server to the apache2.dll file in 'sapi' folder of the extracted php package, so specify the path to this file[php4apache2.dll] as it appears on your system.
resave the httpd.conf file [web server configuration file] and close notepad.
Restart your system to register all the changes u've made so far.
installation and configuration is finished. TEst the work to see if it's without glitches. ====================================================================== TESTING SERVER SET UP ====================================================================== 1) create a plain html file and save it to our web server directory. (C:MyWebFolder) open notepad : start menu->All Programs->Accessories->notepad. type the following and save as Test.html.
<html><body><h2>Hello world - AMP set up </h2></body></html> 2) view the file :
open a web browser and type in the address column http://localhost/Test.html 3) for the php test : open notepad again and : type the following> <?php //short tags have been turned off remember print "hello work. successfully installed php "; print "<br> i am a web designer wannabe "; ?>
save the file as hellowork.php ,for type: save as 'All File' type instead of 'text' and save to your web folder, i.e C:\MyWebFolder. to preview files . fire up explorer or whatever browser your using and type in http://localhost/hellowork.php if all goes well, u should see some text on the screen else, u gat trouble-shooting to do!!.hello work!?>
|