導航:首頁 > 編程語言 > phpdebugbuild

phpdebugbuild

發布時間:2023-01-08 05:20:03

php.exe這個應用程序是干什麼用的,又要怎麼用.進來的路過的都請答一下.

PHP是一個腳本引擎

1. Unix/Windows: 我的php.ini 文件應該放在哪?
UNIX下默認它應該放在 /usr/local/lib 目錄下。 這是它的 /lib. 很多人會在編譯時改變它,使用--with-config-file-path 標志。 例如, 你可以這樣設它: --with-config-file-path=/etc

然後你可以復制源程序包里的 php.ini-dist 到 /etc/php.ini ,編輯它滿足你的本地化需求。
Windows下 php.ini默認的路徑是 Windows 系統目錄. 如果你在使用 Apache webserver, php.ini 則最先在 Apaches 安裝目錄下被查找, 例如: c:\program files\apache group\apache. 這樣你可以有不同的 php.ini 對應不同版本的 Apache(同一台機器上)。
更多細節請查閱 configuration file.
2. Unix: 我安裝了 PHP, 但我每次載入一個文檔, 會得到下面的消息: Document Contains No Data ! 怎麼回事?
這可能是因為你的 PHP 發生了core-mping錯誤。 查找你的伺服器錯誤日誌文件,看看是否屬於這種情況。 然後報告這個錯誤。如果你知道怎樣使用 gdb ,你可以提供一個 backtrace 在你的錯誤報告里。這將會對開發人員解決 這個問題有很大幫助。如果你是在將PHP作為Apache模塊使用,那麼請按下面的步驟做:

停止 httpd 進程

gdb httpd

停止 httpd 進程

> run -X -f /path/to/httpd.conf

瀏覽你剛才出錯的 URL

> run -X -f /path/to/httpd.conf

如果你還有 core mp, gdb 現在會通知你

打入: bt

在你的 bug report里應該包含backtrace 。 這些會被發往 http://bugs.php.net/

如果你的腳本使用了正則表達式函數 (ereg() and friends), 你應該確保你編譯 PHP 和 Apache 用的是同一個正則表達式包。 在 PHP 和 Apache 1.3.x 這個過程是自動進行的。
3. Unix: 我使用 RPMS 安裝 PHP , 但Apache 不支持 PHP頁面! 怎麼辦?
假設你安裝了 Apache 和 PHP(從 RPM ) , 你需要反注釋或者增加一些行在你的 http.conf 文件里: # Extra MolesAddMole mod_php.cAddMole mod_php3.cAddMole mod_perl.c# Extra MolesLoadMole php_mole moles/mod_php.soLoadMole php3_mole moles/libphp3.so /* for PHP 3 */LoadMole php4_mole moles/libphp4.so /* for PHP 4 */LoadMole perl_mole moles/libperl.so

And add: AddType application/x-httpd-php3 .php3 /* for PHP 3 */AddType application/x-httpd-php .php /* for PHP 4 */

... 到全局域里, 或者到你想要的 支持PHP的虛擬域里。
4. 我使用 RPMS 安裝 PHP 3 , 但是它沒有我需要的資料庫選項支持! 我該怎麼辦?
因為 PHP 3 內建支持的關系, 編譯一個完整的可適於所有應用的 PHP RPM是相當困難的。 在 PHP 4有談到這點。 對 PHP 3, 我們只好建議你使用INSTALL.REDHAT (在 PHP包里)描述的機制。 如果你一定要使用 RPM 版的 PHP 3, 讀...
RPM 包管理器設置 RPMS 簡單的安裝,不帶資料庫支持 and 因為RPMS 使用 /usr/ 而不是標準的 /usr/local/ 目錄存放文件. 你需要告訴 RPM 文件你要支持哪種資料庫以及它們的最上級目錄的位置。
下面的例子將解釋在Apache模式下怎樣支持通行的資料庫Mysql.
當然所有的這些可以稍作修改,以支持其它的PHP支持的資料庫。我們假設你安裝了 MySQL and Apache ,完全是用 RPMS 安裝的。

首先,移去 mod_php3 : rpm -e mod_php3

然後取得rpm包並安裝, 不是 --重編譯 rpm -Uvh mod_php3-3.0.5-2.src.rpm

編輯/usr/src/redhat/SPECS/mod_php3.spec 文件
在 %build 一節里增加你想要的資料庫支持, 以及路徑信息。
對 MySQL 你應該增加: --with-mysql=/usr \

%build 節看起來象: ./configure --prefix=/usr \ --with-apxs=/usr/sbin/apxs \ --with-config-file-path=/usr/lib \ --enable-debug=no \ --enable-safe-mode \ --with-exec-dir=/usr/bin \ --with-mysql=/usr \ --with-system-regex

改動完成後,象下面這樣重編rpm : rpm -bb /usr/src/redhat/SPECS/mod_php3.spec

Then install the rpm rpm -ivh /usr/src/redhat/RPMS/i386/mod_php3-3.0.5-2.i386.rpm

重啟 Apache,你已經得到了rpm下的Mysq

l的支持。 注意到這種做法比你重新得到一個 PHP 3 的tarball 代碼,按照 INSTALL.REDHAT 的指引一步一步做要容易得多。

5. Unix: 我用 FrontPage 擴展包對Apache打了補丁, 忽然 PHP 停止工作。 是PHP 和 Apache FrontPage 包不兼容嗎 ?
不是, PHP 和 FrontPage擴展包運行得很好.。問題是FrontPage 包修改了幾個Apache 結構參數,而PHP要用到它們.在FrontPage擴展包被打上後, 重新編譯 PHP (使用 make clean ; make ) ,會解決這個問題。
6. Unix/Windows: 我安裝了PHP,但在瀏覽器里看我的PHP頁面時,空白一片。
在瀏覽器里用 查看源文件 看你的腳本,你可能會發現你看到的是源程序。 這表示 web server 並沒有送腳本到PHP去執行。肯定是伺服器配置上哪兒出了錯。 仔細檢查PHP安裝的 server 配置。
7. Unix/Windows: 我安裝了PHP,但在瀏覽器里看我的 PHP頁面時,我得到一個 server 500 error。
這是伺服器在運行 PHP 時發生了錯誤。 為了看到可讀的錯誤信息,在命令行,改變目錄到 (php.exe Windows)所在目錄, 運行 php -i. 如果有任何問題,詳細的錯誤信息就顯示出來了,它會告訴你下一步該做什麼。 如果你得到滿屏的HTML代碼 (phpinfo() 函數的輸出), 那麼PHP工作正常,這個錯誤就是由於伺服器配置引發的,應該仔細檢查。
8. 某些操作系統: 我安裝PHP沒出錯,可是我啟動Apache時,得到一個 undefined symbol errors: [mybox:user /src/php4] root# apachectl configtest apachectl: /usr/local/apache/bin/httpd Undefined symbols: _compress _uncompress

