本文目錄一覽:
phpstudy的apache無法啟動
相信很多小夥伴剛開始使用phpstudy的時候都遇到過這個問題,apache剛打開不一會又自動關了,這個問題當初也困擾了我許久,下面是解決辦法,針對不同情況。
一是有可能防火牆去攔截;二是端口可能被別的程序佔用,在設置中更改端口即可;三是沒有安裝VC9運行庫,php和apache都是VC9編譯。
如果是在正常啟動之前就配置了站點的話,apache可能因為無法識別站點中的目錄從而造成這種情況,解決方法是刪掉這個站點再重新啟動一次就可。
按鍵盤上的Win+R,輸入cmd打開,打開Apache目錄的bin文件,複製路徑,然後在cmd中cd到這個路徑。
輸入命令:httpd.exe -t
如果出現這個錯誤,顯示在line 512,打開httpd.conf這個文件
從512行開始,刪掉/IfModule只剩下一個就行,然後重啟phpstudy;
如果報錯顯示另一個文件
和原來一樣,找到並打開這個文件,vhosts.conf,查看67行
發現DocumentRoot 和 Directory 的路徑後面多了一個」\」,就因為這個反斜杠導致了apache 無法正常啟動,修改以後啟動apache,就不會在停止了。
PHP版本VC6和VC9,Non Thread Safe和Thread Safe的區別
vc就是常說的microsoft visual c++ redistributable package,vc6和9代表的不同版本,6應該是vc++6.0,9是vc++2008,10是vc++2010,11是vc++2012,如果用相應的版本的visual studio編譯的,同時還需要運行庫的支持,不然就會報常見的缺少vcr***.dll錯誤,也就是說vc6版本需要安裝visual c++ 6.0 運行庫,vc9需要安裝microsoft visual c++ 2008 redistributable package,現在主流是vc9以上了。至於線程安全,官網是這樣說的
Which version do I choose?
IIS
If you are using PHP as FastCGI with IIS you should use the Non-Thread Safe (NTS) versions of PHP.
Apache
Please use the Apache builds provided byApache Lounge. They also provide VC11 builds of Apache for x86 and x64. We use their binaries to build the Apache SAPIs.
If you are using PHP with Apache 1 or Apache2 from apache.org (not recommended) you need to use the older VC6 versions of PHP compiled with the legacy Visual Studio 6 compiler. Do NOTuse VC9+ versions of PHP with the apache.org binaries.
With Apache you have to use the Thread Safe (TS) versions of PHP.
VC9 and VC11
More recent versions of PHP are built with VC9 or VC11 (Visual Studio 2008 and 2012 compiler respectively) and include improvements in performance and stability.
The VC9 builds require you to have theVisual C++ Redistributable for Visual Studio 2008 SP1 x86 or x64 installed.
The VC11 builds require to have the Visual C++ Redistributable for Visual Studio 2012×86 or x64 installed.
TS and NTS
TS refers to multithread capable builds.NTS refers to single thread only builds. Use case for TS binaries involves interaction with a multithreaded SAPI and PHP loaded as a module into a web server. For NTSbinaries the widespread use case is interaction with a web server through the FastCGI protocol, utilizing no multithreading (but also for example CLI).
Apache+PHP的VC9版本會出現問題嗎
這個主要是要看Apache的編譯版本是否和PHP的匹配
按照PHP官方提供的資源來看,PHP 5.5以後的版本官方只提供了VC11版本的產品程序,PHP5.3/5.4版還有VC9版本的產品程序。
而Apache官方提供的Apache HTTP Server程序,都是VC6版本的,所以說,這意味着,其實Apache本身提供的程序,跟PHP 5.X版本是不兼容的。
而現在Windows平台的Apache HTTP Server都是第三方根據Apache釋出的源代碼,使用對應版本的VC編譯器編譯出來的
也就是說,只要保證你的Apache和PHP是同一個版本的VC編譯出來的,就可以較穩定的運行了
不過要注意的是,如果Apache、PHP版本較高,最好使用高版本的VC編譯出的產品,因為部分特性需要高版本的編譯器支持。
而如果你的系統版本較老,則需要低版本的VC編譯出的產品,因為很多老版本的系統不支持。
原創文章,作者:SRNQ,如若轉載,請註明出處:https://www.506064.com/zh-hk/n/142140.html