A PHP-driven script to determine if the environment is configured

--00032555833afaf8c1047ae7d317
Content-Type: text/plain; charset=UTF-8

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 ( [at] 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

--00032555833afaf8c1047ae7d317--
AmirBehzad Eslami [ Do, 17 Dezember 2009 08:46 ] [ ID #2026380 ]

Re: A PHP-driven script to determine if the environment is configured correctly (checklist)

=D0=97=D0=B4=D1=80=D0=B0=D0=B2=D1=81=D1=82=D0=B2=D1=83=D0=B9 =D1=82=D0=B5, A=
mirBehzad.

=D0=92=D1=8B =D0=BF=D0=B8=D1=81=D0=B0=D0=BB=D0=B8 17 =D0=B4=D0=B5=D0=BA=D0=
=B0=D0=B1=D1=80=D1=8F 2009 =D0=B3., 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 ( [at] php: file_exists), but how to ma=
ke
> sure if .htaccess is working?!
> - How do you check if AllowOverride is set to All in apache's configurati=
on?

> 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


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Sam [ Do, 17 Dezember 2009 08:55 ] [ ID #2026381 ]

Re: A PHP-driven script to determine if the environment isconfigured correctly (checklist)

--=-/dT8ivmCAtmzROs9OjZr
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Thu, 2009-12-17 at 17:55 +1000, Sam wrote:

> =D0=97=D0=B4=D1=80=D0=B0=D0=B2=D1=81=D1=82=D0=B2=D1=83=D0=B9 =D1=82=D0=B5,=
AmirBehzad.
>
> =D0=92=D1=8B =D0=BF=D0=B8=D1=81=D0=B0=D0=BB=D0=B8 17 =D0=B4=D0=B5=D0=BA=
=D0=B0=D0=B1=D1=80=D1=8F 2009 =D0=B3., 17:46:59:
>
> > Dear list,
> > e-Greetings,
>
> > I've developed some PHP-driven web applications. These applications wil=
l be
> > installed on different
> > linux-based servers (typically Debian and Redhat). Usually, after I cop=
y the
> > files to the
> > server, they DO NOT WORK, so I spend hours to debug the problem. Proble=
ms
> > are very funny,
> > for example, the program is giving strange errors, and it is not workin=
g
> > because "short_open_tags" are off !
>
> > I decided to write a PHP script to check if server's configuration meet=
s 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 ( [at] 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 configura=
tion?
>
> > 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



--=-/dT8ivmCAtmzROs9OjZr--
Ashley Sheridan [ Do, 17 Dezember 2009 12:57 ] [ ID #2026390 ]
PHP » gmane.comp.php.general » A PHP-driven script to determine if the environment is configured

Vorheriges Thema: RE:bcompiler.so fails to load
Nächstes Thema: Tracking the progress of download