這個問題其實與 PHP 無關, 而與 MySQL 客戶端庫有關。 --with-zlib,有些操作系統需要,而有些不需要。MySQL FAQ已經講述了這個問題。
9. Windows: 我安裝了PHP,但在瀏覽器里看我的PHP頁面, 得到如下錯誤: cgi error: The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:

這是 PHP 根本沒有產生任何輸出。 為了看到可讀的錯誤信息,在命令行,改變目錄到 (php.exe Windows)所在目錄, 運行 php -i. 如果有任何問題,詳細的錯誤信息就顯示出來了,它會告訴你下一步該做什麼。 如果你得到滿屏的HTML代碼 (phpinfo() 函數的輸出), 那麼PHP工作正常。
一旦PHP在命令行模式下工作,再看看你的腳本程序, 它還是失敗,可能是因為以下原因:

你的PHP腳本的許可權許可。 php.exe, php4ts.dll, php.ini 或者任何你可能裝入的PHP文件,它樣都必須能被匿名 internet 用戶 ISUR_ 訪問。

腳本文件根本不存在(或者不是你認為的位置。)請注意在IIS里,你能夠阻塞這個錯誤,做法是在設置腳本映射目錄時, 選上 check file exists 框。這樣如果腳本不存在,伺服器會返回一個404錯誤。 這樣做也有其它的一些好處, 就是IIS僅為你做經過授權的操作。

10. Windows: 我嚴格按照install的要求做,可是還是不能讓我的php在IIS下工作。
確定任何想要運行PHP的用戶有操作php.exe的許可權! IIS 使用匿名的internet用戶,它是在IIS安裝時系統自動增加的。 這個用戶需要操作 php.exe的許可權. 還有,任何需要授權的用戶也必須有訪問 php.exe的許可權。 在 IIS4下,你要告訴它PHP是一個腳本引擎

Ⅱ 如何使用 Xdebug + Sublime Text 3 調試 PHP 代碼

Sublime是一款非常不錯的IDE工具,php開發中通常也用到。如此好用的工具如何調試呢,那就用到了xDebug。下面演示如何給Sublimetext2配置xdebug。 工具/原料 sublimetext2; apache伺服器,或其他web伺服器; 電腦。 方法/步驟 准備工作:開啟phpxdebug擴展。 下載擴展:php_xdebug-2.1.0-5.3-vc6.dll; 網路網盤下載地址: 下載好放在php下的擴展(ext)文件夾下: 如何給Sublimetext配置XDebug 設置php.ini配置文件: [XDebug]extension="php_xdebug-2.1.0-5.3-vc6.dll"xdebug.remote_enable=onxdebug.remote_handler="dbgp"xdebug.remote_host="127.0.0.1"xdebug.remote_port=9000 如何給Sublimetext配置XDebug 重啟apache,然後運行phpinfo();檢查xdebug是否安裝成功: 如何給Sublimetext配置XDebug 然後打開sublimetext軟體; 如何給Sublimetext配置XDebug 點擊菜單欄:View-》ShowConsole或者ctrl+~快捷鍵,調出控制台; 如何給Sublimetext配置XDebug 在命令欄輸入: importurllib2,os;pf='PackageControl.sublime-package'ipp=sublime.installed_packages_path();os.makedirs(ipp)ifnotos.path.exists(ipp)elseNone;urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler()));open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace('','%20')).read());print('') 然後回車;

Ⅲ php中文件夾建立問題及Eclipse文件夾

下面是我收藏的Eclipse + WTK 的J2ME開發環境的配置(建議不用使用MyEclipse):====================================== 下載最新版的必備軟體,1 eclipse 3.2.2 到下面這個地址去找找2 eclipseme 1.6.7 3 wtk2.5 (Sun java Wireless Toolkit 2.5 for CLDC) sun公司提供的無線開發工具包安裝配置步驟1.安轉Eclipse3.2.2(必須先安裝好jdk1.5或以上版本,這里不說明了)2.安裝EclipseMe1.6.73.安裝WTK2.54.測試HelloWorld5.使用Nokia模擬器測試配置具體步驟(必要的)1.1 安轉Eclipse3.2.2 把下載到的zip文件解壓後直接放到c盤根目錄即可,當然,你可以放到你喜歡的任何地方,這里為了描述方便放到c:\eclipse1.2 運行eclipse,如果能正常啟動,說明jdk安裝正確,否則,你可能需要一個新版本的jdk,到sun的網站去下。1.3 把eclipse1.6.7 解壓到一個臨時目錄中,把目錄和文件 plugins features site.xml 全部到eclipse的目錄中即可1.4 啟動eclipse3.2.2 從菜單 windows->references...進入 在references面板的左邊的樹狀目錄中,應該多了一個J2ME項。1.5 繼續安裝WTK2.5 ,把主目錄安裝到C:\WTK25下,其他的按默認安裝就行,windows->references->J2ME的WTK ROOT要選擇好好,軟體都安裝好了,下面是最重要的配置部分1.6 修改Eclipse的配置,使其邦定EclipseME框架 1.6.1 在eclipse的配置目錄configuration中找到配置文件config.ini 1.6.2 用文本編輯器打開,增加一個屬性定義 osgi.framework.extensions=eclipseme.core.hooks 如果該屬性已經存在,則把值eclipseme.core.hooks加上 注意:這一行必須加在config.ini的eof=eof前面,不能加到後面。否則,可能會導致Eclipse啟動失敗。 1.6.3 保存config.ini 1.6.4 重新啟動 eclipse1.7 修改eclipse的build path 和debug選項 1.7.1 把源代碼和輸出分離開 1.7.1.1 從菜單 windows->references...進入 1.7.1.2 展開references面板的java項,然後點選 build path 1.7.1.3 默認情況下 "source and outpub folder"項的 "project"為選中,我們修改這個默認設置,把"folders"選中 這樣,就可以讓eclipse把源代碼和輸出分離開。 1.7.2 修改調試選項的異常掛起設置和超時時間(很重要) 1.7.2.1 從菜單 windows->references...進入 1.7.2.2 展開references面板的java項,然後點選 debug 1.7.2.3 在Suspend Execution項中,把 "Suspend execution on uncaught exceptions" "Suspend execution on compilation errors" 這兩項的勾去掉 1.7.2.4 在面板的最下面,把 debugger timeout(ms)設置為 15000(這個參數太重要了,一定要記得改)1.8 為eclipseme配置模擬器 1.8.1

Ⅳ discuz郵件設置

