Ubuntu14下LAMP环境的安装以及yaf扩展的安装
前段时间在ubuntu下安装了lamp环境,记录一下安装过程方便以后查阅。
安装lamp环境
① 安装apache
<span style="color: #0000ff;">sudo</span> apt-get <span style="color: #0000ff;">install</span> apache2
系统会弹出如图所示的提示,此时需要输入用户的密码才可以安装,下面其他安装操作都需要输入密码,每次都一样。
此时打开浏览器 输入localhost,显示如下界面表示安装成功。
② 安装php
<span style="color: #0000ff;">sudo</span> apt-get <span style="color: #0000ff;">install</span> php5
③ 安装mysql
<span style="color: #0000ff;">sudo</span> apt-get <span style="color: #0000ff;">install</span> mysql-server
此时lamp环境安装完成。检验是否正确.
Apache安装完成后,根目录在 /var/www/html
cd /var/www/<span style="color: #000000;">html</span><span style="color: #0000ff;">sudo</span> <span style="color: #0000ff;">vi</span> phpinfo.php
输入
<span style="color: #000000;">php </span><span style="color: #008080;">phpinfo</span><span style="color: #000000;">();</span>?>
然后打开浏览器输入localhost/phpinfo.php,出现如下页面表示安装成功。
安装php的开发包
只有安装了开发包才可以安装扩展
<span style="color: #0000ff;">sudo</span> apt-get <span style="color: #0000ff;">install</span> php5-dev
安装php的扩展
a) 安装php-mysql
此安装为系统库自带的,直接安装即可。
<span style="color: #0000ff;">sudo</span> apt-get <span style="color: #0000ff;">install</span> php5-mysql
重启apache加载mysql的支持
<span style="color: #0000ff;">sudo</span> service apache2 restart
b) 安装yaf
安装yaf之前需要先装pcre库,否则安装yaf会报错
<span style="color: #0000ff;">sudo</span> apt-get <span style="color: #0000ff;">install</span> libpcre3 libpcre3-dev
下载最新的yaf文件
cd /usr/local/src/<span style="color: #0000ff;">sudo</span> <span style="color: #0000ff;">wget</span> https:<span style="color: #008000;">//</span><span style="color: #008000;">github.com/laruence/php-yaf/archive/master.zip</span>
- 防止和后面下载的文件名称相同,所以改一下名字区分。
解压
<span style="color: #0000ff;">sudo</span> <span style="color: #0000ff;">unzip</span> yaf.<span style="color: #0000ff;">zip</span>
解压后如下图所示
cd php-yaf-<span style="color: #000000;">master</span><span style="color: #0000ff;">sudo</span> /usr/bin/phpize
配置
编译
编译安装
完成后生成了yaf.so文件在以下目录
修改php.ini的配置,加载yaf
<span style="color: #0000ff;">sudo</span> <span style="color: #0000ff;">vi</span> php.ini
扩展目录改成生存的so文件所在目录
新增
重启apache
<span style="color: #0000ff;">sudo</span> service apache2 restart
此时再刷新发现yaf已正确安装了
如果还需要其他扩展类似yaf的安装步骤。

TheSecretTokeEpingAphp-PowerEdwebSiterUnningSmoothlyShyunderHeavyLoadInVolvOLVOLVOLDEVERSALKEYSTRATICES:1)emplactopCodeCachingWithOpcachingWithOpCacheToreCescriptexecution Time,2)使用atabasequercachingCachingCachingWithRedataBasEndataBaseLeSendataBaseLoad,3)

你應該關心DependencyInjection(DI),因為它能讓你的代碼更清晰、更易維護。 1)DI通過解耦類,使其更模塊化,2)提高了測試的便捷性和代碼的靈活性,3)使用DI容器可以管理複雜的依賴關係,但要注意性能影響和循環依賴問題,4)最佳實踐是依賴於抽象接口,實現鬆散耦合。

是的,優化papplicationispossibleandessential.1)empartcachingingcachingusedapcutorediucedsatabaseload.2)優化的atabaseswithexing,高效Quereteries,and ConconnectionPooling.3)EnhanceCodeWithBuilt-unctions,避免使用,避免使用ingglobalalairaiables,並避免使用

theKeyStrategiestosigantificallyBoostPhpaPplicationPerformenCeare:1)UseOpCodeCachingLikeLikeLikeLikeLikeCacheToreDuceExecutiontime,2)優化AtabaseInteractionswithPreparedStateTementStatementStatementAndProperIndexing,3)配置

aphpdepentioncontiveContainerIsatoolThatManagesClassDeptions,增強codemodocultion,可驗證性和Maintainability.itactsasaceCentralHubForeatingingIndections,因此reducingTightCightTightCoupOulplingIndeSingantInting。

選擇DependencyInjection(DI)用於大型應用,ServiceLocator適合小型項目或原型。 1)DI通過構造函數注入依賴,提高代碼的測試性和模塊化。 2)ServiceLocator通過中心註冊獲取服務,方便但可能導致代碼耦合度增加。

phpapplicationscanbeoptimizedForsPeedAndeffificeby:1)啟用cacheInphp.ini,2)使用preparedStatatementSwithPdoforDatabasequesies,3)3)替換loopswitharray_filtaray_filteraray_maparray_mapfordataprocrocessing,4)conformentnginxasaseproxy,5)

phpemailvalidation invoLvesthreesteps:1)格式化進行regulareXpressecthemailFormat; 2)dnsvalidationtoshethedomainhasavalidmxrecord; 3)


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

Dreamweaver Mac版
視覺化網頁開發工具

SublimeText3 英文版
推薦:為Win版本,支援程式碼提示!

ZendStudio 13.5.1 Mac
強大的PHP整合開發環境

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具