Php5.4.13 on ubuntu12.04

Source: Internet
Author: User
Tags gmp hmac sapi
Php5.4.13configure the latest php5.4.13.tar.gz on ubuntu12.04to download the latest php5.4.13.tar.gz from the official network. here, the weak reminder is that php-fpm has been built into PHP5.3 and does not need to be installed separately, that is, the configuration of php-cgi hypervisor 2, tarzxvfphp5.4. php5.4.13 on ubuntu12.04

Download the latest php5.4.13.tar.gz

Here is a weak reminder: php-fpm has been built into PHP5.3 and does not need to be installed separately, that is, php-cgi hypervisor.

II. tar zxvf php5.4.13.tar.gz

III. cd php5.4.13

IV../buildconf -- force if the following error is reported: You need autoconf version 2.59 or higher

??? Run the following command to uninstall the original autoconf:

apt-get --purge remove autoconf

?? Then

apt-get autoremove autoconf

?? Then install

apt-get install autoconf

V,Start compiling and installing PHP5.4.13

. /Configure -- prefix =/usr/local/php -- with-config-file-path =/usr/local/php/etc -- with-curl -- with-pear -- with-gd -- with-jpeg-dir -- with-png-dir -- with-zlib -- with-xpm-dir -- with-freetype-dir -- with-t1lib -- with-mcrypt -- with-mhash -- -mysql -- with-mysqli -- enable-pdo -- with-pdo-mysql -- with-openssl -- with-xmlrpc -- with-xsl -- with-gettext -- with-fpm-user = www -data -- with-fpm-group = www-data -- enable-fpm -- enable-exif -- enable-wddx -- enable-zip -- enable-bcmath-with-bz2 -- enable-calendar -- enable -ftp -- enable-mbstring -- enable-soap -- enable-sockets -- enable-shmop -- enable-dba -- enable-sysvmsg -- enable-sysvsem -- enable-sysvshm -- enable-debug -- enable -maintainer-zts -- enable-embed

?

make && make install

?

The errors and solutions are as follows:

?

1) Configure: error: xml2-config not found. Please check your libxml2 installation.
Solutions:
# Aptitude install libxml2-dev

2) Checking for pkg-config... /Usr/bin/pkg-config
Configure: error: Cannot find OpenSSL's ? Or?

Solutions:

?

Sudo apt-get install openssl-dev

?

Sudo apt-get install libcurl3-openssl-dev

?

?

?

3) Configure: error: Please reinstall the BZip2 distribution

Solutions:
? Apt-get install libbz2-dev

4) Configure: error: Please reinstall the libcurl distribution-
Easy. h shoshould be in/include/curl/

Solutions:
Apt-get install curl
Apt-get install libcurl3
Apt-get install libcurl4-gnutls-dev (For Ubuntu)


5) Configure: error: libjpeg. (also) not found.

Solutions:
? Apt-get install libjpeg-dev

6) Configure: error: libpng. (also) not found.

Solutions:

Apt-get install libpng-dev

7) Configure: error: freetype. h not found.
Solutions:


8) Configure: error: Unable to locate gmp. h

Solutions:
Yum install gmp-devel

9) Configure: error: Cannot find MySQL header files under/usr.
Note that the MySQL client library is not bundled anymore!

Solutions:
Yum install mysql-devel (For Redhat & Fedora)

# Apt-get install libmysql ++-dev (For Ubuntu)

10) Configure: error: Please reinstall the ncurses distribution

Solutions:
Yum install ncurses-devel

11) Checking for unixODBC support... Configure: error: ODBC header file '/usr/include/sqlext. h' not found!

Solutions:
Yum install unixODBC-devel

12) Configure: error: Cannot find pspell

Solutions:
Yum install pspell-devel

13) configure: error: mcrypt. h not found. Please reinstall libmcrypt.

Solutions:
Yum install libmcrypt-devel (For Redhat & Fedora)

# Apt-get install libmcrypt-dev

14) Configure: error: snmp. h not found. Check your SNMP installation.

Solutions:

?

15) configure: error: libXpm. (a | so) not found.

Apt-get install libxpm-dev may also encounter this error, then continue cd/usr/lib/ln-s/usr/lib/x86_64-linux-gnu/libXpm. a. ln-s/usr/lib/x86_64-linux-gnu/libXpm. so. ln-s/usr/lib/x86_64-linux-gnu/libXpm. so.4.ln-s/usr/lib/x86_64-linux-gnu/libXpm. so.4.11.0.

?

So far, php5.4.13 should be installed successfully, and then Configure

Add the directory where php5 is located to the bash PATH:

?

echo 'if [ -d "/usr/local/php/bin" ] && [ -d "/usr/local/php/sbin" ]; then    PATH="$PATH:/usr/local/php/bin:/usr/local/php/sbin"fi' >> /etc/bash.bashrc
? The current session is also added:
export PATH="$PATH:/usr/local/php/bin:/usr/local/php/sbin"
? Prepare the log file directory of PHP5:

?

mkdir /var/log/php-fpm chown -R www-data:www-data /var/log/php-fpm
?

?

Prepare the PHP configuration file:

?

cp -f php.ini-production /usr/local/php/etc/php.ini
chmod 644 /usr/local/php/etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
?