說明:Discuz! 的郵件功能,對於站長來說是相當重要的,如果用戶忘記密碼,可以通過郵件直接取回,比較方便下面為大家仔細講解如果設置郵件功能。

一、Discuz! 支持如下三種郵件發送方式:
1、通過 PHP 函數的 sendmail 發送(推薦此方式)
說明:
這種方式是使用 PHP 的函數發送郵件,需要伺服器上安裝郵件系統。一般的虛擬主機都內置郵件系統。因此推薦使用這種方式。
2、通過 SOCKET 連接 SMTP 伺服器發送(支持 ESMTP 驗證)
說明:
這種方式適用於 win 或者 linux 類伺服器使用(適合於虛擬主機或者獨立主機使用),並且支持 ESMTP 驗證。需要站長擁有一個 SMTP 伺服器,例如 Foxmail 的 SMTP 伺服器。
3、通過 PHP 函數 SMTP 發送 Email(僅 Windows 主機下有效, 不支持 ESMTP 驗證)
說明:這種方式僅僅適合於 win 主機。對系統環境要求較高,不推薦使用。
用戶可以根據自己的情況來選擇使用哪一種方式

二、郵件頭的分隔符分為三種
1、使用 CRLF 作為分隔符(通常為 Windows 主機)
2、使用 LF 作為分隔符(通常為 Unix/Linux 主機)
3、使用 CR 作為分隔符(通常為 Mac 主機)
說明:這里根據您使用的郵件伺服器系統選擇郵件頭的分隔符。

三、下面我們以第二種郵件發送方式為例詳細介紹一下設置郵件功能的整個過程:
1、首先我們需要注冊一個郵箱,如 Foxmail的郵箱,郵箱名為:hellensu @foxmail.com
2、站點創始人登錄 Discuz! 的後台 => 站長 => 郵件設置,選擇「通過 SOCKET 連接 SMTP 伺服器發送(支持 ESMTP 驗證)」如下圖所示:

點擊「添加新SMTP伺服器」然後填寫SMTP伺服器、SMTP埠、是否驗證、發件人郵件地址、SMTP身份驗證用戶名和SMTP 身份驗證密碼信息,這里可以增加多個SMTP伺服器。

SMTP 伺服器:填寫 SMTP 伺服器 地址,如:smtp.foxmail.com
SMTP 埠:默認一般為 25。可以根據自己所用 SMTP 埠的不同進行填寫。
說明:驗證這里建議大家選擇「是」。
發信人郵件地址:填寫發件人的郵件地址。
SMTP 身份驗證用戶名:填寫的郵件地址同上。
SMTP 身份驗證密碼:填寫郵箱的密碼。
3、郵件頭的分隔符選擇使用 LF 作為分隔符。
收件人地址中包含用戶名:選擇「是」將在收件人的郵件地址中包含站點用戶名。
屏蔽郵件發送中的全部錯誤提示:選擇「是」將屏蔽郵件發送中的全部錯誤提示。

四、檢測
要想知道設置的郵件功能會員是否能正常收到郵件,我們需要測試一下

3.gif (12.18 KB, 下載次數: 64)
下載附件 保存到相冊
2012-3-27 13:59 上傳

填寫好發件人和收件人郵箱後,點擊「檢測郵件發送設置」如果郵件設置成功會提示如下圖所示:

Ⅳ 愛六源碼網正式升級X3.0請各位測試有什麼問請反饋

你是好呀PHP DebugNo. File Line Code 1 admin.php 57 require(%s) 2 source/admincp/admincp_tools.php 36 updatecache() 3 source/function/function_cache.php 26 build_cache_usergroups() 4 source/function/cache/cache_usergroups.php 17 discuz_container->fetch_all_fields(%s, Array) 5 discuz_container->__call(%s, Array) 6 source/class/discuz/discuz_container.php 60 table_common_usergroup_field->fetch_all_fields(%s, Array) 7 source/class/table/table_common_usergroup_field.php 36 discuz_database::fetch_all(%s, Array, %s) 8 source/class/discuz/discuz_database.php 100 discuz_database::query(%s, Array, false, false) 9 source/class/discuz/discuz_database.php 136 db_driver_mysql->query(%s, false, false) 10 source/class/db/db_driver_mysql.php 151 db_driver_mysql->halt(%s, %d, %s) 11 source/class/db/db_driver_mysql.php 218 break()

Ⅵ 阿里雲上的centos 7.2怎麼yum安裝php 5.6

