Skip to main content
PHP-MySQL

Installing Apache MySQL and PHP

By August 20, 2013September 12th, 2022No Comments

Our classic LAMP server a recipe of Linux, Apache, MySQL and PHP, We will use SUSE Linux Enterprise Server SP3 for these exercise. We will use MySQL as the database server but if you want a fully Open Source solution then then MariaDB is a drop in replacement or Oracle’s MySQL Server.

We can user this machine, once setup, as the base for a new Mini-Series on Dynamic web pages with PHP and MySQL and we can throw into a little LDAP functionality too.

To install LAMP on the SUSE server we can use zypper, the yum equivalent on SUSE:

zypper in mysql mysql-client php53-mysql apache2-mod_php53 php53 
apache2 apacahe2-example-pages

Once installed, and like all services, we need to start the service and set them to auto start

service apache2 start
service mysql start
chkconfig -a mysql
chkconfig -a apache2

We need only to work with MySQL and Apache, PHP is a script interpreter and not directly a service. To secure the database we can run a small program to manage its settings: mysql_secure_installation

This program enables you to improve the security of your MySQL installation in the following ways:

• You can set a password for root accounts.
• You can remove root accounts that are accessible from outside the local host.
• You can remove anonymous-user accounts.
• You can remove the test database (which by default can be accessed by all users, even anonymous users), and privileges that permit anyone to access databases with names that start with test_.

Once we are ready we can use the command line browser to test that the web site is working:

w3m localhost

And the MySQL client to test the database server

mysql -u root -p

Once connected we can run MySQL commands, a simple starter is:

show databases;

Now we are ready with our LAMP server, look forward to the next lessons on using MySQL, HTML, CSS and PHP.