Note: The PHP5 configuration file in/usr/local/php/etc/php. ini, php-fpm configuration file in/usr/local/php/etc/php-fpm.conf.

Set the php-fpm startup management file and make PHP run automatically at ubuntu startup (the following sapi is in the PHP5.4.0 installation package ):

Cp-f sapi/fpm/init. d. php-fpm/etc/init. d/php-fpm

Chmod 755/etc/init. d/php-fpm

Update-rc.d-f php-fpm defaults

Set PHP automatic log segmentation and compression: vi/etc/logrotate. d/php-fpm

Add the following content to save and exit:

/var/log/php-fpm/*.log {weeklymissingokrotate 52compressdelaycompressnotifemptycreate 640 www-data www-datasharedscriptspostrotate[ ! -f /usr/local/php /var/run/php-fpm.pid ] || kill -USR1 `cat /usr/local/php/ /var/run/php-fpm.pid`endscript}

?

Configure php-fpm and nginx

Php-fpm:

vi /usr/local/php/etc/php-fpm.conf 

The following parameters need to be changed:

  1. Pid = run/php-fpm.pid? // This operation is required to remove the comment (the 502 error is returned if the comment is not removed at the beginning)
  2. Error_log = log/php-fpm.log
  3. Log_level = notice
  4. ; Emergency_restart_threshold = 0
  5. ; Emergency_restart_interval = 0
  6. ; Process_control_timeout = 0
  7. ; Daemonize = yes
  8. [Www]
  9. ; Prefix =/path/to/pools/$ pool
  10. Listen = 127.0.0.1: 9000
  11. ; Listen. backlog =-1
  12. Listen. allowed_clients = 127.0.0.1
  13. Listen. owner = www-data
  14. Listen. group = www-data
  15. Listen. mode = 0666
  16. User = www-data
  17. Group = www-data
  18. Pm = dynamic
  19. Pm. max_children = 50
  20. Pm. start_servers = 20
  21. Pm. min_spare_servers = 5
  22. Pm. max_spare_servers = 35
  23. Pm. max_requests = 500

?

?

?

?

?

Then Configure nginx: vi/etc/nginx. confuser nginx; worker_processes 2; error_log/var/log/nginx/error. log warn; pid/var/run/nginx. pid; events {use epoll; worker_connections 1024;} http {include mime. types; default_type application/octet-stream; # charset gb2312; limit 128; client_header_buffer_size 32 k; limit 4 32 k; client_max_body_size 8 M; sendfile on; tcp_nopu Sh on; keepalive_timeout 60; tcp_nodelay on; fastcgi_connect_timeout 300 s; fastcgi_send_timeout 300 s; limit 300 s; limit 64 k; fastcgi_buffers 4 64 k; limit 128 k; limit 128 k; gzip on; gzip_min_length 1 k; gzip_buffers 4 16 k; gzip_http_version 1.0; gzip_comp_level 2; gzip_types text/plain application/x-javascript text/css applicati On/xml; gzip_vary on; # limit_zone crawler $ binary_remote_addr 10 m; server {listen 80; #/* listener port */server_name localhost; #/* server name */index index.html index.htm index. php; #/* Default homepage name */root/var/www; #/* website root directory. you can also use the following content */# or the relative path, the following comments */# location/{# root html; # index index.html index.htm; #}# limit_conn crawler 20; # Support for PHP in FastCGI mode. the php page is processed by the fastcgi proxy, this is also an application of reverse proxy. it can be jsp, asp, and other scripts. Location ~. * \. (Php | php5 )? $ {Include/etc/nginx/fastcgi_params; # The FastCGI module is configured with the basic environment variable fastcgi_pass 127.0.0.1: 9000; fastcgi_index index. php; fastcgi_param SCRIPT_FILENAME/var/www/$ fastcgi_script_name; # include fcgi. conf; #/* fastcgi configuration file, changed to the following content */} # for a certain type of files, set the Expiration Time, static pages are usually set to a longer time. # For static files, nginx handles location ~. *\. (Gif | jpg | jpeg | png | bmp | swf | js | css) $ {expires 30d ;} # Log Format: log_format access' $ remote_addr-$ remote_user [$ time_local] "$ request" ''$ status $ response" $ http_referer "'' "$ http_user_agent" $ http_x_forwarded_for '; access_log/usr/local/ngxin/logs/access. log access;} and save and exit. restart fpm and nginx/etc/init. d/php-fpm restart/etc/init. d/nginx restart installation completed: root @ Cyrec-desktop :~ # Php-fpm-vPHP 5.4.0 (fpm-fcgi) (built: Mar 12 2012 18:13:13) (DEBUG) Copyright (c) 1997-2009 The PHP GroupZend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

References:

Http://www.cslog.cn/Content/ubuntu-10-04-nginx-0-8-52-php-fpm-5-3-3-apc-mysql-i/

Http://www.laruence.com/2009/07/28/1030.html

Http://www.frostsky.com/2011/11/php-configure-error/

Http://letle.iteye.com/blog/625728

Http://kangxiaowei.com/archives/2398.html

Http://wenku.baidu.com/view/2ae270e9551810a6f52486ea.html

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.