因之前通過網易的 centos 鏡像,將阿里雲的 centos 升級到最新版了,乘自己的項目尚未開始正式開發,遂將所有的相應環境都升級到最高。
查看 centos 版本:
[root@iZ23d ~]# cat /etc/centos-release
CentOS Linux release 7.2.1511 (Core)
1、刪除之前的 php 版本:
[root@iZ23d ~]# yum remove php* php-common
Loaded plugins: langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
No Match for argument: php-5.4.16
No Match for argument: php-5.4.16.tar.gz
No Match for argument: php-7.0.1RC1
No Match for argument: php-7.0.1RC1.tar.gz
No Match for argument: phpMyAdmin-4.4.0.tar.gz
No Match for argument: php-common
No Packages marked for removal
2、rpm 安裝 Php7 相應的 yum源:
[root@iZ23d ~]# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
Retrieving https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
warning: /var/tmp/rpm-tmp.LhJKKR: Header V4 RSA/SHA1 Signature, key ID 62e74ca5: NOKEY
Preparing... ################################# [100%]
package webtatic-release-7-3.noarch is already installed
3、 直接yum安裝php7:
[root@iZ23d ~]# yum install php70w
Loaded plugins: langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Resolving Dependencies
--> Running transaction check
。。。 【省略】
Warning: RPMDB altered outside of yum.
Installing : php70w-common-7.0.0-1.w7.x86_64 1/3
Installing : php70w-cli-7.0.0-1.w7.x86_64 2/3
Installing : php70w-7.0.0-1.w7.x86_64 3/3
Verifying : php70w-7.0.0-1.w7.x86_64 1/3
Verifying : php70w-common-7.0.0-1.w7.x86_64 2/3
Verifying : php70w-cli-7.0.0-1.w7.x86_64 3/3
Installed:
php70w.x86_64 0:7.0.0-1.w7
Dependency Installed:
php70w-cli.x86_64 0:7.0.0-1.w7 php70w-common.x86_64 0:7.0.0-1.w7
Complete!
4、檢查 php 版本:
[root@iZ23d ~]# php -v
PHP 7.0.0 (cli) (built: Dec 2 2015 20:42:32) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
[root@iZ23d2e6hoqZ ~]#
以上顯示安裝成功!
5、重啟 Apache,查看 phpinfo :
[root@iZ23d ~]# systemctl restart httpd.service
檢查phpinfo:
PHP Version 7.0.0
SystemLinux iZ23d 3.10.0-229.11.1.el7.x86_64 #1 SMP Thu Aug 6 01:06:18 UTC 2015 x86_64
Build DateDec 2 2015 20:43:38
Server APIApache 2.0 Handler
Virtual Directory Supportdisabled
Configuration File (php.ini) Path/etc
Loaded Configuration File/etc/php.ini
Scan this dir for additional .ini files/etc/php.d
Additional .ini files parsed/etc/php.d/bz2.ini, /etc/php.d/calendar.ini, /etc/php.d/ctype.ini, /etc/php.d/curl.ini, /etc/php.d/exif.ini, /etc/php.d/fileinfo.ini, /etc/php.d/ftp.ini, /etc/php.d/gettext.ini, /etc/php.d/gmp.ini, /etc/php.d/iconv.ini, /etc/php.d/json.ini, /etc/php.d/phar.ini, /etc/php.d/shmop.ini, /etc/php.d/simplexml.ini, /etc/php.d/sockets.ini, /etc/php.d/tokenizer.ini, /etc/php.d/xml.ini, /etc/php.d/zip.ini
PHP API20151012
PHP Extension20151012
Zend Extension320151012
Zend Extension BuildAPI320151012,NTS
PHP Extension BuildAPI20151012,NTS
Debug Buildno
Thread Safetydisabled
Zend Signal Handlingdisabled
Zend Memory Managerenabled
Zend Multibyte Supportdisabled
IPv6 Supportenabled
DTrace Supportenabled
Registered PHP Streamshttps, ftps, compress.zlib, php, file, glob, data, http, ftp, compress.bzip2, phar, zip
Registered Stream Socket Transportstcp, udp, unix, udg, ssl, sslv3, sslv2, tls, tlsv1.0, tlsv1.1, tlsv1.2
Registered Stream Filterszlib.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, bzip2.*, convert.iconv.*
This program makes use of the Zend Scripting Language Engine:
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
Configuration
apache2handler
Apache VersionApache/2.4.6 (CentOS)
Apache API Version20120211
Server [email protected]
Hostname:Portxxxx.xxxxx.xxx:0
User/Groupapache(48)/48
Max RequestsPer Child: 0 - Keep Alive: on - Max Per Connection: 100
TimeoutsConnection: 60 - Keep-Alive: 15
Virtual ServerYes
Server Root/etc/httpd
Loaded Molescore mod_so http_core mod_access_compat mod_actions mod_alias mod_allowmethods mod_auth_basic mod_auth_digest mod_authn_anon mod_authn_core mod_authn_dbd mod_authn_dbm mod_authn_file mod_authn_socache mod_authz_core mod_authz_dbd mod_authz_dbm mod_authz_groupfile mod_authz_host mod_authz_owner mod_authz_user mod_autoindex mod_cache mod_cache_disk mod_data mod_dbd mod_deflate mod_dir mod_mpio mod_echo mod_env mod_expires mod_ext_filter mod_filter mod_headers mod_include mod_info mod_log_config mod_logio mod_mime_magic mod_mime mod_negotiation mod_remoteip mod_reqtimeout mod_rewrite mod_setenvif mod_slotmem_plain mod_slotmem_shm mod_socache_dbm mod_socache_memcache mod_socache_shmcb mod_status mod_substitute mod_suexec mod_unique_id mod_unixd mod_userdir mod_version mod_vhost_alias mod_dav mod_dav_fs mod_dav_lock mod_lua prefork mod_proxy mod_lbmethod_bybusyness mod_lbmethod_byrequests mod_lbmethod_bytraffic mod_lbmethod_heartbeat mod_proxy_ajp mod_proxy_balancer mod_proxy_connect mod_proxy_express mod_proxy_fcgi mod_proxy_fdpass mod_proxy_ftp mod_proxy_http mod_proxy_scgi mod_proxy_wstunnel mod_ssl mod_systemd mod_cgi mod_perl mod_php7
以上顯示 php7 安裝成功!

Ⅶ thinkphp 3.2 去除調試模式後報錯,怎麼解決

1. ..案例一:

最近用ThinkPHP開發一個項目,本地開發測試完成上傳到伺服器後,第一次打開正常,再刷新頁面時就出現 「頁面調試錯誤,無法找開頁面,請重試」的錯誤.

我就郁悶啦,明明本地設置define('APP_DEBUG', false) 運行沒點問題,怎麼放到伺服器上就出錯了昵?

,Google還是沒有找到解決方案,突然發現項目APP_Name/Runtime/Cache目錄和APP_Name/Runtime/Logs目錄沒有可寫許可權,果斷更改,F5,唉好啦,媽媽再也不用擔心出現錯誤信息啦!

2.案例二:

ThinkPHP 將 APP_DEBUG 常量設置為 false 後出現了類似下面的問題:

復制代碼 代碼如下:
Parse error: syntax error, unexpected T_STRING in E:\PHPnow\htdocs\ojbak\Runtime\~app.php on line 1

或者直接報」伺服器錯誤」, 怎麼辦?
這個和 PHP 有關系,在 php.ini 里修改配置

復制代碼 代碼如下:
short_open_tag = On

因為 app.class.php 裡面的 build 方法:
當開啟了調試模式後,會獲取相關文件的內容 然後重新組合成文件 這個時候是會自動加上 的
也就是你看到的 ~app.php 文件了
但是當你不開啟調試模式後,會每次都會載入相關的文件,這樣子,你的錯誤就暴露出來了。

3.案例三:

在thinkphp中將APP_DEBUG設置為false之後,數據查詢(select, find等等)總是顯示第一條。。但是把APP_DEBUG設置為true之後,就正常了。。這是為什麼?有什麼解決方案嗎?

正常來說,APP_DEBUG是調試模式,放到線上環境,盡量要設置為false的。。

自己找一個select查詢,在關閉debug的情況下,用寫文件的方式調試下查詢後生成的sql。

Ⅷ 如何安裝SQL Server+IIS與PHP調試

新增一台win2003 server系統的伺服器。以前其他的伺服器上使用php5.0/5.1,資料庫是SQL Server 2000;本次則打算安裝SQL Server 2005,php5.3.2;據了解,php5.3版本使用微軟的FastCGI模式,這種模式和傳統的CGI模式相比採用了更加合理的解析進程啟動模式,速度比CGI快2倍;在PHP5.3以上的版本已經對ISAPI模式不支持。

在已經安裝iis6和ms sql server 2005後,整個安裝過程是
1.安裝FastCGI;
2.安裝php5.3.2;
3.安裝SQL Server Driver for PHP 1.1驅動;

