Install and configure lamp in Linux

Source: Internet
Author: User
Tags php source code

Copyright statement: original works can be reproduced. During reprinting, you must mark the original publication, author information, and this statement in hyperlink form. Otherwise, legal liability will be held. Http://blog.csdn.net/mayongzhan-ma yongzhan, myz, mayongzhan

N days of pain. this is really abnormal. n more than one software requires make to think of this and suddenly began to like xmapp. I hope the majority of phper will have time to study this too time... if you are a professional Linux administrator... you have to work hard .! Mounted to zlib for the first time .... the final result is to delete the centos that is almost corrupted... the painful process is as follows: MySQL + Apache + OpenSSL + PHP + Gd + libpng + libjpeg + FreeType2 + zlib (this is very important and should be used in many cases .) + zendoptimizer + libxml MySQL this is the first hurdle, first make error... after analysis, we know that GCC is not installed. dizzy. when installing centos, you do not need to select a development tool... after make can be used... failed to make after analysis .... I know that glibcc is under it. It is compiled... inverted ~~~~ Directly copy the past... apache is not installed first. install other things first. these are the little things. this causes the termination of zlib throughout the process. This is the first installation. nothing to say ,. /configure -- prefix =/usr/myz/libs/zlib: FreeType2 is successfully installed, and then libpng is stuck here... prompt that zlib cannot be found. I tried to change makefile .... the result is useless... then I re-installed zlib... then install libpng... the result is not loaded to the specified location... crazy. then delete the pain... if God gives me another chance... I am willing to directly install xmapp... if you need to install a Web server. I select. rpm... if it is Ubuntu, I will choose apt-Get... try again. mySQL + Apache + PHP + Gd + libpng + libjpeg + FreeType2 + zlib + libxml MySQLTar-zxvf mysql.tar.gz groupadd mysqluseradd-G MySQL to the decompressed directory to initialize the database:./scripts/mysql_install_db -- user = mysqlchown-r root.
Chown-r Mysql Data
Chgrp-r mysql. Add to System Startup Group (Red Hat): CP./support-files/MySQL. Server/etc/init. d/mysqldchkconfig mysqld Reset
Add CP./support-files/my-medium.cnf/etc/My. CNF
Bin/mysqld_safe -- user = MySQL & An error occurred while starting the system. because MySQL cannot be found, you must modify/etc. init. d/mysqld: Change/usr/local/MySQL to my directory, OK, another point is to go to Ln-fs/usr/myz/MySQL/bin/MySQL under/usr/local/bin. Of course, there is also mysqladmin mysqldump which cannot be remotely connected... dizzy .... grant all on *. * To root @ "202.96.75.68" identified by "dboomysql" OK... mySQL is installed... MySQL ConfigurationIn fact, some mysqladmin-u Root Password XXX has just been set. Now only the character set is left. Find the client configuration. [client] add default-character-set = utf8. The default character set is utf8. find [mysqld] and add default-character-set = utf8. The default character set is utf8init_connect = 'set names utf8'. Set utf8 encoding when connecting to the MySQL database, to run MySQL database utf8) after modification, restart MySQL (/etc/init. d/MySQL restart). Check show variables like 'character % '; ZlibThis is very important... learn from the previous lessons .. install # tar-zxvf zlib-1.2.2.tar.gz directly by default
# Cd zlib-1.2.2
#./Configure
# Make
# Make install LibjpegThis is silly. you cannot create folders by yourself. after you try it, you will know in the make install step #. /configure -- prefix =/usr/local/JPEG -- enable-shared -- enable-static # Make
# Make install create a folder that has a problem. OK Libpng# Cp scripts/makefile. Linux makefile
# Make (if you are prompted that the zlib library file or header file cannot be found, the default path of zlib in the makefile file is incorrect. You can edit the MAKEFILE file, find the zlib item, and re-specify the path to zlib. We recommend that you install it by default ).
# Make install

