Ⅰ 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();
?>
~