一、在伺服器上安裝FastCGI
在伺服器上打開下面網址運行Microsoft Web 平台安裝程序:
http://www.microsoft.com/web/gallery/install.aspx?appsxml=&appid=PHP%3bPHP%3bPHP

如圖:勾選選web伺服器/自定義/應用程序開發/FastCGI1.0,下一步直至FastCGI安裝完成;

有關FASTCGI的官方說明文檔:
http://www.iis.net/articles/view.aspx/IIS7/Hosting-Web-Applications/PHP/Configuring-FastCGI-Extension-for-IIS6-0-and-IIS5-?Page=1

二、安裝php5.3.2
下載網址:http://windows.php.net/downloads/releases/
截圖:

我們下載這里目前所見的最新版本php-5.3.2-Win32-VC9-x86.msi 到伺服器上,VC6用於apache,vc9用於win2003 server iis等;熟悉php的程序員可以下載zip版自行配置;
運行php-5.3.2-Win32-VC9-x86.msi,安裝中出現對話框,選擇安裝目錄C:\PHP,選擇IIS FASTCGI;完成安裝。

三、配置IIS支持PHP
1.FACTCGI安裝後在c:\windows\system32\inetsrv下有五個文件,其中有用的是:fcgtext.dll,fcgitext.ini;打開FASTCGI配置文件fcgitext.ini,在最後[Types]修改為這樣的樣式:
[Types]
php=PHP
[PHP]
ExePath=c:\Php\php-cgi.exe
2.打開IIS管理器,網站上點右鍵-屬性-主目錄-配置-添加fcgiext.dll為可執行文件,配置如下圖

經過上述步驟,已經完成了PHP5.3.2在iis6上的安裝;如果下載的是zip版,則需對php.ini文件進行配置;

之後,在iis里默認文檔添加php。

四、安裝SQL Server Driver for PHP 1.1驅動
SQL Server Driver for PHP 1.1驅動支持SQL Server 2005和 SQL Server 2008,目前最新的下載地址是:
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=ccdf728b-1ea0-48a8-a84a-5052214caad9

系統環境:
Supported Operating Systems: Windows 2000 Service Pack 4; Windows 7; Windows Server 2003 Service Pack 2; Windows Server 2008; Windows Vista Service Pack 1; Windows XP Service Pack 3

PHP 5.2.4, or later. For more information about downloading and installing PHP, visit http://php.net/.

Microsoft SQL Server 2008 SQL Server Native Client. You can download SQL Server Native Client from a SQL Server 2008 Feature Pack.

Any edition of SQL Server 2005 or SQL Server 2008.

A Web server configured to run PHP.

1.下載後文件名為SQLServerDriverForPHP11.EXE,解壓如圖:

2.拷貝驅動php_sqlsrv_53_ts_vc9.dll到相應的位置PHP目錄下ext文件夾內;

3.配置的時候若需要配置一個PHP的擴展,此擴展需要將相關的dll文件全部復制到PHP的擴展目錄裡面,然後通過修改php.ini來實現PHP的擴展,在php.ini裡面需要指明擴展路徑,一般情況是在最末尾添加一行,所以修改php.ini實現擴展:

在php.ini的一大堆;extension=**.dll格式裡面添加一行,此部分位於以下注釋下邊一般:

; Windows Extensions
; Note that ODBC support is built in, so no dll is needed for it.
; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5)
; extension folders as well as the separate PECL DLL download (PHP 5).
; Be sure to appropriately set the extension_dir directive.

添加的一行內容為:
extension=php_sqlsrv_53_ts_vc9.dll
保存php.ini後拷貝一份到windows目錄下;
選擇php_sqlsrv_53_ts_vc9.dll的原因在於,php_sqlsrv_53_ts_vc9.dll是線程安全的驅動,如果伺服器本身的環境是使用的php5ts.dll,對應的就用這個驅動;

4.測試配置環境:
整個過程操作好了過後,寫一個test.php測試一下配置的相關環境,測試代碼如下:
<?php
phpinfo();
?>
若出現下圖則說明已經成功啟用FastCGI:



若出現以下圖片證明php5.3.2連接到ms sql server 2005資料庫配置好了:

安裝後根據自己需要再對php.ini進行設置,重啟IIS就可以了。

註:如果安裝sql server 2005時沒有安裝SQL Server Native Client 10.0 2007.100.2531.00,則php連接資料庫是會有odbc數據源未設置之類的錯誤提示,那麼就需要安裝Microsoft SQL Server 2008 Native Client(2005和2008都適用)
下載地址:
X86 Package (sqlncli.msi) - 4504 KB
X64 Package (sqlncli.msi) - 7919 KB
IA64 Package (sqlncli.msi) - 11078 KB
安裝後在伺服器上數據源ODBC里會出現SQL Server Native Client 10.0,如圖

至此,全部安裝結束,可以開始編程了;

Ⅸ php 內置大概多少個常量

每個版本的內置常量都例不有同的,要看具體的版本。這些是我收集到的。大概有250個左右吧。參考參考。

