


1. Compile and install php5.6.30
Installation environment:
# cat /etc/redhat-release CentOS release 6.8 (Final)
# /application/nginx/sbin/nginx -v nginx version: nginx/1.6.3
Download the php5.6.30 installation package
wget http://cn2.php.net/distributions/php-5.6.30.tar.bz2
Unzip
tar -xjf php-5.6.30.tar.bz2
Required for installation Dependency package
# rpm -qa zlib-devel libxm12-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel libpng-devel gd-devel libcurl-devel libxslt-devel # yum install zlib-devel libxm12-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel libpng-devel gd-devel libcurl-devel libxslt-devel -y
Install libiconv library
wget tar zxf libiconv-1.14.tar.gz cd libiconv-1.14 ./configure --prefix=/usr/local/libiconv make make install
Start installing php
[root@darius php-5.6.30]#./configure --prefix=/application/php5.6.30 --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir=/usr/local/libiconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=nginx --with-fpm-group=nginx --enable-ftp --without-pear --disable-phar #因为本机没有pear包,所以选择暂时跳过(--without-pear --disable-phar),等php安装后再补装go-pear
make compile
[root@darius php-5.6.30]# make ... ... ... Build complete. Don't forget to run 'make test'. [root@darius php-5.6.30]# make test
make test Some problems were reported, but I ignored them and continued the installation
Execute make install
[root@darius php-5.6.30]# make install Installing shared extensions: /application/php5.6.30/lib/php/extensions/no-debug-non-zts-20131226/ Installing PHP CLI binary: /application/php5.6.30/bin/ Installing PHP CLI man page: /application/php5.6.30/php/man/man1/ Installing PHP FPM binary: /application/php5.6.30/sbin/ Installing PHP FPM config: /application/php5.6.30/etc/ Installing PHP FPM man page: /application/php5.6.30/php/man/man8/ Installing PHP FPM status page: /application/php5.6.30/php/php/fpm/ Installing PHP CGI binary: /application/php5.6.30/bin/ Installing PHP CGI man page: /application/php5.6.30/php/man/man1/ Installing build environment: /application/php5.6.30/lib/php/build/ Installing header files: /application/php5.6.30/include/php/ Installing helper programs: /application/php5.6.30/bin/ program: phpize program: php-config Installing man pages: /application/php5.6.30/php/man/man1/ page: phpize.1 page: php-config.1 Installing PDO headers: /application/php5.6.30/include/php/ext/pdo/
2. Configure php
cp php.ini-production /usr/local/php/etc/php.ini #复制php配置文件到安装目录rm -rf /etc/php.ini #删除系统自带配置文件 ln -s /usr/local/php/etc/php.ini /etc/php.ini #添加软链接到 /etc目录 cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf #拷贝模板文件为php-fpm配置文件 ln -s /usr/local/php/etc/php-fpm.conf /etc/php-fpm.conf #添加软连接到 /etc目录
Modify php-fpm.conf
pid = run/php-fpm.pid #取消前面的分号
Modify php-ini.conf
Find: disable_functions=
Modify to:
disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter, ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen, disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error, posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin, posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid, posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid, posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname
#List PHP that can be disabled Function, if some programs need to use this function, it can be deleted and undisabled.
Found: ;date.timezone =
Modified to:
date.timezone = PRC #设置时区
Found: expose_php = On
Modified to:
expose_php = Off #禁止显示php版本的信息
Found: short_open_tag = Off
Modify to:
short_open_tag = ON #支持php短标签
Note: short_open_tag must be turned on. After turning it on, you can use PHP segment tags: (). Also, only if this is turned on can you use = instead of echo. Some open source systems use short tags, and an error will be reported if they are not turned on.
Find opcache.enable=0
Changed to
opcache.enable=1 #php支持opcode缓存
Found:;opcache.enable_cli=1 #php supports opcode caching
Modify to:
opcache.enable_cli=0
Add in the last line:
zend_extension=opcache.so #开启opcode缓存功能
:wq #SaveExit
location ~ \.php$ { root html/bbs; #你网页根目录 fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }Create a test file:
[root@darius bbs]# cat index.php <?php phpinfo(); ?> [root@darius bbs]# cat index.html bbs.html [root@darius bbs]# pwd /application/nginx/html/bbsStart php-fpm, restart nginx, and test the results
/application/php/sbin/php-fpm -c /application/php/etc/php.ini -y /application/php/etc/php-fpm.conf
/application/nginx/sbin/nginx -s reload
The above is the detailed content of Detailed explanation of the process of compiling, installing and configuring php5.6.30 under Linux (picture and text). For more information, please follow other related articles on the PHP Chinese website!

PHP is used to build dynamic websites, and its core functions include: 1. Generate dynamic content and generate web pages in real time by connecting with the database; 2. Process user interaction and form submissions, verify inputs and respond to operations; 3. Manage sessions and user authentication to provide a personalized experience; 4. Optimize performance and follow best practices to improve website efficiency and security.

PHP uses MySQLi and PDO extensions to interact in database operations and server-side logic processing, and processes server-side logic through functions such as session management. 1) Use MySQLi or PDO to connect to the database and execute SQL queries. 2) Handle HTTP requests and user status through session management and other functions. 3) Use transactions to ensure the atomicity of database operations. 4) Prevent SQL injection, use exception handling and closing connections for debugging. 5) Optimize performance through indexing and cache, write highly readable code and perform error handling.

Using preprocessing statements and PDO in PHP can effectively prevent SQL injection attacks. 1) Use PDO to connect to the database and set the error mode. 2) Create preprocessing statements through the prepare method and pass data using placeholders and execute methods. 3) Process query results and ensure the security and performance of the code.

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP makes it easy to create interactive web content. 1) Dynamically generate content by embedding HTML and display it in real time based on user input or database data. 2) Process form submission and generate dynamic output to ensure that htmlspecialchars is used to prevent XSS. 3) Use MySQL to create a user registration system, and use password_hash and preprocessing statements to enhance security. Mastering these techniques will improve the efficiency of web development.

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 English version
Recommended: Win version, supports code prompts!

SublimeText3 Chinese version
Chinese version, very easy to use

Dreamweaver Mac version
Visual web development tools