Getting Started Under Unix

Before installing PHP, you should check whether you already have a web server that supports PHP and whether your PHP engine supports MySQL. For example, many Linux distributions now include the Apache web server with preconfigured PHP support for accessing the MySQL DBMS.

The simplest way to check if your web server supports PHP, and if the PHP module supports MySQL, is to create a file phpinfo.php in the web server document root. Create this file so that it has only one line with the following contents:

<?php phpinfo(); ?>

For most systems that are running the Apache web server, the document root is the directory: /usr/local/apache/htdocs/.

After creating the file, run the script by requesting the following URL with a web browser that is running on the same machine as the web server: http://localhost/phpinfo.php.

If you see output—not the script contents—then your web server has PHP support. The Configure Command section near the top of the output will include the option --with-mysql if MySQL support is built-in; scrolling down through the output should also show a section headed mysql.

If this checks out, you’re ready to start with PHP and MySQL. If not, then additional configuration is required. Suggested steps are included in this section.

Here are three possible ways to get started with a web server, PHP, and MySQL support:

  • The easiest approach is to obtain an installation package. NuSphere has a free, downloadable installation package for Linux, ...

Get Managing & Using MySQL, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.