Setup Apache2, MySQL and PHP5 on Ubuntu Linux
Last weekend I decided to give a purpose to an old PC (Pentium III with 128MB RAM, 30GB HD) on which a few months ago I installed Ubuntu Server 6.0.6.
As always what I was missing was an online test environment that allowed me to make the modifications and new features to add to my sites to avoid doing hot, I needed to install and configure Apache2, MySQL and PHP5.
Starting with a guide on html.it, here is the steps that I followed:
-
Update list of available packages (it is good practice to always do before new facilities):
sudo apt-get update -
Installing Apache2:
sudo apt-get install apache2-mpm-prefork -
Installing MySQL
sudo apt-get install mysql-server -
Install the PHP5 module for Apache2:
sudo apt-get install libapache2-mod-php5 -
Installation of the library to use MySQL PHP5:
sudo apt-get install php5-mysql -
Installing PHP library for image manipulation
sudo apt-get install php5-gd -
Installing PHP library to run PHP from the command line also:
sudo apt-get install php5-cli -
Enabling MySQL extension to the configuration file for PHP5:
vi /etc/php5/apache2/php.iniline editing
;extension=mysql.soin
extension=mysql.so -
Restart Apache2:
sudo /etc/init.d/apache2 restart
Then to test that everything was working correctly I proceeded as follows:
Test integration between Apache2 and PHP5
Creating test_php.php file in the directory / var / www with the following contents:
With browser access to 'URL http://servername/test_php.php (where servername represents the IP address or the name of the linux server) and verify information display featured in PHP5 configuration
Test integration between PHP5 and MySQL
Creating a db test on MySQL:
mysqladmin -u root create test Creating test_mysql.php file in the directory / var / www with the following contents:
With browser access to 'URL http://servername/test_mysql.php (where servername represents the IP address or name of the linux server) and checks the message "OK" message indicating that the connection to DB "test" is was successful.










all are really apt-get apt-get install
I also I had to add repository
You're right, thanks for reporting! 'm Not even the most 'able to do a good cut & paste! However I have now corrected.
Could you clarify what other actions you have done? I started with a Ubuntu Server 6.0.6
And 'better on one line
otherwise often gives error.
syntax error, unexpected T_STRING, etc. ..
Hello
I wanted to tell you that in Test integration between Apache2 and PHP5
php code you've written has an inaccuracy:
be
I wanted to tell you that in Test integration between Apache2 and PHP5
php code you've written has an inaccuracy:
should be
< ?php phpinfo();?>Excellent tutorial, no matter the error on phpinfo is a clear typo
)
byeee
Thanks for reporting! I corrected the error.
@ athos athos-desktop: ~ $ mysqladmin-u root create test
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user' root '@' localhost '(using password: NO)'
I thank the tutorial but do not go out from here
Hello Athos anke I have the same problem ... Someone help us??
Hello!
Until integration testing between PHP with MySQL tt well then when I try to connect to the page test_mysql me this error:
Parse error: syntax error, unexpected $ end in / var / www / test_mysql.php on line 9
can you help? thanks
Thank you,
one of the most clear and concise guide I've ever used: very useful and accurate, I did everything in an instant.
@ athos
$ link = mysql_connect ( 'localhost', 'root', 'mypassword')
In the text file put the mysql password as an example here, otherwise try to connect to the DB without pwd.
Hi I have a problem.
Following all the instructions, I installed all
I tried to make it work with e107, but I do not open the site and says it is an application x-httpd-php