Jump to content

making apache server work


SusieWoosey

Recommended Posts

I want to run a local PHP so I can edit my .php files without having to upload to my website all the time.

MYsql would be nice too, but first things first.

Do I need Apache server on my PC for PHP and MYsql to run? How do I tell my PC that PHP is there, so I can see .php files on my PC, without resorting to uploading them to my webspace?


Appreciate any help.


Suzanne    (sallyjowoods@hotmail.com)




Link to comment
Share on other sites

Yes you need to install Apache to run your PHP scripts on your PC locally. MySQL doesn't need Apache. MySQL is database server. Apache is a web server.

Installing Apache is rather easy. Make sure you download the msi package and download Apache2.0.x (don't download Apache2.2.x). When you run the Apache installer it'll ask you for a couple of details which are Network Domain ,Server Name and Administrator's Email Address

For the Network Domain and Server Name just enter localhost into the two boxes. Then just add a false email addy into the Admins Email Address eg (admin@localhost). When it ask you where to install Apache to, install it in the root of your hard drive in a folder called server, so click the browse button when it asks for installation directory, type in C:\server, the server folder will be created if it doesn't exists, also change C: to the letter of your hard drive. Now go through the rest of the installation process.

Once Apache is installed, fire up a web browser and type in http://localhost or http://127.0.0.1

The above addresses are local addresses, that only you can access. No one from the web/out side of your network can access those addresses. You should get the Apache welcome message when you go to either of the above addresses.

Now to install PHP, you'll need to go to php.net and download PHP5. Make sure you download the zipped binaries and NOT the INSTALLER. Once you have downloaded PHP. Extract the contents of the zip file to C:\server\PHP\

Once you have extracted the contents of the ZIP. PHP is installed! However you must now configure Apache to parse any PHP files with the PHP Interpreter. To do so go to C:\server\Apache2\conf and open up httpd.conf for editing.

Now look for the following:
[code]#LoadModule ssl_module modules/mod_ssl.so[/code]
Add the following after the above:
[code]LoadModule php5_module "C:/server/php/php5apache2.dll"

#PHPIniDir
PHPIniDir "C:/WINDOWS"[/code]
Now scroll down further to find the following:
[code]AddType application/x-gzip .gz .tgz[/code]
Now add the following after the above:
[code]AddType application/x-httpd-php .php[/code]

Save the httpd.conf file! What you need to do now is go to C:\server\php and find the following files:
libmysql.dll
php5ts.dll
php.ini-recommended

Copy the above three files to the WINDOWS folder (C:WINDOWS\). Once you have done so. Rename php.ini-recommended to just php.ini

Now you have setup Apache to parse the PHP files with the PHP Interpreter. All you need to do now is restart Apache. To do so go to Start > Program Files > Apache HTTP Server 2.0.x > Control Apache Server > Restart

If everything goes to plan. Apache should restart without any beeps/errors popping up. If no beeps/errors come up then Apache and PHP are installed. To test go to C:\server\Apache2\htdocs\ create a new file called test.php, edit this new file and add the following code to it:
[code=php:0]<?php
phpinfo();
?>[/code]

Save test.php. Now open up your browser again and go to http://localhost/test.php

When you go to that address you should get a page full of information about PHP and your server. If you do then Apache and PHP are successfully installed.

All you need to do now is install MySQL, which is easy as its just a step through installer. Make sure when you go to install MySQL you install it in the server folder (NOTE: You'll need to choose the custom install option to do this).

When MySQL is installed you'll need to enable the MySQL extension for PHP to use in order for you to use PHP with MySQL. You can do this by reading [url=http://www.phpfreaks.com/forums/index.php/topic,95378.0.html]this thread[/url].

Hope that helps.
Link to comment
Share on other sites

Thanks for the help wildteen, I had already downloaded PHP 4.xxxxx so I shall have to go look for php5. Since posting I have been able to get Apache to run without giving me errors, so I must be doing something right.


Will look for php5, and out your help into practice.

Will let you know how I get on.


Thanks for replying

Suzanne.
Link to comment
Share on other sites

  • 1 month later...
Hi wildteen,

Not sure if you'll read this, it's been a while since my first posting, I've been hopistalised since then, so not done much PC work.

Today (21st October) I successfully installed Apache 2.0.59 and PHP5.1.6

Thanks for your help, it went smoothly except for notepad naming my testfile as test.php.txt it took me a while to figure that out :D

Now for MySQL.


Thanks for your help.



SusieWoosey
Link to comment
Share on other sites

Hmm, well I guess my euphoria was short lived.

Seems today it now won't/doesn't want to work.

I get this error when I try to start it - 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.


What have I done wrong or what have I not done?

Any ideas?


Suzanne.
Link to comment
Share on other sites

I think it's Apache. It appears to only do it when I close Apache Server down, and restart it. (I think). Anyway Apache seems to be OK now, I get good local .php pages, so my objective of seeing them before committing them to a live website has been achieved.


I've installed MySQL, all seems OK. I cannot use it from that command line client though. Suggestions?



Suzanne
Link to comment
Share on other sites

To use MYSQL via commad line you need to change directory to the MySQL bin directory. You do something like this:
[code]cd C:\mysql\bin\[/code]

Then you can type mysql -u root and it should log you in to MySQL. If its doesnt then you'll need to add the -p paramter to it and then provide the password for the root user. If you dont get any think from the command  then make sure MySQL is running, check your processes (Ctrl+Alt+Del click processes tab).
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.