温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Ubuntu如何搭建php5.6Web服务器环境

发布时间:2022-10-22 10:52:26 来源:亿速云 阅读:104 作者:iii 栏目:服务器

今天小编给大家分享一下Ubuntu如何搭建php5.6Web服务器环境的相关知识点,内容详细,逻辑清晰,相信大部分人都还太了解这方面的知识,所以分享这篇文章给大家参考一下,希望大家阅读完这篇文章后有所收获,下面我们一起来了解一下吧。

ubuntu 16.04默认安装php7.0环境,但是php7目前对某些旧系统的兼容性并不是很好,如果自行安装php5需要清除php7的已安装包,否则会报错。

移除默认及已安装的php包

sudo dpkg -l | grep php| awk '{print $2}' |tr "\n" " "
sudo apt-get install aptitude
sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`

添加 ppa

sudo add-apt-repository ppa:ondrej/php

安装php5.6

sudo apt-get update
sudo apt-get install php5.6

安装扩展

sudo apt-get install php5.6-gd
sudo apt-get install php5.6-mysql

安装apache2

sudo apt install apache2
sudo apt-get install libapache2-mod-php5.6

安装mysql

sudo apt install mysql-server php5.6-mysql  root root0x0
sudo apt-get install mysql-client
mysql_secure_installation

安装 phpmyadmin

sudo apt-get install phpmyadmin
sudo apt-get install php5.6-mbstring
sudo apt-get install php5.6-gettext
sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin

配置phpmyadmin

nano /etc/php/5.6/apache2/php.ini
display_errors = on(显示错误日志,出现两次,都要改,不然无效)
extension=php_mbstring.dll (开启mbstring)
sudo dpkg-reconfigure phpmyadmin (重新配置phpmyadmin)

增加网站

sudo ln -s /etc/apache2/sites-available/files.conf /etc/apache2/sites-enabled/files.conf
sudo chown -r www-data /var/www/tianya
sudo /etc/init.d/apache2 restart

添加ftp

sudo apt install vsftpd
useradd -d /var/www/tianya -s /sbin/nologin myftp
passwd myftp
chmod 777 -r /var/www/tianya
usermod -s /sbin/nologin myftp
vim /etc/vsftpd.conf
vim /etc/vsftpd.chroot_list
service vsftpd restart
service vsftpd status
# example config file /etc/vsftpd.conf
#
# the default compiled in settings are fairly paranoid. this sample file
# loosens things up a bit, to make the ftp daemon more usable.
# please see vsftpd.conf.5 for all compiled in defaults.
#
# read this: this example file is not an exhaustive list of vsftpd options.
# please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
#
# run standalone? vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
#userlist_enable=yes
#userlist_deny=no
#userlist_file=/etc/vsftpd.user_list
listen=yes
#
# run standalone with ipv6?
# like the listen parameter, except vsftpd will listen on an ipv6 socket
# instead of an ipv4 one. this parameter and the listen parameter are mutually
# exclusive.
#listen_ipv6=yes
#
# allow anonymous ftp? (disabled by default)
anonymous_enable=no
#
# uncomment this to allow local users to log in.
local_enable=yes
#
# uncomment this to enable any form of ftp write command.
write_enable=yes
#
# default umask for local users is 077. you may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# uncomment this to allow the anonymous ftp user to upload files. this only
# has an effect if the above global write enable is activated. also, you will
# obviously need to create a directory writable by the ftp user.
#anon_upload_enable=yes
#
# uncomment this if you want the anonymous ftp user to be able to create
# new directories.
#anon_mkdir_write_enable=yes
#
# activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=yes
#
# if enabled, vsftpd will display directory listings with the time
# in your local time zone. the default is to display gmt. the
# times returned by the mdtm ftp command are also affected by this
# option.
use_localtime=yes
#
# activate logging of uploads/downloads.
xferlog_enable=yes
#
# make sure port transfer connections originate from port 20 (ftp-data).
connect_from_port_20=yes
#
# if you want, you can arrange for uploaded anonymous files to be owned by
# a different user. note! using "root" for uploaded files is not
# recommended!
#chown_uploads=yes
#chown_username=whoever
#
# you may override where the log file goes if you like. the default is shown
# below.
xferlog_file=/var/log/vsftpd.log
#
# if you want, you can have your log file in standard ftpd xferlog format.
# note that the default log file location is /var/log/xferlog in this case.
xferlog_std_format=yes
#
# you may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# you may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# it is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# enable this and the server will recognise asynchronous abor requests. not
# recommended for security (the code is non-trivial). not enabling it,
# however, may confuse older ftp clients.
#async_abor_enable=yes
#
# by default the server will pretend to allow ascii mode but in fact ignore
# the request. turn on the below options to have the server actually do ascii
# mangling on files when in ascii mode.
# beware that on some ftp servers, ascii support allows a denial of service
# attack (dos) via the command "size /big/file" in ascii mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ascii mangling is a horrible feature of the protocol.
#ascii_upload_enable=yes
#ascii_download_enable=yes
#
# you may fully customise the login banner string:
ftpd_banner=welcome to blah ftp service.
#
# you may specify a file of disallowed anonymous e-mail addresses. apparently
# useful for combatting certain dos attacks.
#deny_email_enable=yes
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# you may restrict local users to their home directories. see the faq for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
#chroot_local_user=yes
#
# you may specify an explicit list of local users to chroot() to their home
# directory. if chroot_local_user is yes, then this list becomes a list of
# users to not chroot().
# (warning! chroot'ing can be very dangerous. if using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
chroot_local_user=yes
chroot_list_enable=yes
# (default follows)
chroot_list_file=/etc/vsftpd.chroot_list
#
# you may activate the "-r" option to the builtin ls. this is disabled by
# default to avoid remote users being able to cause excessive i/o on large
# sites. however, some broken ftp clients such as "ncftp" and "mirror" assume
# the presence of the "-r" option, so there is a strong case for enabling it.
#ls_recurse_enable=yes
#
# customization
#
# some of vsftpd's settings don't fit the filesystem layout by
# default.
#
# this option should be the name of a directory which is empty. also, the
# directory should not be writable by the ftp user. this directory is used
# as a secure chroot() jail at times vsftpd does not require filesystem
# access.
secure_chroot_dir=/var/run/vsftpd/empty
#
# this string is the name of the pam service vsftpd will use.
pam_service_name=vsftpd
#
# this option specifies the location of the rsa certificate to use for ssl
# encrypted connections.
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
# this option specifies the location of the rsa key to use for ssl
# encrypted connections.
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key

以上就是“Ubuntu如何搭建php5.6Web服务器环境”这篇文章的所有内容,感谢各位的阅读!相信大家阅读完这篇文章都有很大的收获,小编每天都会为大家更新不同的知识,如果还想学习更多的知识,请关注亿速云行业资讯频道。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI