您好,登錄后才能下訂單哦!
今天小編給大家分享一下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服務器環境”這篇文章的所有內容,感謝各位的閱讀!相信大家閱讀完這篇文章都有很大的收獲,小編每天都會為大家更新不同的知識,如果還想學習更多的知識,請關注億速云行業資訊頻道。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。