PHP_VERSION(string)
PHP_MAJOR_VERSION(integer)可用自:PHP5.2.7.
PHP_MINOR_VERSION(integer)可用自:PHP5.2.7.
PHP_RELEASE_VERSION(integer)可用自:PHP5.2.7.
PHP_VERSION_ID(integer)可用自:PHP5.2.7.
PHP_EXTRA_VERSION(string)可用自:PHP5.2.7.
PHP_ZTS(integer)可用自:PHP5.2.7.
PHP_DEBUG(integer)可用自:PHP5.2.7.
PHP_MAXPATHLEN(integer)可用自:PHP5.3.0.
PHP_OS(string)
PHP_SAPI(string)可用自:PHP4.2.0.參見:php_sapi_name().
PHP_EOL(string)可用自:PHP4.3.10andPHP5.0.2
PHP_INT_MAX(integer)可用自:PHP4.4.0andPHP5.0.5
PHP_INT_SIZE(integer)可用自:PHP4.4.0andPHP5.0.5
DEFAULT_INCLUDE_PATH(string)
PEAR_INSTALL_DIR(string)
PEAR_EXTENSION_DIR(string)
PHP_EXTENSION_DIR(string)
PHP_PREFIX(string)可用自:PHP4.3.0
PHP_BINDIR(string)
PHP_LIBDIR(string)
PHP_DATADIR(string)
PHP_SYSCONFDIR(string)
PHP_LOCALSTATEDIR(string)
PHP_CONFIG_FILE_PATH(string)
PHP_CONFIG_FILE_SCAN_DIR(string)
PHP_SHLIB_SUFFIX(string)可用自:PHP4.3.0
PHP_OUTPUT_HANDLER_START(integer)
PHP_OUTPUT_HANDLER_CONT(integer)
PHP_OUTPUT_HANDLER_END(integer)
PHP_WINDOWS_VERSION_MAJOR(integer)可用自:PHP5.3.0
PHP_WINDOWS_VERSION_MINOR(integer)可用自:PHP5.3.0
PHP_WINDOWS_VERSION_BUILD(integer)可用自:PHP5.3.0
PHP_WINDOWS_VERSION_PLATFORM(integer)可用自:PHP5.3.0
PHP_WINDOWS_VERSION_SP_MAJOR(integer)可用自:PHP5.3.0
PHP_WINDOWS_VERSION_SP_MINOR(integer)可用自:PHP5.3.0
PHP_WINDOWS_VERSION_SUITEMASK(integer)可用自:PHP5.3.0
PHP_WINDOWS_VERSION_PRODUCTTYPE(integer)可用自:PHP5.3.0
PHP_WINDOWS_NT_DOMAIN_CONTROLLER(integer)可用自:PHP5.3.0
PHP_WINDOWS_NT_SERVER(integer)可用自:PHP5.3.0
PHP_WINDOWS_NT_WORKSTATION(integer)可用自:PHP5.3.0
E_ERROR(integer)
E_WARNING(integer)
E_PARSE(integer)
E_NOTICE(integer)
E_CORE_ERROR(integer)
E_CORE_WARNING(integer)
E_COMPILE_ERROR(integer)
E_COMPILE_WARNING(integer)
E_USER_ERROR(integer)
E_USER_WARNING(integer)
E_USER_NOTICE(integer)
E_DEPRECATED(integer)可用自:PHP5.3.0
E_USER_DEPRECATED(integer)可用自:PHP5.3.0
E_ALL(integer)
E_STRICT(integer)可用自:PHP5.0.0
__COMPILER_HALT_OFFSET__(integer)可用自:PHP5.1.0
TRUE(boolean)參見:Booleans.
FALSE(boolean)參見:Booleans.
NULL(boolean)參見:Null.
EXTR_OVERWRITE(integer)
EXTR_SKIP(integer)
EXTR_PREFIX_SAME(integer)
EXTR_PREFIX_ALL(integer)
EXTR_PREFIX_INVALID(integer)
EXTR_PREFIX_IF_EXISTS(integer)
EXTR_IF_EXISTS(integer)
SORT_ASC(integer)
SORT_DESC(integer)
SORT_REGULAR(integer)
SORT_NUMERIC(integer)
SORT_STRING(integer)
CASE_LOWER(integer)
CASE_UPPER(integer)
COUNT_NORMAL(integer)
COUNT_RECURSIVE(integer)
ASSERT_ACTIVE(integer)
ASSERT_CALLBACK(integer)
ASSERT_BAIL(integer)
ASSERT_WARNING(integer)
ASSERT_QUIET_EVAL(integer)
CONNECTION_ABORTED(integer)
CONNECTION_NORMAL(integer)
CONNECTION_TIMEOUT(integer)
INI_USER(integer)
INI_PERDIR(integer)
INI_SYSTEM(integer)
INI_ALL(integer)
M_E(float)
M_LOG2E(float)
M_LOG10E(float)
M_LN2(float)
M_LN10(float)
M_PI(float)
M_PI_2(float)
M_PI_4(float)
M_1_PI(float)
M_2_PI(float)
M_2_SQRTPI(float)
M_SQRT2(float)
M_SQRT1_2(float)
CRYPT_SALT_LENGTH(integer)
CRYPT_STD_DES(integer)
CRYPT_EXT_DES(integer)
CRYPT_MD5(integer)
CRYPT_BLOWFISH(integer)
DIRECTORY_SEPARATOR(string)
SEEK_SET(integer)
SEEK_CUR(integer)
SEEK_END(integer)
LOCK_SH(integer)
LOCK_EX(integer)
LOCK_UN(integer)
LOCK_NB(integer)
HTML_SPECIALCHARS(integer)
HTML_ENTITIES(integer)
ENT_COMPAT(integer)
ENT_QUOTES(integer)
ENT_NOQUOTES(integer)
INFO_GENERAL(integer)
INFO_CREDITS(integer)
INFO_CONFIGURATION(integer)
INFO_MODULES(integer)
INFO_ENVIRONMENT(integer)
INFO_VARIABLES(integer)
INFO_LICENSE(integer)
INFO_ALL(integer)
CREDITS_GROUP(integer)
CREDITS_GENERAL(integer)
CREDITS_SAPI(integer)
CREDITS_MODULES(integer)
CREDITS_DOCS(integer)
CREDITS_FULLPAGE(integer)
CREDITS_QA(integer)
CREDITS_ALL(integer)
STR_PAD_LEFT(integer)
STR_PAD_RIGHT(integer)
STR_PAD_BOTH(integer)
PATHINFO_DIRNAME(integer)
PATHINFO_BASENAME(integer)
PATHINFO_EXTENSION(integer)
PATH_SEPARATOR(string)
CHAR_MAX(integer)
LC_CTYPE(integer)
LC_NUMERIC(integer)
LC_TIME(integer)
LC_COLLATE(integer)
LC_MONETARY(integer)
LC_ALL(integer)
LC_MESSAGES(integer)
ABDAY_1(integer)
ABDAY_2(integer)
ABDAY_3(integer)
ABDAY_4(integer)
ABDAY_5(integer)
ABDAY_6(integer)
ABDAY_7(integer)
DAY_1(integer)
DAY_2(integer)
DAY_3(integer)
DAY_4(integer)
DAY_5(integer)
DAY_6(integer)
DAY_7(integer)
ABMON_1(integer)
ABMON_2(integer)
ABMON_3(integer)
ABMON_4(integer)
ABMON_5(integer)
ABMON_6(integer)
ABMON_7(integer)
ABMON_8(integer)
ABMON_9(integer)
ABMON_10(integer)
ABMON_11(integer)
ABMON_12(integer)
MON_1(integer)
MON_2(integer)
MON_3(integer)
MON_4(integer)
MON_5(integer)
MON_6(integer)
MON_7(integer)
MON_8(integer)
MON_9(integer)
MON_10(integer)
MON_11(integer)
MON_12(integer)
AM_STR(integer)
PM_STR(integer)
D_T_FMT(integer)
D_FMT(integer)
T_FMT(integer)
T_FMT_AMPM(integer)
ERA(integer)
ERA_YEAR(integer)
ERA_D_T_FMT(integer)
ERA_D_FMT(integer)
ERA_T_FMT(integer)
ALT_DIGITS(integer)
INT_CURR_SYMBOL(integer)
CURRENCY_SYMBOL(integer)
CRNCYSTR(integer)
MON_DECIMAL_POINT(integer)
MON_THOUSANDS_SEP(integer)
MON_GROUPING(integer)
POSITIVE_SIGN(integer)
NEGATIVE_SIGN(integer)
INT_FRAC_DIGITS(integer)
FRAC_DIGITS(integer)
P_CS_PRECEDES(integer)
P_SEP_BY_SPACE(integer)
N_CS_PRECEDES(integer)
N_SEP_BY_SPACE(integer)
P_SIGN_POSN(integer)
N_SIGN_POSN(integer)
DECIMAL_POINT(integer)
RADIXCHAR(integer)
THOUSANDS_SEP(integer)
THOUSEP(integer)
GROUPING(integer)
YESEXPR(integer)
NOEXPR(integer)
YESSTR(integer)
NOSTR(integer)
CODESET(integer)
LOG_EMERG(integer)
LOG_ALERT(integer)
LOG_CRIT(integer)
LOG_ERR(integer)
LOG_WARNING(integer)
LOG_NOTICE(integer)
LOG_INFO(integer)
LOG_DEBUG(integer)
LOG_KERN(integer)
LOG_USER(integer)
LOG_MAIL(integer)
LOG_DAEMON(integer)
LOG_AUTH(integer)
LOG_SYSLOG(integer)
LOG_LPR(integer)
LOG_NEWS(integer)
LOG_UUCP(integer)
LOG_CRON(integer)
LOG_AUTHPRIV(integer)
LOG_LOCAL0(integer)
LOG_LOCAL1(integer)
LOG_LOCAL2(integer)
LOG_LOCAL3(integer)
LOG_LOCAL4(integer)
LOG_LOCAL5(integer)
LOG_LOCAL6(integer)
LOG_LOCAL7(integer)
LOG_PID(integer)
LOG_CONS(integer)
LOG_ODELAY(integer)
LOG_NDELAY(integer)
LOG_NOWAIT(integer)
LOG_PERROR(integer)

