If you have used the Apache HttpClient library, you may have encountered this error. Annoying as it is, there is a way to disable it and it must be set at the client level.

Check the sample code below.

This post assumes you already have Apache HTTP Server 2.2.* up and running under a Windows OS. Download the source of PHP5 and MySQL in their official websites and install them. Gone are the days when configuring PHP and MySQL was a big hassle. To have PHP5 and MySQL up and running, add the following code in the httpd.conf (Apache HTTP Server’s configuration file).

This assumes your PHP directory is located in c:/php. Also change the document root. Look for this keyword in the httpd.conf file, DocumentRoot and change the path to where you want to store all your PHP files. In this case, c:/phpweb. The purpose of the <Directory> tag is to allow file permission access so that the PHP compile can access PHP files and execute the scripts.

Also look for the keyword index.html and add an index.php before it so that it can read those kind of files first before looking for index.html.

Make sure libmysql.dll from c:/php is copied to the c:/windows/system32/ folder.
To create a php.ini file, there should be a file called php.ini-recommended. Copy that file and name it to php.ini.
Under the php.ini file, look for these two lines and remove the semicolon.

Look for this extension_dir keyword and place the value c:/php/ext. It should then look like this.

Then, look for this keyword short_open_tag and set it to on. This will enable you to use just <? ?> rather than be forced to use <?php ?>.

That’s it. Create a sample PHP file and place the code below.

Restart your Apache HTTP Server and check the contents of the PHP file. If you see a MySQL table entry, then you’re good to go.

Note: Creating MySQL accounts is a hassle. I suggest you use a MySQL client software when creating user accounts. I use SQLyog.

Each Unix-based (I just call them Unix based since these new OS now were non existent at the time that only Unix and later on Linux were around) OS has a package manager command that will do the downloading and installation of the package specified. If you want to do installations the old fashion way … downloading the file, extracting and moving it to the desired location it’s still pretty easy for say, Apache Tomcat 6 Server. Do the following steps.

  • wget http://apache.hoxt.com/tomcat/tomcat-6/v6.0.16/bin/apache-tomcat-6.0.14.tar.gz
  • tar xvzf apache-tomcat-6.0.16.tar.gz
  • Check the Apache Tomcat’s website for any new version and just change the path and filename for it.
  • mv apache-tomcat-6.0.16 /usr/local/tomcat
  • You can place it anywhere you want in the file system. It is a matter of personal preference. In this case, the new folder will be tomcat instead of apache-tomcat-6.0.16
  • cd bin
  • ./startup.sh

This is assumed that you have Java installed. If it is not installed, then Apache Tomcat will not run as it is dependent on the Java Runtime Environment.

Related Posts Plugin for WordPress, Blogger...