这篇文章将为大家详细讲解有关Ubuntu16.04怎么搭建php5.6Web服务器环境,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
Ubuntu 16.04默认安装php7.0环境,但是php7目前对某些旧系统的兼容性并不是很好,如果自行安装php5需要清除php7的已安装包,否则会报错。
移除默认及已安装的PHP包
sudodpkg-l|grepphp|awk'{print$2}'|tr"\n""" sudoapt-getinstallaptitude sudoaptitudepurge`dpkg-l|grepphp|awk'{print$2}'|tr"\n"""`
添加 PPA
sudoadd-apt-repositoryppa:ondrej/php
安装php5.6
sudoapt-getupdate sudoapt-getinstallphp5.6
安装扩展
sudoapt-getinstallphp5.6-gd sudoapt-getinstallphp5.6-mysql
安装Apache2
sudoaptinstallapache2 sudoapt-getinstalllibapache2-mod-php5.6
安装MySQL
sudoaptinstallmysql-serverphp5.6-mysqlrootroot0x0 sudoapt-getinstallmysql-client mysql_secure_installation
安装 phpmyadmin
sudoapt-getinstallphpmyadmin sudoapt-getinstallphp5.6-mbstring sudoapt-getinstallphp5.6-gettext sudoln-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) sudodpkg-reconfigurephpmyadmin(重新配置phpmyadmin)
增加网站
sudoln-s/etc/apache2/sites-available/files.conf/etc/apache2/sites-enabled/files.conf sudochown-Rwww-data/var/www/tianya sudo/etc/init.d/apache2restart
添加FTP
sudoaptinstallvsftpd useradd-d/var/www/tianya-s/sbin/nologinmyftp passwdmyftp chmod777-R/var/www/tianya usermod-s/sbin/nologinmyftp vim/etc/vsftpd.conf vim/etc/vsftpd.chroot_list servicevsftpdrestart servicevsftpdstatus #Exampleconfigfile/etc/vsftpd.conf # #Thedefaultcompiledinsettingsarefairlyparanoid.Thissamplefile #loosensthingsupabit,tomaketheftpdaemonmoreusable. #Pleaseseevsftpd.conf.5forallcompiledindefaults. # #READTHIS:ThisexamplefileisNOTanexhaustivelistofvsftpdoptions. #Pleasereadthevsftpd.conf.5manualpagetogetafullideaofvsftpd's #capabilities. # # #Runstandalone?vsftpdcanruneitherfromaninetdorasastandalone #daemonstartedfromaninitscript. #userlist_enable=YES #userlist_deny=NO #userlist_file=/etc/vsftpd.user_list listen=YES # #RunstandalonewithIPv6? #Likethelistenparameter,exceptvsftpdwilllistenonanIPv6socket #insteadofanIPv4one.Thisparameterandthelistenparameteraremutually #exclusive. #listen_ipv6=YES # #AllowanonymousFTP?(Disabledbydefault) anonymous_enable=NO # #Uncommentthistoallowlocaluserstologin. local_enable=YES # #UncommentthistoenableanyformofFTPwritecommand. write_enable=YES # #Defaultumaskforlocalusersis077.Youmaywishtochangethisto022, #ifyourusersexpectthat(022isusedbymostotherftpd's) local_umask=022 # #UncommentthistoallowtheanonymousFTPusertouploadfiles.Thisonly #hasaneffectiftheaboveglobalwriteenableisactivated.Also,youwill #obviouslyneedtocreateadirectorywritablebytheFTPuser. #anon_upload_enable=YES # #UncommentthisifyouwanttheanonymousFTPusertobeabletocreate #newdirectories. #anon_mkdir_write_enable=YES # #Activatedirectorymessages-messagesgiventoremoteuserswhenthey #gointoacertaindirectory. dirmessage_enable=YES # #Ifenabled,vsftpdwilldisplaydirectorylistingswiththetime #inyourlocaltimezone.ThedefaultistodisplayGMT.The #timesreturnedbytheMDTMFTPcommandarealsoaffectedbythis #option. use_localtime=YES # #Activateloggingofuploads/downloads. xferlog_enable=YES # #MakesurePORTtransferconnectionsoriginatefromport20(ftp-data). connect_from_port_20=YES # #Ifyouwant,youcanarrangeforuploadedanonymousfilestobeownedby #adifferentuser.Note!Using"root"foruploadedfilesisnot #recommended! #chown_uploads=YES #chown_username=whoever # #Youmayoverridewherethelogfilegoesifyoulike.Thedefaultisshown #below. xferlog_file=/var/log/vsftpd.log # #Ifyouwant,youcanhaveyourlogfileinstandardftpdxferlogformat. #Notethatthedefaultlogfilelocationis/var/log/xferloginthiscase. xferlog_std_format=YES # #Youmaychangethedefaultvaluefortimingoutanidlesession. #idle_session_timeout=600 # #Youmaychangethedefaultvaluefortimingoutadataconnection. #data_connection_timeout=120 # #Itisrecommendedthatyoudefineonyoursystemauniqueuserwhichthe #ftpservercanuseasatotallyisolatedandunprivilegeduser. #nopriv_user=ftpsecure # #EnablethisandtheserverwillrecogniseasynchronousABORrequests.Not #recommendedforsecurity(thecodeisnon-trivial).Notenablingit, #however,mayconfuseolderFTPclients. #async_abor_enable=YES # #BydefaulttheserverwillpretendtoallowASCIImodebutinfactignore #therequest.TurnonthebelowoptionstohavetheserveractuallydoASCII #manglingonfileswheninASCIImode. #BewarethatonsomeFTPservers,ASCIIsupportallowsadenialofservice #attack(DoS)viathecommand"SIZE/big/file"inASCIImode.vsftpd #predictedthisattackandhasalwaysbeensafe,reportingthesizeofthe #rawfile. #ASCIImanglingisahorriblefeatureoftheprotocol. #ascii_upload_enable=YES #ascii_download_enable=YES # #Youmayfullycustomisetheloginbannerstring: ftpd_banner=WelcometoblahFTPservice. # #Youmayspecifyafileofdisallowedanonymouse-mailaddresses.Apparently #usefulforcombattingcertainDoSattacks. #deny_email_enable=YES #(defaultfollows) #banned_email_file=/etc/vsftpd.banned_emails # #Youmayrestrictlocaluserstotheirhomedirectories.SeetheFAQfor #thepossiblerisksinthisbeforeusingchroot_local_useror #chroot_list_enablebelow. #chroot_local_user=YES # #Youmayspecifyanexplicitlistoflocaluserstochroot()totheirhome #directory.Ifchroot_local_userisYES,thenthislistbecomesalistof #userstoNOTchroot(). #(Warning!chroot'ingcanbeverydangerous.Ifusingchroot,makesurethat #theuserdoesnothavewriteaccesstothetopleveldirectorywithinthe #chroot) chroot_local_user=YES chroot_list_enable=YES #(defaultfollows) chroot_list_file=/etc/vsftpd.chroot_list # #Youmayactivatethe"-R"optiontothebuiltinls.Thisisdisabledby #defaulttoavoidremoteusersbeingabletocauseexcessiveI/Oonlarge #sites.However,somebrokenFTPclientssuchas"ncftp"and"mirror"assume #thepresenceofthe"-R"option,sothereisastrongcaseforenablingit. #ls_recurse_enable=YES # #Customization # #Someofvsftpd'ssettingsdon'tfitthefilesystemlayoutby #default. # #Thisoptionshouldbethenameofadirectorywhichisempty.Also,the #directoryshouldnotbewritablebytheftpuser.Thisdirectoryisused #asasecurechroot()jailattimesvsftpddoesnotrequirefilesystem #access. secure_chroot_dir=/var/run/vsftpd/empty # #ThisstringisthenameofthePAMservicevsftpdwilluse. pam_service_name=vsftpd # #ThisoptionspecifiesthelocationoftheRSAcertificatetouseforSSL #encryptedconnections. rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem #ThisoptionspecifiesthelocationoftheRSAkeytouseforSSL #encryptedconnections. rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
关于“Ubuntu16.04怎么搭建php5.6Web服务器环境”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。
海报
0 条评论
192
相关文章
本站已关闭游客评论,请登录或者注册后再评论吧~