search

gedit+Mozilla Firefox

<?php$x="1.23abc";echo $x+7;           //程序以上部分是对。//程序以下部分是错。//在浏览器运行这个程序,结果是:什么也不显示!$y=a1.0;if ($y)echo "QQ"; ?>


用上面的记事本+浏览器 调试。
如果php程序的一部分出错,可能整个程序的结果,都不能在浏览器里显示出来。
这样,查找程序错误有些困难。
有什么方法,解决这个问题呢?


回复讨论(解决方案)

开启php错误提示功能
php.ini 中设置display_errors=On ,然后重启服务器。

没有打开错误显示功能时,任何php错误都将导致一个 500 错误(服务器拒绝响应)

$y=a1.0;
语法错! Parse error: syntax error, unexpected '.0' (T_DNUMBER)

开启php错误提示功能
php.ini 中设置display_errors=On ,然后重启服务器。

1.在哪个目录?
2.怎样重启服务器?

在你的php文件中写上:
 phpinfo(); 

查找Loaded Configuration File ,修改它加载的php.ini 文件即可。

重启服务可以打开你的系统服务列表,找到apache,然后重启,或者命令行下也行。

在你的php文件中写上:
 phpinfo(); 

查找Loaded Configuration File ,修改它加载的php.ini 文件即可。

重启服务可以打开你的系统服务列表,找到apache,然后重启,或者命令行下也行。

1.php.ini 在哪个目录?
2.重启命令怎样?

在你的程序?部加入??行就可以了,不用修改php.ini

Error_reporting(E_ALL);
INI_Set('display_errors','on');


在你的php文件中写上:
 phpinfo(); 

查找Loaded Configuration File ,修改它加载的php.ini 文件即可。

重启服务可以打开你的系统服务列表,找到apache,然后重启,或者命令行下也行。

1.php.ini 在哪个目录?
2.重启命令怎样?

你不是windows下的么
php.ini一般在php文件夹根目录下
重启直接在"系统服务"列表中 找到apache 然后重启 sibang说的很清楚你直接去做就可以了

打开系统服务列表的办法是 在"计算机"或者"我的电脑"上点右键,选择"管理"->服务

亲,windows下找不到目录不会用查找文件来找吗?



在你的php文件中写上:
 phpinfo(); 

查找Loaded Configuration File ,修改它加载的php.ini 文件即可。

重启服务可以打开你的系统服务列表,找到apache,然后重启,或者命令行下也行。

1.php.ini 在哪个目录?
2.重启命令怎样?

你不是windows下的么
php.ini一般在php文件夹根目录下
重启直接在"系统服务"列表中 找到apache 然后重启 sibang说的很清楚你直接去做就可以了

打开系统服务列表的办法是 在"计算机"或者"我的电脑"上点右键,选择"管理"->服务

ubuntu

楼主抱歉..我看错帖子了  你这个不是windows下的.....  汗一个... 刚才一个帖子里看到了D:/xxxxx

楼主抱歉..我看错帖子了  你这个不是windows下的.....  汗一个... 刚才一个帖子里看到了D:/xxxxx

/

楼主抱歉..我看错帖子了  你这个不是windows下的.....  汗一个... 刚才一个帖子里看到了D:/xxxxx


楼主抱歉..我看错帖子了  你这个不是windows下的.....  汗一个... 刚才一个帖子里看到了D:/xxxxx

注意代码第七行,这是个字符串赋值还是?否则如#2所说,未知错误(不存在这样的定义)。如果是字符串赋值,则写成这样:$y= 'a1.0 ';

开启php错误提示功能
php.ini 中设置display_errors=On ,然后重启服务器。

ubuntu系统
1.php.ini 文件在哪个目录?

2.重启服务器命令是什么?

不知道你的php是自带的还是后来编译的,网上搜索一下吧,我很少玩linux,不是很熟悉。

新建以文件,比如 info.php

<?phpphpinfo();

运行后查看这两项
Configuration File (php.ini) Path  (默认的 php.ini 路径)
Loaded Configuration File  (实际加载的 php.ini 路径)

新建以文件,比如 info.php

<?phpphpinfo();

运行后查看这两项
Configuration File (php.ini) Path  (默认的 php.ini 路径)
Loaded Configuration File  (实际加载的 php.ini 路径)
老大,我那问题是不是缺什么东西?没法继续了?

我在 #2 不是说了吗?
那是语法错!如果不打开错误显示,则会出现 500 错
如果你设置了错误日志,那么也不会显示。但你可以在错误日志里看到错误信息
总之,当出现语法错误的时候,php 就退出运行了



新建以文件,比如 info.php

<?phpphpinfo();

运行后查看这两项
Configuration File (php.ini) Path  (默认的 php.ini 路径)
Loaded Configuration File  (实际加载的 php.ini 路径)
老大,我那问题是不是缺什么东西?没法继续了?

我在 #2 不是说了吗?
那是语法错!如果不打开错误显示,则会出现 500 错
如果你设置了错误日志,那么也不会显示。但你可以在错误日志里看到错误信息
总之,当出现语法错误的时候,php 就退出运行了




