Use the yaf framework to build your own website in CentOS

Source: Internet
Author: User
Tags install openssl fully qualified domain name

Use the yaf framework to build your own website in CentOS
On CentOS6.5, we used yum to build the LAMP environment. In the previous article, we introduced ~

First, use yum to delete all LAMP set up yesterday.

# sudo yum erase httpd php* mysql*

Then start to install and compile manually ~ I first created a test folder under usr. I am afraid that I will not know where to download it if I have more operations.

#  mkdir /usr/test# cd /usr/test

1.-Apache

# wget http://mirrors.cnnic.cn/apache//httpd/httpd-2.4.16.tar.bz2


Decompress and enter

# tar -jxvf httpd-2.4.26.tar.bz2# cd httpd-2.4.26

Install gcc

# sudo yum install gcc

Configure

# ./configure --prefix=/test/httpd --enable-so --enable-rewrite

If an apr problem occurs, see here for solutions.

// After configure is correct, # make & make install # sudo/usr/test/prefix/httpd-k start

If error: httpd: cocould not reliably determine the server's fully qualified domain name ,....... The solution is to find the compiled httpd folder. For example, if my folder is/usr/test/prefix/httpd, find httpd In the conf folder. conf file, edit, replace # ServerName www. example. con: Remove # Before 80 and restart.

In this way, open your address and you will see It works! Even if Apache is successfully installed and compiled ~ PS if you want to delete the compressed file downloaded earlier, you can use the rm-f file name command to delete it ~

2.-php

# sudo yum install libxml2 libxml2-devel curl curl-devel libjpeg libjpeg-devel libpng libpng-devel libmcrypt libmcrypt-deel libtool-ltdl-devel
# wget http://cn2.php.net/get/php-5.5.28.tar.gz/from/this/mirror# mv mirror php-5.5.28.tar.gz# tar -zxvf php-5.5.28.tar.gz# cd php-5.5.28# ./configure --prefix=/usr/test/prefix/php --with-apxs2=/usr/test/prefix/httpd/bin/apxs --with-curl --with-mcrypt --enable-mbstring --with-iconv --with-gd --with-jpeg-dir=/usr/test/local/lib --enable-pdo --with-pdo-mysql=mysqlnd --with-mysql=mysqlnd --with-mysqli=mysqlnd# make && make install

And wait a little longer.

After compilation

# sudo cp php.ini-development /usr/test/prefix/php/lib/php.ini# sudo ln -s /usr/test/prefix/php/bin/php /usr/bin/php

Cp Assignment Command details ln command details

# sudo vi /usr/test/prefix/php/lib/php.ini

Delete the semicolon before include_path and change include_path = "/opt/php/lib/php" to delete the semicolon before include_path, change include_path = "/usr/test/prefix/php/lib/php"

# sudo vi /usr/test/prefix/httpd/conf/httpd.conf

Add an AddHandler application/x-httpd-php. php line at the bottom

# sudo /usr/test/prefix/httpd/bin/httpd -k restart# sudo vi /usr/test/prefix/httpd/htdocs/phpinfo.php

The content of phpinfo. php is

<?phpphpinfo();?>

Then, http: // address/phpinfo. php shows the php configuration information, indicating that php is installed ~ Search for mysqlnd pdo_mysql mysqli. If yes, php can access mysql.

Next, add Apache to the system service and start it on startup.

# sudo cp /usr/test/prefix/httpd/bin/apachectl /etc/init.d/httpd# sudo vi etc/init.d/httpd

Add

#!:/bin/sh# chkconfig: 2345 85 15# description: Apache is World Wide Web server

Next

# sudo chmod +x /etc/init.d/httpd# /sbin/chkconfig --add httpd# sudo /sbin/chkconfig --list httpd# sudo ln -s /sbin/chkconfig /usr/bin/chkconfig# sudo ln -s /sbin/service /usr/bin/service

3-. mysql directly use yum for installation. For more information, see the previous article on LAMP environment setup.

4.-install PHP extensions. Install libssh2 first.

# cd /usr/test/# wget https://github.com/libssh2/libssh2/releases/download/libssh2-1.6.0/libssh2-1.6.0.tar.gz#tar -zxvf libssh2-1.6.0.tar.gz#cd libssh2-1.6.0# ./configure --prifex=/usr/test/prefix/libssh2# make && make install

No cryoto library found is reported. This is because I have not installed the OpenSSLeep encryption library. So install it first.

# yum install openssl-devel

Return to the original folder to complete compilation.

Install ssh2 again

# cd /usr/test/# wget http://pecl.php.net/get/ssh2-0.11.3.tgz# tar -zxvf ssh2-0.11.3.tgz# cd ssh2-0.11.3.tgz# /usr/test/prefix/php/bin/phpize# ./configure --prefix=/usr/test/prefix/ssh2 --with-ssh2=/usr/test/prefix/libssh2 --with-php-config=/usr/test/prefix/php/bin/php-config# make && make install

Then add extension = ssh2.so to/usr/test/prefix/php/lib/php. ini.

In this case, Yaf is used ~

# cd /usr/test# wget http://pecl.php.net/get/yaf-2.3.1.tgz# tar -zxvf yaf-2.3.1.tgz# cd yaf-2.3.1# /usr/test/prefix/php/bin/phpize# ./configure --prefix=/usr/test/prefix/yaf --with-php-confi=/usr/test/prefix/php/bin/php-config# make && make install

After the compilation and installation are complete, you must configure it in the php. ini configuration.

extendsion = yaf.so[yaf]yaf.environ = productyaf.library = NULLyaf.cache_config = 0yaf.name_suffix = 1yaf.name_separator = ""yaf.forward_limit = 5yaf.use_namespace = 0yaf.use_spl_autoload = 0

Restart the server and check whether the phpinfo () has the yaf extension.

Success ~ Next, you can use the yaf framework to build your own website ~

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.