By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,053 Members | 1,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,053 IT Pros & Developers. It's quick & easy.

WAMP5, short tags and CLI PHP issue

P: n/a
I installed WAMP5 on my WinXP box which works just fine on its own,
and I found a practical way of handling my short-tag PHP script
via .htaccess:

php_flag short_open_tag on

To ensure my literally hundreds of PHP scripts will all function
within the WAMP5 architecture.

However, there is a case of a series of installer scripts written in
PHP that are not meant to be run except as CLI PHP that obviously will
not benefit from .htaccess, furthermore, changing the CLI PHP scripts
from short to long tags is very much not an option due to both the
volume of scripts and code complexity as patterns of '<' . '?..' or
"<" . "?.." or '<' . "?.." will exist within scripts alongside the
dynamic generation of other PHP scripts by other CLI PHP scripts.

Realizing that .htaccess is not usable for CLI PHP nor can I use
ini_set(), and the business requirement of these scripts being fully
portable installer scripts (tested so far successfully in Win XP/
Apache 1.33/PHP 5.2.0, Win XP/Apache 2.0.53/PHP 4.3.9, WinXP/Apache
2.0.53/PHP 5.0.4, Linux/Apache 2.0.54/PHP 4.3.9), what other last-
minute portable tricks would you suggest (other than the obvious:
changing php.ini, which I can't do on certain remote host services
this app will reside in)?

Phil

Jan 29 '07 #1
Share this Question
Share on Google+
8 Replies


P: n/a
comp.lang.php wrote:
I installed WAMP5 on my WinXP box which works just fine on its own,
and I found a practical way of handling my short-tag PHP script
via .htaccess:

php_flag short_open_tag on

To ensure my literally hundreds of PHP scripts will all function
within the WAMP5 architecture.

However, there is a case of a series of installer scripts written in
PHP that are not meant to be run except as CLI PHP that obviously will
not benefit from .htaccess, furthermore, changing the CLI PHP scripts
from short to long tags is very much not an option due to both the
volume of scripts and code complexity as patterns of '<' . '?..' or
"<" . "?.." or '<' . "?.." will exist within scripts alongside the
dynamic generation of other PHP scripts by other CLI PHP scripts.

Realizing that .htaccess is not usable for CLI PHP nor can I use
ini_set(), and the business requirement of these scripts being fully
portable installer scripts (tested so far successfully in Win XP/
Apache 1.33/PHP 5.2.0, Win XP/Apache 2.0.53/PHP 4.3.9, WinXP/Apache
2.0.53/PHP 5.0.4, Linux/Apache 2.0.54/PHP 4.3.9), what other last-
minute portable tricks would you suggest (other than the obvious:
changing php.ini, which I can't do on certain remote host services
this app will reside in)?

Phil
Hi Phil,

Are you using php-cgi.exe ?
If so type:
php-cgi.exe -h for help

It lists amongst others the -d option.
With this option you can tell PHP beforehand to set a certain value for
anything that you might encounter in php.ini, like short_open_tags.

If this does for you what you want, you only have to change the way you call
php-cgi instead of changing all the scripts.

Hope that helps.
Good luck. (Migrations are always a pain.)

Regards,
Erwin Moller

Jan 29 '07 #2

P: n/a


On Jan 29, 9:28 am, Erwin Moller
<since_humans_read_this_I_am_spammed_too_m...@spam yourself.comwrote:
comp.lang.php wrote:
I installed WAMP5 on my WinXP box which works just fine on its own,
and I found a practical way of handling my short-tag PHP script
via .htaccess:
php_flag short_open_tag on
To ensure my literally hundreds of PHP scripts will all function
within the WAMP5 architecture.
However, there is a case of a series of installer scripts written in
PHP that are not meant to be run except as CLI PHP that obviously will
not benefit from .htaccess, furthermore, changing the CLI PHP scripts
from short to long tags is very much not an option due to both the
volume of scripts and code complexity as patterns of '<' . '?..' or
"<" . "?.." or '<' . "?.." will exist within scripts alongside the
dynamic generation of other PHP scripts by other CLI PHP scripts.
Realizing that .htaccess is not usable for CLI PHP nor can I use
ini_set(), and the business requirement of these scripts being fully
portable installer scripts (tested so far successfully in Win XP/
Apache 1.33/PHP 5.2.0, Win XP/Apache 2.0.53/PHP 4.3.9, WinXP/Apache
2.0.53/PHP 5.0.4, Linux/Apache 2.0.54/PHP 4.3.9), what other last-
minute portable tricks would you suggest (other than the obvious:
changing php.ini, which I can't do on certain remote host services
this app will reside in)?
PhilHi Phil,

Are you using php-cgi.exe ?
If so type:
php-cgi.exe -h for help

It lists amongst others the -d option.
With this option you can tell PHP beforehand to set a certain value for
anything that you might encounter in php.ini, like short_open_tags.

If this does for you what you want, you only have to change the way you call
php-cgi instead of changing all the scripts.
Thanx, however, I was unaware that I was using php-cgi.exe as I have
been using what I thought was php.exe instead. Will have to see if
that has the same "-d" option, would save a lot of time and effort
were it to be so, thanx!

Phil

>
Hope that helps.
Good luck. (Migrations are always a pain.)

Regards,
Erwin Moller
Jan 29 '07 #3

P: n/a

