LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Compiling Apache, PHP and MySQL from source. (https://www.linuxquestions.org/questions/linux-software-2/compiling-apache-php-and-mysql-from-source-624634/)

Phr34Ck 02-28-2008 09:24 PM

Compiling Apache, PHP and MySQL from source.
 
Hello everyone,

I'm using CentOS4 x86_64, and I want to compile/install Apache, Php and MySQL from the source code.

I have downloaded and untarred all three softwares, but I'm not understanding what options should I include. This is the first time I compile form source, and I'm doing it because I want to have some experience, and because YUM does not offer the latest releases of these softwares.

I have downloaded the source code to ~/sourcecode/ folder. I have a basic experience, as I tried to compile apache once.

My question is: What kind of options do you recommend? and what should be compiled before the other?

so far, I have gathered these information: Apache first, then MySql, then php. I know the --prefix option, and something about apsx, which I have no idea what that is. For PHP, I think there is --with-mysql or something...

And what about security? I always read that each process (apache, php, mysql) should be run on different useraccount with tight privileges. Any of you have experience in that? and how do I exactly do it?

Thanks a lot for your time.

Phr34Ck 02-29-2008 01:11 AM

Okay, after reading a little, I did the following:

For apache: ./configure --prefix=/wwwroot --enable-so --enable-cgi --enable-info --enable-rewrite --enable-speling --enable-usertrack --enable-mime-magic

For Php: ./configure --prefix=/wwwroot/php --with-apxs2=/wwwroot/bin/apxs --with-config-file-path=/wwwroot/php --with-zlib --disbale-cgi --with-gettext

I couldn't compile MySQL. I'm trying to figure out how ....

Is there a way to enable MySQL later on when I compile it? As you noticed, I didn't use --with-mysql when compiling PHP.

bathory 02-29-2008 02:30 AM

Quote:

I couldn't compile MySQL. I'm trying to figure out how ....
Are you sure you've downloaded the sources. Because the common mysql software you can d/l from mysql.com is the binary. If it is the source you can install it with the usual procedure ./configure, make, make install. If it's the binary read the included INSTALL file to see how to install it.
Quote:

Is there a way to enable MySQL later on when I compile it? As you noticed, I didn't use --with-mysql when compiling PHP.
You should recompile php to include mysql support

j-ray 02-29-2008 02:33 AM

you can install mysql whenever you want or need. You can take a binary version too. They are compiled with intel compiler and tend to run faster than those built with gcc. The --with-mysql would have been useful if you intend to connect to mysql from php...

Phr34Ck 02-29-2008 05:03 AM

I have compiled them all :). MySQL required gcc-c++ which I didn't have. Now I'm facing another problem. I cannot find my.conf so I could use MySQL ;p. I'm having this error:
Quote:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'

bathory 02-29-2008 05:28 AM

You can search the support-files/ subdirectory where you've compiled mysql for various my-whatever.cnf. Pick the one that matches your needs and copy it in /etc, or under the subdir etc/ in the directory you've installed mysql.
Quote:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'
Make sure you did all the necessary steps before starting the server for the first time. You should give apropriate permissions to the databases directory and use the supplied scripts to create initial tables.
You can also search LQ for this error to find more answers.

Regards

Phr34Ck 02-29-2008 06:05 AM

Thanks a lot bathory. I'm still battling my way through. I've tried to search the subdirectories after installation, but I couldn't find anything. I will read the mysql docs later on. Thanks though.


All times are GMT -5. The time now is 03:05 PM.