Installing and Configuring Apache, PHP and MySQL
Recently, I was looking for a calendar system that would allow me to keep track of events, appointments and project dates. Quite a few of the applications that I looked at were written in PHP and used a database to keep track of events. Since I had already planned on configuring an extra computer for use as a web server, I figured that it wouldn't be much more work to add PHP and MySQL to it. This article covers my experiences of installing all the components and getting everything running.
The computer I decided to make into my web server was an old 90 MHz Pentium computer with 40 MB of RAM and around a gigabyte of hard drive space, running Caldera's OpenLinux 2.3.
I wanted to use the latest stable versions of Apache, PHP and MySQL, so I uninstalled the existing Apache package and downloaded the sources for Apache 1.3.12 and PHP 4.0.3, along with the binaries for MySQL 3.22.32.
While Apache has always been module-based, Apache 1.3 can load and unload modules, called Dynamic Shared Objects (DSOs), as they are needed. Apache 1.3 includes a program called apxs (APache eXtenSion) that automates the process of building DSO's outside of the Apache source tree and configuring Apache to use them.
Two reasons for using dynamic modules in Apache are performance and flexibility. Dynamic modules allow the PTP interpreter to be loaded into the Apache process when needed. This prevents the creation of a new interpreter process with each request (as CGI requires), but allows Apache to load the module only when needed, saving resources.
Dynamic modules also allow functionality to be added, removed or changed without the need to recompile the entire Apache server and possibly lose existing functionality.
While compiling PHP as a DSO on my home network was more of a thought exercise than a requirement, it could be important in some installations. Be aware that there are security issues dependent on whether PHP is a dynamic module or run as a CGI. Take a look at the documentation on the Apache and PHP sites for detailed security information.
Since I was installing PHP as a dynamic Apache module, Apache had to be installed before PHP.
While Apache is installed by default in most Linux distributions, it may not support dynamic modules. To see if your version of Apache supports them, execute the command httpd -l which lists the modules that have been compiled into Apache (httpd may not e in your PATH, in which case you need to find where Apache is currently installed). If mod_so.c appears in the list of modules, then your Apache server can use dynamic modules. If it isn't in the list you can still use PHP, as a CGI program without recompiling Apache. Enabling DSO will require a recompile.
To compile Apache to use dynamic modules, I used the following configure command:
./configure -enable-module=most --enable-shared=max.
These options enable most of the modules included with the Apache source and indicates that they should be built as dynamic shared objects. Other configuration variations are detailed in the README.configure file in the Apache source directory.
When the configure script was finished, I compiled and installed Apache with the make and make install commands. Next, I issued apachectl start to start the Apache server.
After Apache was installed and running, the next step was to install MySQL because the PHP configure script needed to know where it was. I unpacked the MySQL package that I had and followed the directions for installing and starting the MySQL server.
Once Apache and MySQL were installed and running, it was time to install PHP 4. I unpacked the PHP sources and ran the configure script. The options depend on whether you want to use PHP as a shared Apache module or as a stand alone program.
Since I wanted PHP to run as a dynamic Apache module and use MySQL, I ran the configure script as follows:
./configure -with-apxs=/usr/local/apache/bin/apxs<\n> -with-mysql=/usr/local/mysql
This tells the configure script to build PHP as a shared Apache module and to include support for MySQL. If your Apache and MySQL base directories are where PHP expects to find them, you don't need to specify the path names, but I found it easier to specify them.
The first time I ran the configure script it complained that it couldn't find the autoconf, bison, and flex utilities on my system. I installed them from my Caldera CD and ran the configuration script again, this time successfully.
Next, I compiled PHP by running the make command. Once all the source files were compiled successfully, I installed PHP with the make install command.
Before Apache could use PHP, it had to know about the PHP module and when to use it. The apxs program took care of telling Apache about the PHP 4 module, so all that was left to do was tell Apache about .php files. File types are controlled in the httpd.conf file, and it usually includes lines about PHP that are commented out. I uncommented the following line, Addtype application/x-httpd-php .php, and restarted Apache by issuing the apachectl restart command.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.
Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.
Sponsored by ActiveState
| Non-Linux FOSS: libnotify, OS X Style | Jun 18, 2013 |
| Containers—Not Virtual Machines—Are the Future Cloud | Jun 17, 2013 |
| Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer | Jun 12, 2013 |
| Weechat, Irssi's Little Brother | Jun 11, 2013 |
| One Tail Just Isn't Enough | Jun 07, 2013 |
| Introduction to MapReduce with Hadoop on Linux | Jun 05, 2013 |
- Containers—Not Virtual Machines—Are the Future Cloud
- Non-Linux FOSS: libnotify, OS X Style
- Linux Systems Administrator
- Validate an E-Mail Address with PHP, the Right Way
- Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer
- Senior Perl Developer
- Technical Support Rep
- UX Designer
- RSS Feeds
- Introduction to MapReduce with Hadoop on Linux
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?




Comments
Thanks for your help
Hello,
Actually your article doesnt help me out much am stuck with the configuration of my apache. I want to start it on port 2083 but by default its on port80 which is administrator port. YOu can help me to change the port for the same.
http://forums.techarena.in/guides-tutorials/1346315.htm
my php is unable to process the mysql
I have configured my php, mysql and apache and it works fine for the php scripts ... But when i included scripts for mysql processing in it ... It dint work .... I checked for the phpinfo and it showed --with-mysql ... Can u please help me .... when ever i access codes with mysql in it ... The server does'nt process it . Is there any other configuration changes i need to make in any of them .. I am using the fedora core 2 system ...
The sample php code for the mysql that i have written is :
Name: ".result_row['name'] . " ";
?>
For the database mydb and the UserSessions,which were created earlier
Apache, Php & Mysql
I need help on how to configure apaches, Php and mysql on Win 98.
Your article does not help me onthat.
Pls do justice to this. Thanks
Webmonster
Hey, you need to search a goo
Hey, you need to search a google for easyphp software. It's everyting in one install as if it had been created for a blondie. :) Regards!