"comp.lang.php" <ph**************@gmail.comwrote in message
news:11*********************@j27g2000cwj.googlegro ups.com...
|I installed WAMP5 on my WinXP box which works just fine on its own,
| and I found a practical way of handling my short-tag PHP script
| via .htaccess:
|
| php_flag short_open_tag on
|
| To ensure my literally hundreds of PHP scripts will all function
| within the WAMP5 architecture.
|
| However, there is a case of a series of installer scripts written in
| PHP that are not meant to be run except as CLI PHP that obviously will
| not benefit from .htaccess, furthermore, changing the CLI PHP scripts
| from short to long tags is very much not an option due to both the
| volume of scripts and code complexity as patterns of '<' . '?..' or
| "<" . "?.." or '<' . "?.." will exist within scripts alongside the
| dynamic generation of other PHP scripts by other CLI PHP scripts.

volume is not important, nor is the pattern complex. you will either look
for:

<?

or

<?=

i'd suggest making a script that recurses your directory structure that does
a regex replace on all the files where that pattern matches. i'd have made a
backup of all the files first, then after having done the replacements,
attempt to install it on a test computer and bang on its functionality until
you are satisfied everything is working properly.

this is where foresight would have come in handy...although i usually don't
fuss to much about short-tagging as, like i have suggested, the fix is
painfully easy.

hth,

me
Jan 29 '07 #4

P: n/a


On Jan 29, 9:45 am, "Steve" <no....@example.comwrote:
"comp.lang.php" <phillip.s.pow...@gmail.comwrote in messagenews:11*********************@j27g2000cwj.go oglegroups.com...
|I installed WAMP5 on my WinXP box which works just fine on its own,
| and I found a practical way of handling my short-tag PHP script
| via .htaccess:
|
| php_flag short_open_tag on
|
| To ensure my literally hundreds of PHP scripts will all function
| within the WAMP5 architecture.
|
| However, there is a case of a series of installer scripts written in
| PHP that are not meant to be run except as CLI PHP that obviously will
| not benefit from .htaccess, furthermore, changing the CLI PHP scripts
| from short to long tags is very much not an option due to both the
| volume of scripts and code complexity as patterns of '<' . '?..' or
| "<" . "?.." or '<' . "?.." will exist within scripts alongside the
| dynamic generation of other PHP scripts by other CLI PHP scripts.

volume is not important, nor is the pattern complex. you will either look
for:

<?

or

<?=
[snip]

Um, bad news, that's not all you're going to find in these installer
scripts. You're also going to find lines like this:

$php .= '<' . "?\n echo 'hello world'; ?" . '>';

And

if (preg_match('/<' . '\?/', $php)) // DO STUFF WITH $php CONTAINING
PHP CODE

Don't say I didn't warn you [re: "simplicity"]

Jan 29 '07 #5

P: n/a
"comp.lang.php" <ph**************@gmail.comwrote in message
news:11*********************@j27g2000cwj.googlegro ups.com...
php_flag short_open_tag on
and
the business requirement of these scripts being fully
portable installer scripts
....is just something you can't have. A set of scripts relying on short open
tags is not *fully portable*.

Sorry if this doesn't help you, but I just wanted to point out the obvious
flaw in this situation.

--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
sp**@outolempi.net | rot13(xv***@bhgbyrzcv.arg)
Jan 30 '07 #6

P: n/a

"Kimmo Laine" <sp**@outolempi.netwrote in message
news:dv**************@reader1.news.saunalahti.fi.. .
| "comp.lang.php" <ph**************@gmail.comwrote in message
| news:11*********************@j27g2000cwj.googlegro ups.com...
| php_flag short_open_tag on
|
| and
|
| the business requirement of these scripts being fully
| portable installer scripts
|
| ...is just something you can't have. A set of scripts relying on short
open
| tags is not *fully portable*.
|
| Sorry if this doesn't help you, but I just wanted to point out the obvious
| flaw in this situation.

and your obvious lack of reading comprehension skills. he was *describing*
the obvious and how to resolve the short tag problem. you also missed where
he said 'php_flag short_open_tag on' doesn't solve it on all servers...thus,
still not fully portable. if it were, then YES, it would be fully
portable...and it would be something he *COULD* have.

as it is, you only agree with the op that there is a problem. if you cannot
provide a solution, why waste everyone's time. 'captain, there's a hole in
the hull. yes scrub, there is.' a lot of good that does.

moron
Jan 30 '07 #7

P: n/a
On Jan 30, 5:56 am, "Kimmo Laine" <s...@outolempi.netwrote:
"comp.lang.php" <phillip.s.pow...@gmail.comwrote in message

news:11*********************@j27g2000cwj.googlegro ups.com...
php_flag short_open_tag on

and
the business requirement of these scripts being fully
portable installer scripts

...is just something you can't have. A set of scripts relying on short open
tags is not *fully portable*.

Sorry if this doesn't help you, but I just wanted to point out the obvious
flaw in this situation.
That can easily be overcome by this:

php -d short_open_tag=on -q /path/to/your/file.php

Kiitos!
>
--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpkhttp://outolempi.net/ahdistus/- Satunnaisesti päivittyvä nettisarjis
s...@outolempi.net | rot13(x...@bhgbyrzcv.arg)

Jan 31 '07 #8

P: n/a
DD


On 29 Jan 2007 06:02:30 -0800, "comp.lang.php"
<ph**************@gmail.comwrote:
>I installed WAMP5 on my WinXP box which works just fine on its own,
and I found a practical way of handling my short-tag PHP script
via .htaccess:


I've installed wamp 5 1.6.6. on winXP
for a testserver for learning php/mysql

it appears to be running
from the icon

I know that PHP is because localhost pops a page but

I get:

MySQL version :MySQL not launched or bad phpmyadmin config

Also:
from http://localhost/phpmyadmin/ i get a page with this error:

Welcome to phpMyAdmin 2.9.0.3

Error
MySQL said:

#2003 - The server is not responding

Anybod know how to get his up

Feb 12 '07 #9

This discussion thread is closed

Replies have been disabled for this discussion.