PDA

View Full Version : Apache Web Server



Perad
30th October 2004, 05:57 AM
Does anyone know how to set this thing up. I just don't get it. I want a web server so i can test some php scripts but no matter what i try i just can't seem to make this thing work.

So far i have installed it. Does anyone know what the next few steps are?

omega
30th October 2004, 06:50 AM
PHP isn't automatically installed with apache, you'll need to visit http://www.php.net and download the apache plugin, then install it (and yes you do need to edit httpd.conf to get it to work)

Then it'll parse your php scripts properly instead of spitting the source code at you. Right now it doesn't know how to handle them.

Perad
30th October 2004, 10:58 AM
ok i don't really get what you said. Is there any online guide? Also are there any really user friendly noobie server's?

omega
30th October 2004, 11:20 AM
http://www.php.net

master811
30th October 2004, 08:20 PM
If you just just want a simple web server for php, i suggest using Easy PHP (http://www.easyphp.org/) as it is very simple to set up and requires much less configuration. It also comes with mysql/phpmyadmin , so you can easily set up a forum for testing as well. However, easyphp is now quite a bit out of date, and looks like it won't be updated again, though if you just want something easy to set up - this is it :P.

Bare in mind though that this ONLY supports php/mysql, so if you want more functionality, you will need somethin glike apache or abyss.

Lily
30th October 2004, 08:57 PM
For domain, when you installed Apache, you should have put localhost. For server name, 127.0.0.1. It should also be port 80 as a service. The rest is pretty much up to you.

You need to download PHP 4.3.9[latest stable version] from php.net. Make sure you download the installer, and not the compressed version. Install it to C:\PHP. Copy php4ts.dll into C:\WINDOWS\system32 or wherever your system32 directory is located. Copy php.ini-dist and rename the copy to php.ini and move it to C:\WINDOWS or wherever your windows directory is located.

Find the "conf" directory in the directory you installed Apache to. Open httpd.conf with notepad.

Put this at the very bottom of the file. Modifying any of these lines may result in an error with the configuration, so do not modify anything unless you know what you're doing.


ScriptAlias /php4/ "C:/PHP/php-4.3.9-Win32/"
Action application/x-httpd-php4 "/php4/php.exe"
AddType application/x-httpd-php4 .php
AddType application/x-httpd-php-source .phps

Save, and restart Apache. Right click the feather icon in your system tray, and bring up the monitor. Click stop. Once it says it's stopped, click start. Once it's fully started, your configuration will be reloaded, and you should be ready to test the installation.

In your Apache directory, find htdocs. Open up notepad, and paste this into the document.


<?php phpinfo(); ?>

Save the file as phpinfo.php inside of your Apache htdocs directory. Notepad likes to save files it's own way, so make sure it's saved as phpinfo.php and not phpinfo.php.txt.

If everything was done correctly, it should work, now. In your browser's address bar, type in "http://localhost/phpinfo.php" and that should bring up your page. If you only see what you saved inside of the document, or you receive a server error, then there are two possibilities.

1] You did not install PHP correctly. Check the instructions again and make sure you followed them exactly as I said.

2] Something is wrong with the configuration. Reply with the error(s) and settings for:
ServerRoot
Listen
ServerName
DocumentRoot
<Directory>

These settings are found in httpd.conf.

If you got this far, that means everything worked. If you encounter any errors afterwards, then that would probably be a result of messing with httpd.conf, or moving necessary PHP/Apache files around.

It's been awhile since I've installed MySQL, so if these instructions do not work, then I don't know what the problem is.

If you want MySQL support, download the Windows installer from mysql.com.

Install it to C:\mysql.

After that, you should be able to start configuring the root account.

Start -> Run -> cmd[or command, depending on the version of Windows you are using]

cd \mysql\bin
mysqladmin -u root -p create test

That should create the database "test."

Now, it's time to log in. Since you don't have a password set, yet, you will have to log in with minimal switches.

mysql -u root

It should skip the password prompt, and display a welcome message.

Type the following, and change "password" to the password you want to associate with the root account. Keep in mind that it is case sensitive.


GRANT ALL ON *.* TO 'root'@'localhost' IDENTIFIED BY 'password';

That should give full MySQL permissions to the root account on localhost, and set the login password to the password you specify.

Now, log out and test to see if it worked. Type the following.

exit
mysql -u root -p test

When it prompts you for a password, enter the password you provided in the grant query. Keep in mind, it's case sensitive.

If it works, then it should display a welcome message, and you now have MySQL support.

Find your Apache htdocs directory again, and open notepad.

In the document, put the following in.


<?php
$link = mysql_connect("localhost","root","password");
if ($link)
{
echo "Connection to MySQL successful.<br />";
$db = mysql_select_db("test");
if ($db)
{
echo "Selection of database successful.";
}
else
{
echo "Selection of database unsuccessful<br /><b>Errors encountered:</b><br />".mysql_error();
}
}
else
{
echo "Connection to MySQL unsuccessful<br /><b>Errors encountered:</b><br />".mysql_error();
}
?>

Save it to your htdocs directory as mysql.php. Make sure it's saved as mysql.php and not mysql.php.txt.

In your browser's address bar, type "http://localhost/mysql.php" to test the connection. If you receive no errors, then everything is working fine, and you can start using MySQL in your code.

Orleans Martinez
6th November 2004, 09:52 PM
Are there any free web hosts that support php, mySql?

master811
7th November 2004, 07:03 AM
yes a good one is http://www.netrulon.com

you get php, MySQL, cpanel 9, 500Mb space as well as 10Gb bw :D and lots more :P

Orleans Martinez
7th November 2004, 05:14 PM
Jesus christ that is a good site! Cheers

I have the apache, mySQL, php setup on my comp atm for a site i will shortly put up, but i'm still a novice to it. Are there any security issues I need to be aware of? (local and on the web)

I was going to start a new thread for this next thing, but err... yeh.

The basic gist of my site is that i need to analyze large tables of data which are used for statistical analysis (the results generated on the page). Anyway, i need to get these tables of data into the mySQL db. The problem is this data comes in an xls spreadsheet. How do i transfer the data from the xls spreadsheet to the database efficiently? Alternatively, I origionally get this data from other webpages, is there a better way to extract this information directly and update the database with this information?

Shinji
7th November 2004, 09:47 PM
Just one simple question why does it offer that much of goodies.......i mean free 500mb space and 10 GB bandwidth.......?

master811
8th November 2004, 07:54 PM
well all i can say is, why not? put it this way, the owner has a paid hosting site as well and is doing this as a gift to anyone - just don't abuse it. The server makes enough money on adds etc, so it should be around for a while.

MCeley
11th November 2004, 06:08 AM
I have an apache server on localhost at the moment. How do I make this run on a web address like "www.mysite.com"? Somebody said that I had to build my site but I don't know exactly what they're talking about.