FreeType./Configure -- prefix =/usr/local/FreeType make install Libxml2
./Configure -- prefix =/usr/local/libxml2
Make
Make installcp xml2-config/usr/bin which will be used during PHP Compilation GDNote: Both PNG and zlib are installed by default #. /configure -- prefix =/usr/local/GD2 -- With-JPEG =/usr/local/JPEG -- With-PNG =/usr/local/lib -- With-zlib =/usr /local/lib -- With-FreeType =/usr/local/FreeType
# Make
# Make install if the NO of the above items does not appear, the installation is successful. Finally, the Apache Apache#. /Configure -- prefix =/usr/myz/Apache -- sysconfdir =/etc -- enable-so -- enable-track-vars -- enable-Rewrite -- With-z-Dir =/usr/ local/lib
# Make
# Make installsysconfdir is the configuration file directory so is to allow sotrack-vars to rewrite zdir zlib compression for the get/post and other tracking functions such as the cookie startup rewrite Apache ConfigurationVI/etc/httpd. conf
You need to modify the following items:
Find loadmodule php5_module modules/libphp5.so
Load PhP5 on Apache using dynamic modules (DSO. Apache loads PHP after it is started.
Remove the # sign (note removed by default)
# Addtype application/X-gzip. GZ. tgz
Add two rows below
Addtype application/X-httpd-PHP. php
Addtype application/X-httpd-PHP-source. PHPs
The first sentence is to call the PHP module to explain the code in PHP when Apache encounters a. php file suffix. The second sentence is to highlight the PHP source code in syntax when the. PHPs file suffix is encountered. Many articles can be made here, such as addtype application/X-httpd-PHP .html. In this example, apachewill Use PHP to explain the. html file. The "pseudo static" of many websites is what we do here.
Find directoryindex index.html
Change to directoryindex index.html index.htm index. php. This is to set the default homepage for Apache. And there is a sequential order.
# Cp/usr/lamp/apache2/bin/apachectl/etc/init. d/httpd
Set auto-start
# Chkconfig -- add httpd an error occurs here. Add the following to the first line of httpd: # myz # chkconfig: 2345 60 40 # Description: myz Server
Add Apache as a system service
# Service httpd start
The service will be enabled. Similarly, the Service httpd stop is to stop the service. You can also use service httpd restart. However, there is no prompt information. You can write a shell script by yourself. It looks much better to add some prompt information. Here, an error occurs: httpd cocould not reliably determine needs to add www.yourdomain.com: 80 under servername: www.example.com: 80 in httpd. conf. PHP#. /Configure -- prefix =/usr/myz/PHP/-- with-apxs2 =/usr/myz/Apache/bin/apxs/-- With-config-file-Path =/etc/-- enable -Safe-mode/-- With-zlib =/usr/local/lib/-- With-libxml-Dir =/usr/local/lib/-- enable-mbstring/-- With-MySQL =/usr/myz/MySQL/-- With-mysql-Sock =/tmp/-- With-PDO-mysql =/usr/myz/MySQL/-- enable-soap/--- XMLRPC/-- enable-sockets/-- With-curl =/user/local/lib/-- enable-XSL =/usr /Local/lib/-- With-OpenSSL =/usr/local/lib/-- With-Gd =/usr/local/lib/-- With-JPEG-Dir =/usr/local /lib/-- With-PNG-Dir =/usr/local/lib/-- With-FreeType-Dir =/usr/loca/lib/Blue is what I think is necessary. some of them need to be installed. for example, Apache, zlib, libxml2, libcurl, libxslt, and libxslt. I use 5.2.5. Some of them are default enable. For example, CLI is incomplete... but enough... but not good... but there are too many times. I made up n times !!!! Weaknesses in the US. without libcurl installed, there is also XSLT make. The most terrible thing is to keep repeating during make test... do not exit. only reset computers... make install encountered an error again, saying that libphp5.so could not be found, searched for half a day, and finally deleted all the items again. OK copy PHP. ini-recommended is Php. INI and put it in the/etc/directory.

PHP ConfigurationThis... Whatever it is... because it is an experiment, so nothing has been changed... just read the phpinfo () End...

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.