Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use php-5.4.45

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly shows you "how to use php-5.4.45", the content is simple and easy to understand, organized clearly, I hope to help you solve doubts, let Xiaobian lead you to study and learn "how to use php-5.4.45" this article.

In order not to affect the experimental effect, selinux and iptables can be turned off in advance.

[root@localhost ~]# chkconfig iptables off

[root@localhost ~]# chkconfig ip6tables off

[root@localhost ~]# /etc/init.d/iptables stop

[root@localhost ~]# /etc/init.d/ip6tables stop

[root@localhost ~]# sed -i "s/LINUX=.*/ LINUX=disabled/g" /etc/selinux/config

To take effect after changing selinux, you need to restart the server, reboot or shutdown -r now

Step 1 Install yum extension source

# yum install -y epel-release

Note: Version before 6.7 is not supported, and the next step is required.

# wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-6.repo

Step 2 Install the dependency package

# yum install make apr* autoconf automake gcc gcc-c++ zlib-devel openssl openssl-devel pcre-devel gd kernel keyutils patch perl kernel-headers compat* mpfr cpp glibc libgomp libstdc++-devel ppl cloog-ppl keyutils-libs-devel libcom_err-devel libsepol-devel libselinux-devel krb5-devel libXpm* freetype libjpeg* libpng* php-common php-gd ncurses* libtool* libxml2 libxml2-devel patch libmcrypt-devel php-mcrypt libmcrypt mcrypt freetype-devel freetype bzip2-devel bzip2-libs libxml2 libxml2-devel libxml2-python

Install all of these packages and you won't get the wrong message,

Step 3: Install PHP

1, download

# cd /usr/local/src/

# wget http://cn2.php.net/distributions/php-5.4.45.tar.bz2

2, decompression

# tar -jxvf php-5.4.45.tar.bz2

3, installation

# cd php-5.4.45

# ./ configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif --disable-ipv6

If there is an error:sorry,i cannot run apxs.possible reasons follow:

Solution:

# find / -name perl

/usr/bin/perl

#vim /usr/local/apache2/bin/apxs

Change the first line to #!/ usr/bin/perl -w

#make && make install && echo $?

# cp /usr/local/src/php-5.4.45/php.ini-production /usr/local/php/etc/php.ini

Copy Configuration Files

test

# apachectl -M

php5_module (shared)

Check whether php installation is successful, use apache -M to check whether apache dynamic module loads php5

Web Testing

The Apache master configuration file is: /usr/local/apache2/conf/httpd.conf

# vim /usr/local/apache2/conf/httpd.conf

# If the AddEncoding directives above are commented-out, then you

# probably should define those extensions to indicate media types:

#

AddType application/x-compress .Z

AddType application/x-gzip .gz .tgz

AddType application/x-httpd-php .php (define apache parse PHP)

#

#

DirectoryIndex index.html index.php

#

[root@lanmp php-5.4.45]# cd /usr/local/apache2/htdocs/

[root@lanmp htdocs]# vi info.php

[root@lanmp htdocs]# cat info.php

Enter http://ip/info.php in ie

The above is " php-5.4.45 how to use" all the content of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report