Re: Making sure an include file works

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Richard S. Crawford schreef:
Thanks to everyone for the suggestions.  Unfortunately, I'm up against a
couple of major hurdles:

1.  My host does not allow command line access and has disabled shell
execution of PHP;

2.  Error reporting has been turned off and I can't seem to turn that on
with ini_set or error_reporting (which is fun when I have minor syntax
errors to fix); and

which ini setting? if you want to see your errors in the browser you need
 display_errors set to On. error_reporting only sets the level of reporting.


3.  My host is also stuck in PHP 4.3, so the check_syntax function isn't
available to me either (although I understand that this function has been
deprecated in the most recent builds of PHP).

make your host your ex-host.

At this point, I'll just use file_exists and is_readable for some basic
checking, and hope that the included files have no syntax errors.

it seems madness that you don't seem to test code before incorporating it
into a production system. at the very least anything you put on a website should
parse properly.

have you considered installing a local copy of php (and suitable webserver)
so you can test it there?


On Fri, Feb 29, 2008 at 11:25 AM, Daniel Brown <parasane@xxxxxxxxx> wrote:

On Thu, Feb 28, 2008 at 9:58 PM, Richard S. Crawford
<rscrawford@xxxxxxxxxxxx> wrote:
I'm trying to figure out a way to make sure an included PHP file has no
syntax
 errors before actually including it as a part of project. Is this even
 possible?  I'm running into brick walls.
   As far as I know, the only way to do that is via the CLI (or
accessing the include file directly in the browser).

   Make sure that error_reporting is enabled and that it's set to
report E_ALL if you want to really be sure your code is clean (i.e. -
reporting unused, undefined, and uninstantiated variables, et cetera).

   Then, if done from a *nix command line, just type:
       php -l /path/to/include/file.php

--
</Dan>

Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux