ApacheMySQLPHP
Size: 875
Comment:
|
Size: 3326
Comment: wikilink to ServerSideIncludes; add ToC
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
= Install Apache HTTP Server = Install the apache2 package: |
||<tablestyle="float:right; font-size: 0.9em; width:40%; background:#F1F1ED; margin: 0 0 1em 1em;" style="padding:0.5em;">'''Contents'''[[BR]][[TableOfContents]]|| This is to help people setup and install a [http://en.wikipedia.org/wiki/LAMP_%28software_bundle%29 LAMP] server in Ubuntu 5.04, including Apache 2, PHP 4, and MySQL 4.1. As of this writing, MYSQL 5.0 and PHP 5 could only be installed by compiling. See the bottom of this document for further info. == Check Repositories == The Universe repository needs to be enabled to install Apache. Please see AddingRepositoriesHowto for details. Also, you should be familiar with RootSudo. == Installing Apache 2 == |
Line 4: | Line 12: |
sudo apt-get install apache2 | $ sudo apt-get install apache2 |
Line 7: | Line 15: |
= Install PHP for Apache HTTP Server = Install the PHP4 package: |
== Installing PHP 4 == |
Line 10: | Line 17: |
sudo apt-get install php4 | $ sudo apt-get install php4 |
Line 13: | Line 20: |
Now restart the webserver: | == Installing MYSQL 4 == |
Line 15: | Line 22: |
sudo /etc/init.d/apache2 restart | $ sudo apt-get install mysql-server $ sudo apt-get install libapache2-mod-auth-mysql $ sudo apt-get install php4-mysql |
Line 18: | Line 27: |
= Test the PHP module in Apache = Create a test .php file in your webserver directory |
After installing MySQL, you really ought to read [http://dev.mysql.com/doc/mysql/en/default-privileges.html 2.9.3. Securing the Initial MySQL Accounts] from the [http://dev.mysql.com/doc/mysql/en/index.html MySQL Reference Manual]. == Edit Apache Configuration == You may want your current user to be the PHP pages administrator. To do so, edit the Apache configuration file : |
Line 21: | Line 32: |
sudo gedit /var/www/testphp.php | $ sudo gedit /etc/apache2/apache2.conf |
Line 23: | Line 34: |
insert the following line and save it: | Search both the strings starting by "User" and "Group", and change the names by the current username and groupname you are using. Then you'll need to restart Apache. (look at the next chapter concerning apache commands) Configuration options relating specifically to user websites (accessed through localhost/~username) are in /etc/apache2/mods-enabled/userdir.conf. == Edit PHP Configuration to Work With MYSQL == You may need to edit the PHP configuration file to get PHP and MYSQL talking : |
Line 25: | Line 42: |
<?php phpinfo(); ?> | $ sudo gedit /etc/php4/apache2/php.ini }}} Remove the ";" for the line ";extension=mysql.so", and restart Apache as is stated below. == Run, stop, and restart Apache == Use the following command to run Apache : {{{ $ sudo /usr/sbin/apache2ctl start }}} To stop it, use : {{{ $ sudo /usr/sbin/apache2ctl stop }}} Finally, to restart it, run : {{{ $ sudo /usr/sbin/apache2ctl restart |
Line 28: | Line 60: |
attachment:IconsPage/IconTip.png You can also use another text editor! = Install MYSQL for Apache HTTP Server = Install the MySQL packages for Apache: |
== Status == To check the status of your PHP installation: |
Line 33: | Line 63: |
sudo apt-get install libapache2-mod-auth-mysql php4-mysql | $ sudo gedit /var/www/testphp.php |
Line 35: | Line 65: |
Restart the webserver: | and insert the following line |
Line 37: | Line 67: |
sudo /etc/init.d/apache2 restart | <?php phpinfo(); ?> |
Line 40: | Line 70: |
Credits: [http://www.ubuntuguide.org/ Unofficial Ubuntuguide] | View this page on a web browser, at http://yourserveripaddress/testphp.php or http://localhost/testphp.php == Securing Apache == If you just want to run your Apache install as a development server and want to prevent it from listening for incoming connection attempts, this is easy to do. {{{ $ sudo gedit /etc/apache2/ports.conf $ password: }}} Change ports.conf so that it contains: {{{ Listen 127.0.0.1:80 }}} Save this file, and restart Apache (see above). Now Apache will serve only to your home domain, http://127.0.0.1 or http://localhost. == Other Apache options == * ServerSideIncludes - enable SSI in Apache2 * LocalhostSubdomain - access your local files as if you had different subdomains == Further Information == You can compile Self:PHP5FromSource, as well as Self:MYSQL5FromSource. |
ContentsBRTableOfContents |
This is to help people setup and install a [http://en.wikipedia.org/wiki/LAMP_%28software_bundle%29 LAMP] server in Ubuntu 5.04, including Apache 2, PHP 4, and MySQL 4.1. As of this writing, MYSQL 5.0 and PHP 5 could only be installed by compiling. See the bottom of this document for further info.
Check Repositories
The Universe repository needs to be enabled to install Apache. Please see AddingRepositoriesHowto for details.
Also, you should be familiar with RootSudo.
Installing Apache 2
$ sudo apt-get install apache2
Installing PHP 4
$ sudo apt-get install php4
Installing MYSQL 4
$ sudo apt-get install mysql-server $ sudo apt-get install libapache2-mod-auth-mysql $ sudo apt-get install php4-mysql
After installing MySQL, you really ought to read [http://dev.mysql.com/doc/mysql/en/default-privileges.html 2.9.3. Securing the Initial MySQL Accounts] from the [http://dev.mysql.com/doc/mysql/en/index.html MySQL Reference Manual].
Edit Apache Configuration
You may want your current user to be the PHP pages administrator. To do so, edit the Apache configuration file :
$ sudo gedit /etc/apache2/apache2.conf
Search both the strings starting by "User" and "Group", and change the names by the current username and groupname you are using. Then you'll need to restart Apache. (look at the next chapter concerning apache commands)
Configuration options relating specifically to user websites (accessed through localhost/~username) are in /etc/apache2/mods-enabled/userdir.conf.
Edit PHP Configuration to Work With MYSQL
You may need to edit the PHP configuration file to get PHP and MYSQL talking :
$ sudo gedit /etc/php4/apache2/php.ini
Remove the ";" for the line ";extension=mysql.so", and restart Apache as is stated below.
Run, stop, and restart Apache
Use the following command to run Apache :
$ sudo /usr/sbin/apache2ctl start
To stop it, use :
$ sudo /usr/sbin/apache2ctl stop
Finally, to restart it, run :
$ sudo /usr/sbin/apache2ctl restart
Status
To check the status of your PHP installation:
$ sudo gedit /var/www/testphp.php
and insert the following line
<?php phpinfo(); ?>
View this page on a web browser, at http://yourserveripaddress/testphp.php or http://localhost/testphp.php
Securing Apache
If you just want to run your Apache install as a development server and want to prevent it from listening for incoming connection attempts, this is easy to do.
$ sudo gedit /etc/apache2/ports.conf $ password:
Change ports.conf so that it contains:
Listen 127.0.0.1:80
Save this file, and restart Apache (see above). Now Apache will serve only to your home domain, http://127.0.0.1 or http://localhost.
Other Apache options
ServerSideIncludes - enable SSI in Apache2
LocalhostSubdomain - access your local files as if you had different subdomains
Further Information
You can compile PHP5FromSource, as well as MYSQL5FromSource.
ApacheMySQLPHP (last edited 2008-08-06 16:21:08 by localhost)