新建以文件,比如 info.php

<?phpphpinfo();

运行后查看这两项
Configuration File (php.ini) Path  (默认的 php.ini 路径)
Loaded Configuration File  (实际加载的 php.ini 路径)
老大,我那问题是不是缺什么东西?没法继续了?
不是这个帖子。。。
请移步:http://bbs.csdn.net/topics/390507272



在你的php文件中写上:
 phpinfo(); 

查找Loaded Configuration File ,修改它加载的php.ini 文件即可。

重启服务可以打开你的系统服务列表,找到apache,然后重启,或者命令行下也行。

1.php.ini 在哪个目录?
2.重启命令怎样?

你不是windows下的么
php.ini一般在php文件夹根目录下
重启直接在"系统服务"列表中 找到apache 然后重启 sibang说的很清楚你直接去做就可以了

打开系统服务列表的办法是 在"计算机"或者"我的电脑"上点右键,选择"管理"->服务


,,,

在你的程序?部加入??行就可以了,不用修改php.ini

Error_reporting(E_ALL);
INI_Set('display_errors','on');

这个方法也不行。
mozilla firefox浏览器,什么也没显示。

新建以文件,比如 info.php

<?phpphpinfo();

运行后查看这两项
Configuration File (php.ini) Path  (默认的 php.ini 路径)
Loaded Configuration File  (实际加载的 php.ini 路径)

1.创建一新文件:info.php,这个文件存放在什么地方?
2.还要修改文件:php.ini么?

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What is the difference between unset() and session_destroy()?What is the difference between unset() and session_destroy()?May 04, 2025 am 12:19 AM

Thedifferencebetweenunset()andsession_destroy()isthatunset()clearsspecificsessionvariableswhilekeepingthesessionactive,whereassession_destroy()terminatestheentiresession.1)Useunset()toremovespecificsessionvariableswithoutaffectingthesession'soveralls

What is sticky sessions (session affinity) in the context of load balancing?What is sticky sessions (session affinity) in the context of load balancing?May 04, 2025 am 12:16 AM

Stickysessionsensureuserrequestsareroutedtothesameserverforsessiondataconsistency.1)SessionIdentificationassignsuserstoserversusingcookiesorURLmodifications.2)ConsistentRoutingdirectssubsequentrequeststothesameserver.3)LoadBalancingdistributesnewuser

What are the different session save handlers available in PHP?What are the different session save handlers available in PHP?May 04, 2025 am 12:14 AM

PHPoffersvarioussessionsavehandlers:1)Files:Default,simplebutmaybottleneckonhigh-trafficsites.2)Memcached:High-performance,idealforspeed-criticalapplications.3)Redis:SimilartoMemcached,withaddedpersistence.4)Databases:Offerscontrol,usefulforintegrati

What is a session in PHP, and why are they used?What is a session in PHP, and why are they used?May 04, 2025 am 12:12 AM

Session in PHP is a mechanism for saving user data on the server side to maintain state between multiple requests. Specifically, 1) the session is started by the session_start() function, and data is stored and read through the $_SESSION super global array; 2) the session data is stored in the server's temporary files by default, but can be optimized through database or memory storage; 3) the session can be used to realize user login status tracking and shopping cart management functions; 4) Pay attention to the secure transmission and performance optimization of the session to ensure the security and efficiency of the application.

Explain the lifecycle of a PHP session.Explain the lifecycle of a PHP session.May 04, 2025 am 12:04 AM

PHPsessionsstartwithsession_start(),whichgeneratesauniqueIDandcreatesaserverfile;theypersistacrossrequestsandcanbemanuallyendedwithsession_destroy().1)Sessionsbeginwhensession_start()iscalled,creatingauniqueIDandserverfile.2)Theycontinueasdataisloade

What is the difference between absolute and idle session timeouts?What is the difference between absolute and idle session timeouts?May 03, 2025 am 12:21 AM

Absolute session timeout starts at the time of session creation, while an idle session timeout starts at the time of user's no operation. Absolute session timeout is suitable for scenarios where strict control of the session life cycle is required, such as financial applications; idle session timeout is suitable for applications that want users to keep their session active for a long time, such as social media.

What steps would you take if sessions aren't working on your server?What steps would you take if sessions aren't working on your server?May 03, 2025 am 12:19 AM

The server session failure can be solved through the following steps: 1. Check the server configuration to ensure that the session is set correctly. 2. Verify client cookies, confirm that the browser supports it and send it correctly. 3. Check session storage services, such as Redis, to ensure that they are running normally. 4. Review the application code to ensure the correct session logic. Through these steps, conversation problems can be effectively diagnosed and repaired and user experience can be improved.

What is the significance of the session_start() function?What is the significance of the session_start() function?May 03, 2025 am 12:18 AM

session_start()iscrucialinPHPformanagingusersessions.1)Itinitiatesanewsessionifnoneexists,2)resumesanexistingsession,and3)setsasessioncookieforcontinuityacrossrequests,enablingapplicationslikeuserauthenticationandpersonalizedcontent.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.