Archive

Archive for the ‘PHP Configuration’ Category

How to Enable Iconv for PHP on a DirectAdmin Linux Server

October 23rd, 2008 No comments

I haven’t found a good guide on this that’s why I decided to create my own. iconv functions are great if you’re working with text information stored using different encodings and it is essential to have it on your server. Let’s take we have Directadmin with Apache 2 support (please, read my previous articles to find out how to upgrade your apache).

First of all we need to log in as root and go to /usr/local/directadmin/customapache.

cd /usr/local/directadmin/customapache

You should find configure.php_ap2 or configure.php files, depending on Apache version that is build using this Directadmin build system. I’ve got both these files. In order to add iconv support we need to add the following line to these files:

–with-iconv

Just take a look at my file.

Then we need to go to the command line to the same directory to run our build script. The string will look like

[root@lampdocs customapache]# ./build php_ap2

If your Apache version is lower than 2 (for example, 1.4), your string will be:

[root@lampdocs customapache]# ./build php

It will ask you to rebuild the software you have, you don’t really need it. You won’t need to add any configure lines: the script will do this for you. make and make install will be done automatically.  Don’t forget to reboot Apache (service httpd restart) and have fun!

How to Optimize Your LAMP Configuration

September 4th, 2008 No comments

Today I’m just sharing a link: I don’t think I can explain this better than IBM guys did. These three acrticles contain a comprehensive guide for your LAMP system optimization. Here is the first one, that contains general linux settings for perfect LAMP config. The second one describes how to fine tune Apache and PHP and finally the third one deals with MySQL – you will find out how to optimize MySQL configuration for any server . I usually recommend this guide for those who didn’t tune anything before – it’s clear and brings excellent results. If you have links to similar excellent tutorials, you’re welcome to share them in comments. Have a nice day!

How to Install Zip Functions Support For PHP

August 25th, 2008 No comments

Using zip files is a common practice for web. Zip archives are very useful as they are supported by all major operating systems and don’t require any special software. XP and Vista have the embedded support of this file format, you won’t also have problems opening these files in Linux. You can also work with these files in PHP. in order to do this, you should have ZZIPlib installed – it allows the easiest way to work with zip archives.

In this article I will tell you how to add zip file support for your PHP installation. As usually, we will need root access to our server with PHP compiled from source files.

In this article I will describe how to add zip support to PHP5 as it is installed at most servers at the moment. My OS is CentOS, but the installation should not differ from other operating systems, it’s easy enough to add zip functions.

First of all we need to ensure we have zlib installed. Run rpm -qa | grep zlib to check whether it is already installed and install it using yum if it is not present in the list created by the output of previous command. yum install zlib* should install everything related to zlib – that’s what we need to run zip.

Then run phpinfo() and copy the configure line you have. It should look like: ./configure –with-apxs –with-curl –with-curl-dir=/usr/local/lib –with-gd –with-gd-dir=/usr/local –with-gettext –with-jpeg-dir=/usr/local/lib –with-kerberos, etc. Then you need to add –enable-zip to this line.

Then you need to go to the directory where PHP source files are located. If you server has Directadmin installed, you should go to /usr/local/directadmin/customapache – your PHP files should be located there. Then change directory to the one with PHP source files and run the configuree command with –enable-zip added. Then – make and make install as usually.

After this all you need is to reboot apache. Your PHP installation should now support zip functions.

Apache Stopped Working After PHP Upgrade – How to Fix

August 24th, 2008 No comments

If you are often working with PHP upgrades, you should do this automatically – you already know all the issues you might face. But if it’s done for the first time, it is quite hard to find your problem. I will tell you about the most common issue and about the applicable actions to fix this.

When you update your PHP installation via Directadmin build system or when you do this manually, new modules are added to httpd.cond, but the older ones are not deleted. This usually causes problems, as apache refuses to start after PHP upgrade, What do you need to do in order to tun apache again?

You need to edit your httpd.conf file (it is usually located at /etc/httpd/conf/httpd.conf). Open this file fith any editor you like and comment all strings that contain “php4″. The same directives for PHP5 are added automatically so you don’t have to worry about it. When you comment everything related to PHP4, you should save httpd.conf and try to reboot apache. If everything is OK, it should start, if not – you have to follow its logs or errors you receive at the command line window. Let me remind you that most useful way to restart apache is service httpd restart.