ubuntu16.04怎么搭建php5.6web服务器环境-亚博电竞手机版
linux
2021年02月23日 07:37
0
这篇文章将为大家详细讲解有关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服务器环境”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。
展开全文