Re: A PHP-driven script to determine if the environment is configured correctly (checklist)
| From: | Ashley Sheridan | Date: | Thu, 17 Dec 2009 11:57:10 +0000 |
| Subject: | Re: A PHP-driven script to determine if the environment is configured correctly (checklist) | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-300567@lists.php.net to get a copy of this message | ||
On Thu, 2009-12-17 at 17:55 +1000, Sam wrote:
> Здравствуйте, AmirBehzad.
>
> Вы писали 17 декабря 2009 г., 17:46:59:
>
> > Dear list,
> > e-Greetings,
>
> > I've developed some PHP-driven web applications. These applications will be
> > installed on different
> > linux-based servers (typically Debian and Redhat). Usually, after I copy the
> > files to the
> > server, they DO NOT WORK, so I spend hours to debug the problem. Problems
> > are very funny,
> > for example, the program is giving strange errors, and it is not working
> > because "short_open_tags" are off !
>
> > I decided to write a PHP script to check if server's configuration meets my
> > requirements.
> > - checking whether some php extensions are loaded, eg. MCrypt.
> > - checking wheather short_open_tags is ON
> > - checking whether mod_rewrite is enabled
> > - etc.
>
> > Here's my question:
>
> > - How do you check if .htaccess is working, *** via php code *** ?
> > It's easy to check if .htaccess exists (@php: file_exists), but how to make
> > sure if .htaccess is working?!
> > - How do you check if AllowOverride is set to All in apache's configuration?
>
> > Please let me know what do you think. Thank you in advance.
> > -behzad
>
> Make sure that you did your scripts executable(chmod +x)
> You can check .htaccess that way:
> create .htaccess if folder with script, override some directive thru
> it, like php's max execution time.
> then create php script, get php value that you've
> changed(max_execution_time), compare to the value you gave in
> .htaccess, if values are the same, .htaccess is working!
>
>
> --
> Sam
>
>
I'd advise against using short PHP tags, as they cause all sorts of
problems with outputting XML-based code, and as you've seen, it's
doesn't make your code very portable. For the sake of a few keystrokes,
is it really worth it? Also, I believe they are being phased out as of
PHP6, so it might be time to think about updating your code a bit!
Thanks,
Ash
http://www.ashleysheridan.co.uk