Ⅹ linux怎麼搭建php開發環境

一、安裝Apache2.2.22
1、到官網下載 http://httpd.apache.org/download.cgi
2、解壓
tar -zxvf httpd-2.2.22.tar.gz
3、建立目標文件夾(注意以下所有操作都時在root用戶下執行的)
mkdir /usr/local/apache2
也就是說等下安裝的apache2要安裝到這個文件夾裡面
4、配置
回到原來解壓之後產生的文件夾
./configure --prefix=/usr/local/apache2 --enable-mole=shared
要加上後面的參數,否則無法使用php,-enable-mole=shared表示Apache可以動態的載入模塊
這一步,出現了很多問題:
第一個錯誤為:
checking for APR... no
configure: error: APR not found. Please read the documentation.
解決方法:
download the latest versions of both APR and APR-Util from Apache APR, unpack them into ./srclib/apr and ./srclib/apr-util (be sure the domain names do not have version numbers; for example, the APR distribution must be under ./srclib/apr/)
then do
./configure --with-included-apr
原文章地址:http://stackoverflow.com/questions/9436860/apache-httpd-setup-and-installatio
另外一種解決方法為:
分別安裝APR和APR-util,安裝方法為:首先下載這兩個文件,然後解壓,進入解壓後目錄,然後把APR和APR-util分別安裝到/usr/local/文件夾的apr和apr-util文件夾下。APR的具體安裝方法為:
[root@localhost 52lamp]# tar -zxvf apr-1.4.2.tar.gz //unzip -o apr-1.4.2.zip
[root@localhost 52lamp]# cd apr-1.4.2
[root@localhost apr-1.4.2]# ./configure --prefix=/usr/local/apr
[root@localhost apr-1.4.2]# make
[root@localhost apr-1.4.2]# make install
安裝Apr-util 在./confiure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
其他步驟類似。

第二個錯誤為:no acceptable C compiler found in $Path
直接運行 yum install gcc,安裝Gcc即可
第三個問題為:pcre-config for libpcre not found
解決方法就是 下載prce安裝包,和APR類似,安裝到/usr/local/pcre文件夾下面即可。PS:fedora下安裝c++編譯器g++的命令為:yum install gcc-c++ 。
5、編譯
make
6、安裝
make install
7、啟動,重啟和停止 ,先切換到安裝完成後的目錄/usr/local/apache2/bin
./apachectl -k start
./apachectl -k restart
./apachectl -k stop
8、配置文件(滿足最基本的配置)
編輯 /usr/local/apache2/conf/httpd.conf 文件
找到:
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
在後面添加:
AddType application/x-httpd-php .php(使Apcche支持PHP)
AddType application/x-httpd-php-source .php5
找到:
<IfMole dir_mole>
DirectoryIndex index.html
</IfMole>
添加:
<IfMole dir_mole>
DirectoryIndex index.html index.php
</IfMole>
找到:
#ServerName www.example.com:80
修改為:
ServerName 127.0.0.1:80或者ServerName localhost:80
記得要去掉前面的「#」
9、測試
在瀏覽器里輸入http://127.0.0.1
如果出現It Works!說明成功。這是我的測試結果:O(∩_∩)O哈哈~

10、修改默認的Web站點目錄
默認的目錄為 "/usr/local/apache2/htdocs",修改apache的配置文件httpd.conf,比如在新建一個 /home/gyw/WebSite的目錄作為apache的站點目錄
找到DocumentRoot這一行修改為:DocumentRoot "/home/gyw/WebSite"
找到 <Directory> 這一行修改為:<Directory "/home/gyw/WebSite">
測試:修改到文件夾出現錯誤:
「You don't have permission to access /index.html on this server.」
解決方法:
更改文件許可權;chmod 755 index.html
打開apache配置文件httpd.conf,找到這么一段:
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
deny from all
Satisfy all
</Directory>
測試結果如下:

二、安裝PHP
1、 下載
http://www.php.net/downloads.php
2、解壓
tar -zxvf php-5.3.16.tar.gz
3、建立目標文件夾
mkdir /usr/local/php
也就是說等下安裝的php要安裝到這個文件夾裡面
4、配置
回到原來解壓後的文件夾
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs
注意這里有一個-with-apxs2=/usr/local/apache/bin/apxs選項,其中apxs是在安裝Apache時產生的,apxs是一個為Apache HTTP伺服器編譯和安裝擴展模塊的工具,使之可以用由mod_so提供的LoadMole指令在運行時載入到Apache伺服器中。我的理解是通過這個工具把PHP模塊動態載入到Apache中
出現錯誤:configure: error: xml2-config not found. Please check your libxml2 installation.
運行yum install libxml2,然後再運行yum install libxml2-devel安裝完畢後,重新運行上面的./configure命令。
5、編譯
make
6、測試編譯
make test
7、安裝
make install
8、配置文件
cp /usr/local/src/php-5.3.16/php.ini-development /usr/local/php/lib/php.ini
把原來位於源代碼裡面的php.ini-development拷貝到/usr/local/php/lib/php.ini下,並且重命名為php.ini
9.重啟apache
10、測試
在apache的htdocs下建立一個php文件test.php,裡面的內容如下:
<?php
phpinfo();
?>
然後在瀏覽器里輸入http://127.0.0.1/test.php
如果出現php的相關配置,成功,如果什麼都沒有輸入,說明失敗,重新以上步驟或者查找原因
如果決定在安裝後改變配置選項,只需重復最後的三步configure, make, 以及 make install,然後需要重新啟動 Apache 使新模塊生效。Apache不需要重新編譯。
測試結果如下圖:

