compile php-apache-mysql step-by-step

Is there a full step-by-step instruction of compiling php, apache and mysql with enabling the following utilities for php
PHP 5.2 or newer
IMAP (extension)
mbstring (extension)
Mailparse (extension)
memory_limit >= 16M (php.ini)
file_uploads = On (php.ini)

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

This is my own article

i always follow this , and its works perfectly

try this.. let me know if you need any help

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Note that there's a big difference between running PHP as a module, and running it as a CGI binary. Check which you need before you set off.
rawandnetAuthor Commented:
I don\t even know waht you mean by running PHP as a module or as CGI? before I was using yum to update my Redhat server using remi repository, and it was working, now it desn't the php is showing blank.  do you think the artical fosiul01 send is PHP as module and CGI?

I am so disapointed of redhat that doesn't support php 5.3, even repository doesn't work anymore to update php.

fosiul01 if i follow your steps, does that enable the utility i mentioned above?

10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

I believe that the majority of people configure Apache to run PHP as a module, as that's recommended.

The article to which fosiul01 links is configuring PHP to run as a module.

To be honest, if you need a specific version of PHP (and I think most people do, for one reason or another) it's worth learning how to compile Apache and PHP yourself (as explained in that article). Relying on repositories means you're always running a version of software not of your choosing.
yes.  what you want its there except mailparse. If you know what extension require for mailpersr just use that or allow me 2 hour i will tell u what extension u need. Other then its fine. I prefer source over yum.
mailarse extionsion is
 But u need to add mailperse package. I guee its a perl base packages. Mailperse website has rpm for redhat u can get from their
Ok try to install mailparse packages like this

yum install php-pecl-mailparse

after that use bellow   extension with other php extension  


let me know
rawandnetAuthor Commented:
guys i was using (<? phpinfo(); ?> page to test php version, it was blank solution is:

Using <? phpinfo(); ?> is based on the short_open_tag configuration. Make sure that in your /etc/php.ini file that this is still enabled.

short_open_tag = On

thanks, sill i will try compling steps, incase i had problem in future.
it should be like this


and if you follow the way i go

your php.ini should be in


compiling from source will take only 20 min!!! its up to you.. but if you want to go for latest version then you need to compile from source

but i will tell you to practice on a test server , like create a vmware  , and test on their before going to live server
rawandnetAuthor Commented:

Fosiul01, used your link to compile apache, mysql and php, I have compiled mysql and at stage
(bin/mysqld_safe -–user=mysql &) i got following:

[root@server mysql]# 100419 11:54:21 mysqld_safe Logging to '/usr/local/mysql/var/test3.local.err'.

100419 11:54:21 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var

100419 11:54:21 mysqld_safe mysqld from pid file /usr/local/mysql/var/ ended

I am not sure if mysql is enabled or not, how can i enable it, when i issue
(./bin/mysqladmin -u root password 'new-password') I get following:

[root@test3 mysql]# ./bin/mysqladmin -u root password 'Pass'

./bin/mysqladmin: connect to server at 'localhost' failed

error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'

Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!

what am i missing?
is this your permission to directory is Ok ??

when you start mysql you see like this  :

[root@mail ~]# /usr/local/mysql/bin/mysqld_safe --user=mysql &
[1] 19514
[root@mail ~]# 100419 10:40:44 mysqld_safe Logging to '/usr/local/mysql/var/'.
100419 10:40:45 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var

[root@mail ~]# ps aux | grep mysql
root     19514  0.0  0.1   3572  1240 pts/1    S    10:40   0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --user=mysql
mysql    19676  0.0  0.5  36048  5820 pts/1    Sl   10:40   0:00 /usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --user=mysql --log-error=/usr/local/mysql/var/ --pid-file=/usr/local/mysql/var/ --socket=/tmp/mysql.sock --port=3306
root     19688  0.0  0.0   3000   704 pts/1    S+   10:40   0:00 grep mysql

if ps aux | grep mysql does not return anything

then check the error log of your mysql which would be in "usr/local/mysql/var/test3.local.err'"
if your server name is test3

see what error log saying

rawandnetAuthor Commented:
the log shows

100419 13:33:29 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
100419 13:33:29 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
100419 13:33:29 [ERROR] /usr/local/mysql/libexec/mysqld: unknown option '-
100419 13:33:29 [ERROR] Aborting

100419 13:33:29 mysqld_safe mysqld from pid file /usr/local/mysql/var/ ended

and ps aux | grep mysql:
[root@test3 ~]# ps aux | grep mysql
root     27170  0.0  0.0  58916   528 pts/2    S+   13:31   0:00 tail -f /usr/local/mysql/var/test3.local.err

what version of mysql you download ??

latest one is : 5.1.41

rawandnetAuthor Commented:
it is 5.1.45, by the way I downloaded the file from as i coudn't do it from from mysql website itself. it ask for registration, after doing that still i didn't get confirmation email.
ommm i would not trust any thing other then mysql website

you dont have to create username and password
just click on " no thanks just take me to download"

and for 32 bit download this

Generic Linux (glibc 2.3) (x86, 32-bit), Compressed TAR Archive
rawandnetAuthor Commented:
on of them is from the source code that is 21MB
other one from General Linux 131MB,
which one shall i download i am using Linux Enterprice 5 (RHEL)
from this link

Select  Linux Generic From Combo box

now for 32 bit , download this

Generic Linux (glibc 2.3) (x86, 32-bit), Compressed  TAR Archive    

rawandnetAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.