Compile and install LAMP in linux

Source: Internet
Author: User
Tags zts

Installation of Apache + MySQL + PHP in Linux depends on installation of apr (optional)

# Tar-xf apr-1.5.0.tar.bz2 # cd apr-1.5.0 #./configure -- prefix =/usr/local/apr // specify its installation location # make & make install
Install apr-util
# tar -xf apr-util-1.5.3.tar.bz2# cd apr-util-1.5.3# ./configure  --prefix=/usr/local/apr-util  --with-apr=/usr/local/apr# make && make install
Install pcre (optional)
# tar -xf pcre-8.35.tar.gz# cd pcre-8.35# ./configure  --prefix=/usr/local/pcre# make && make install
Compile and install apache
# tar -xf httpd2.4.9.tar.gz# cd <span style="font-family: Arial, Helvetica, sans-serif;">httpd2.4.9</span># ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-modules=most# make && make install
If other dependencies are missing during compilation, you can install them separately. The installation process is shown in the above apr installation. If an apr error is prompted, remove the -- with-apr =/usr/local/apr -- with-apr-util =/usr/local/apr-util parameter from the compilation statement, because Apache contains its own apr related items by default. Start http
/usr/local/apache/bin/apachectl start
Enter http: // IP/in the browser to view It Works!
Add apache to the service.
cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
In this case, you can use service httpd start/stop to disable http service compilation and installation. For the MySQLMySQL compilation and installation process, see http://blog.csdn.net/zqtsx/article/details/9425703. Note: The above installation has some permission modification errors. Do not execute the following descriptions:
cd /usr/local/mysqlchown -R mysql .chgrp -R mysql .scripts/mysql_install_db --user=mysqlchown -R root .
</Pre> If other dependencies are missing during compilation, you can install them separately. The installation process is shown in the above apr installation. Copy the configuration file to the php Directory: # cp php. ini-production/usr/local/php5/etc/php. ini

PHP and Apache integrated editing apache configuration file httpd. conf, which supports php with apache: first, define it in the apache configuration file so that apache can process the file ending with php. Search for the AddType field in the full text, add the following content: [root @ Spg-RedHat htdocs] # vi/usr/local/apache/conf/httpd. conf AddType application /x-httpd-php .php AddType application /x-httpd-php-source .phps
Find DirectoryIndex and add index. php: DirectoryIndex. php index.html
<Directory/data/bbs/admin>
Options FollowSymLinks
AllowOverride None
Order deny, allow
Allow from all
</Directory>
Add test page: [root @ Spg-RedHat htdocs] # vim/usr/local/apache/htdocs/index. php
Edit and add: <? Phpinfo ();
?>
Restart http: service httpd stopservice httpd start test result:

So far, PHP is successfully installed;
Integrated xcache (optional) installation:
# Tar xf xcache-3.0.3.tar.gz # cd xcache-3.0.3 #/usr/local/php5/bin/phpize // phpize is used to install php extension module, through phpize can establish php plug-in module, if you want to add memcached, ImageMagick, and other extension modules to the compiled php, you need to use phpize #. /configure -- enable = xcache -- with-php-config =/usr/local/php5/bin/php-config [root @ Spg-RedHat xcache-3.1.0] # make & make installInstalling shared extensions: /usr/local/php5/lib/php/extensions/no-debug-zts-20121212/
Integration: Modify the php. ini file, add the following content: [root @ Spg-RedHat xcache-3.1.0] # vim/usr/local/php5/etc/php. ini
[xcache-common]extension = <span style="white-space: nowrap; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;">/usr/local/php5/lib/php/extensions/no-debug-zts-20121212</span><span style="white-space: nowrap; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;">/xcache.so</span>[xcache.admin]xcache.admin.enable_auth = Onxcache.admin.user = "admin"xcache.admin.pass = "6a0194f9707fa832ece6f5b66a25567e" #echo -n "youp-assword" |md5sum |awk '{print $1}'[xcache] xcache.shm_scheme =        "mmap"xcache.size  =              128Mxcache.count =                 1xcache.slots =                8Kxcache.ttl   =                 0xcache.gc_interval =           0xcache.var_size  =            0Mxcache.var_count =             1xcache.var_slots =            8Kxcache.var_ttl   =             0xcache.var_maxttl   =          0xcache.var_gc_interval =     300xcache.test =                Offxcache.readonly_protection = Offxcache.mmap_path =    "/dev/zero"xcache.coredump_directory =   ""xcache.cacher =               Onxcache.stat   =               Onxcache.optimizer =           Off[xcache.coverager]xcache.coverager =          Offxcache.coveragedump_directory = ""
Note: The extension value "/usr/local/php5/lib/php/extensions/no-debug-zts-20121212/" is the result of the previous make install.
The MD5 encryption result is generated by pass. On the Internet, you can copy the xcache. ini file to the/etc/php. d/directory for integration. However, I did not try it. If you are interested, try it on your own. Restart Apache and view the xcache configuration on the phpinfo page, as shown in:


End: it is a painful process to install php for the first time.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.