I am in the throws of going through a tutorial which shows how to set up and use the ZendFramework. It comes as part of a book I found which goes into some detail about the ZendFramework but in a much more readable (understandable?) method than the documentation. Once I have been through the book and if I find it is very useful I will post a link to it on the blog. Not sure yet how good it is but early indications are it is pretty thorough and well put together. One of the requirements of the tutorial is the use of the MySQL database, as this is optionally installed with ZendCore. I wanted to install the interface I like to use for MySQL which is phpMyAdmin. The alternative method which is available using the QP2TERM or qsh and calling the mysql binary is pretty clunky and not easy to use, phpMyAdmin is a great alternative and easy to install.
First of all we needed to decide where to install the application, its a web application that can be installed against one or many of your installed websites that is capable of running php scripts. As we have explained we are using NameVirtualHost webhosting, this means we have a single IP address and port which is used for all of our websites. The main web-server is called PHPSERVER, this holds the VirtualHost information for all of our other sites. This proxies the PASE Apache server for all page requests so the PHP interpreter can be run. We are going to run the phpMyAdmin web application against the PHPSERVER instance. This requires the phpMyAdmin files to be copied to our directory structure below PHPHSERVER, so we downloaded the phpMyAdmin files and unzipped them on the local PC and transferred them to our i515 using FTP. Because we have set up the root directory to have all sub-files and directories owned by the same user as the parent directory, the FTP process also ensured the file ownership was correctly configured.
The PHPSERVER serves is not configured to be a working web-server, there are no pages below the structure and we have no configurations which would cause any pages to be served, this is simply the gateway to our other websites. Now we are going to add configurations just for the phpMyAdmin files so we have a single place to administer the MySQL instance provided by Zend.
Our current directory structure for PHPSERVER is
/www/phpserver/conf
/www/phpserver/htdocs
/www/phpserver/logs
we simply added another directory below /www/phpserver/htdocs called phpmyadmin where we copied all of the unzipped files to.
Next we have to configure the environment to support phpMyAdmin pages being served, remember PHPSERVER only acted as a gateway to our other websites so all requests never saw the underlying files in the directory only the httpd.conf file. Now we want any request for the pages in phpmyadmin to be served up to the user.
First we added a new config to the /www/phpserver/conf.httpd.conf file as below
# PhpMyAdmin site
ServerName phpmyadmin.local
DocumentRoot /www/phpserver/htdocs/phpmyadmin
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8000/
ProxyPassReverse / http://127.0.0.1:8000/
Notice how we added the phpmyadmin directory to the previous document root, this allows the request to use this as the base directory instead of having to append /phpmyadmin/ to the URL of the server. You could choose to leave this out if you wish. We also changed the server name to be something that represents what it does which is helpful later.
Next we added a new VirtualHost container to the PASE Apache config which resides in /usr/local/Zend/Apache2/conf/httpd.conf. This allows the php content to be served correctly, remember if you don't have a VirtualHost container it will take the first VirtualHost container in the configuration. This can get confusing if you don't understand that...
# phpmyadmin server
DirectoryIndex index.php index.html
DocumentRoot /www/phpserver/htdocs/phpmyadmin
ServerName phpmyadmin.local
Options Indexes FollowSymLinks
Order Deny,Allow
Allow From All
We restarted the Zend Apache servers and the PHPSERVER for the changes to take effect.
Now we need to configure the application interface, there is only one file we need to worry about and it is the config.inc.php. This is where we set up the users allowed to access the phpMyAdmin scripts, these user must also exist in the MySQL authority Database. The instructions supplied for updating and creating this file are very good so we wont go through how we set up the configuration.
Now we can create a DNS or host file entry to ensure the ServerName can be passed in correctly, we simply added it to our hosts file on the PC at the moment.
192.168.20.21 phpmyadmin.local
Notice how the entry matches the server name we added to the VirtualHost container in /www/phpserver/conf/httpd.conf file and /usr/local/Zend/Apache2/conf/httpd.conf file.
Now we simply point our browser at http://phpmyadmin.local and we see the initial sign in screen as below.
That's it, we can now use the easy to use interface to add users, databases, files and manage all of the authorities for the MySQL Db using this tool.
Chris...