三、安裝MySql

1、下載
到官網下載mysql-5.1.65.tar.gz(注意是源碼包)
2、解壓
tar -zxvf mysql-5.1.65.tar.gz
3、建立目標文件夾
mkdir /usr/local/mysql
也就是說等下安裝的mysql要安裝到這個文件夾裡面
4、配置
./configure --prefix=/usr/local/mysql/
在./configure時出現錯誤:error: No curses/termcap library found
下載安裝相應軟體包
yum list|grep ncurses
yum -y install ncurses-devel
yum install ncurses-devel
5、編譯
make
6、安裝
make install
7、啟動
MySQL服務並不會自動啟動,還需要先初始化MySQL資料庫,操作如下:
cd /usr/local/mysql/bin
sudo ./mysql_install_db --user=root
注意,這里最後的root是指可以操作資料庫的用戶,可以是當前用戶,也可以新建用戶,與linux上的root用戶是兩回事,可以自己取一個名字
./mysqld_safe --user=root & 這條命令負責啟動mysql服務的守護進程,此外最後的&時必須的,因為希望守護進程在後台運行
這里的root就是剛才的那個
8、為根用戶創建密碼
./mysqladmin -u root password 『123456』
如果root已經設置過密碼,採用如下方法
./mysqladmin -u root password oldpass 『123456』
9、測試
mysql -u root -p
會提示輸入密碼,就用剛才設置的密碼
123456
如果出現mysql>,說明連接成功了,下面通過命令 創建一個資料庫、建一個表,增加一條記錄,為後面的測試准備
mysql> create database gywtest;
mysql> use gywtest;
mysql> create table student(id int(4) not null primary key auto_increment,stuname char(20));
mysql> insert into student(stuname) values('Tom');
注意每條命令後面有個分號,如果上面的都成功,後面就可以用這個測試。
四、將PHP與MySql結合起來
1、重新配置PHP,改變配置選項,只需重復PHP安裝時的最後的三步configure, make, 以及 make install,然後需要重新啟動 Apache 使新模塊生效,Apache不需要重新編譯。
2、配置
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysqli=/usr/local/mysql/bin/mysql_config 注意mysql_config 的路徑
3、編譯 make
4、安裝 make installe
5、測試 寫一個頁面test.php,放在apache的web目錄下,測試上面用命令創建的資料庫
<?php
$mysqli=new mysqli();
$mysqli->connect('localhost','root','123456','gywtest');
// 創建查詢
$sqlstr='select * from student';
//發送查詢給MySql
$result=$mysqli->query($sqlstr);
while($row=$result->fetch_object())
{
$name=$row->stuname;
echo $name;
}
?>
Fatal error: Class 'mysqli' not found in /home/lufangtao/Project/DB.php on line 3
解決方法:
/usr/local/php/bin/phpize 這里回車運行
出錯:
Cannot find config.m4.
Make sure that you run './phpize' in the top level source directory of the mole
解決方法:
PHP源碼包文件夾下的EXT文件夾就是放置著目前版本的可用擴展,CD進去看看都有哪些你需要的?應該看到mysqli文件夾了吧~~~
在當前目錄下執行phpize
[root@localhost mysqli]#/usr/local/php/bin/phpize
Configuring for:
PHP Api Version: 20090626
Zend Modeule Api No: 20090626
Zend Extension Api No: 220090626
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
解決方法:
yum install autoconf再次運行上面的命令即可。
[root@localhost mysqli]#./configure –prefix=/opt/mysqli –with-php-config=/opt/php/bin/php-config –with-mysqli=/opt/mysql/bin/mysql_config
[root@localhost mysqli]#make
[root@localhost mysqli]#make install
安裝完成後會有提示擴展所在目錄路徑,如:
/opt/php/lib/php/extensions/no-debug-zts-20090626php
所需的mysqli.so便會在此目錄下,接下來修改/opt/php/etc/下的php.ini文件,加入mysqli擴展,即加入如下一行:
extension=/opt/php/lib/php/extensions/no-debug-zts-20090626/mysqli.so
這里還是回出現錯誤:
參考博客http://www.cnblogs.com/wangtao_20/archive/2011/03/07/1973621.html
解決不用擴展連接MySQL的方法。
最終還是沒有解決MySQLi連接的問題,但是可以使用MySQL資料庫了,下面是測試程序

<?php

$link=mysql_connect('localhost','root','123456');

if(!$link) echo "F!";

else echo "S!";

mysql_select_db("students") or die("Could not select database");
$query="SELECT * FROM student;";
$result=mysql_query($query) or die("Query failed");
print "<table>\n";

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
print "\t<tr>\n";
foreach ($line as $col_value) {
print "\t\t<td>$col_value</td>\n";
}
print "\t</tr>\n"; }
print "</table>\n";

/* 釋放資源 */

mysql_free_result($result);
mysql_close();

?>
~

閱讀全文

與phpdebugbuild相關的資料

熱點內容
黑馬程序員路徑大全 瀏覽:1000
saas平台PHP 瀏覽:333
雲伺服器科學計算配置怎麼選 瀏覽:649
jar解壓命令 瀏覽:609
php正則問號 瀏覽:299
無線已加密不可上網是怎麼了 瀏覽:464
什麼app可以免費做手機 瀏覽:375
異性下載什麼app 瀏覽:680
51單片機程序單步視頻 瀏覽:241
家庭寬頻如何連接伺服器 瀏覽:119
汽車高壓泵解壓 瀏覽:772
上門正骨用什麼app 瀏覽:761
安卓為什麼免費使用 瀏覽:398
加密貨幣都有哪些平台 瀏覽:629
python和matlab難度 瀏覽:391
python爬蟲很難學么 瀏覽:574
小米解壓積木可以組成什麼呢 瀏覽:818
為什麼滴滴出行app還能用 瀏覽:568
怎麼升級手機android 瀏覽:926
php權威編程pdf 瀏覽:998