Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP on Windows ini problems

Status
Not open for further replies.

Crundy

Programmer
Jul 20, 2001
305
GB
I can't seem to get PHP to parse either of the php.ini files that comes with PHP 5.2.5:

Running php -c . php.ini:

php.ini-recommended:
PHP Parse error: syntax error, unexpected T_LOGICAL_AND in C:\php\php.ini on line 126

php.ini-dist:
Parse error: syntax error, unexpected ',' in C:\php\php.ini on line 77

Removing all the comments below the initial
PHP:
 line just makes the above command list the php.ini file contents, which is usefull.

Any ideas?

C:\DOS:>
C:\DOS:>RUN
RUN DOS RUN!!
 
What are you trying to do ?
I think -c tells php were to find the php.ini file.
 
Oh right. My bad.

If I use a php.ini file then php doesn't parse my script.

e.g. if I rename my php.ini to php.ini.offline and then run
php test.php
then it correctly parses the php file. If I leave php.ini named correctly then the above command just lists the contents of the file without parsing it.

C:\DOS:>
C:\DOS:>RUN
RUN DOS RUN!!
 
So what is RUN then ?
Is it a .bat or .cmd file that calls php ??
can you list your code ?
I think everyone runs with a php.ini file and never have issues.
 
I think RUN is just his signature, not the real issue.

Anyway, I would first see what is in those lines its choking at, perhaps the PHP ini files have a missed ";" or something causing those problems.



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
yes i got that after I sent it (ho hum !!!)
Yes it's kind of basic stuff really, it looked like he was trying to run the .ini at one stage
 
Yes, I was trying to run the php.ini file initially :-( I thought -c was to parse the php.ini for errors.

Is there any way to check the php.ini file for errors?

I did try copying my working installation from other machine, but it still didn't work. Are there problems with php on Vista?

C:\DOS:>
C:\DOS:>RUN
RUN DOS RUN!!
 
Best bet is to post it here and see if any one sees anything wrong with but you do get an error saying line 77 so that should give you a clue, I reckon within +/- 5 lines.
If you can't see it post the file in
Code:
tags and someone should spot it.
Presume someone has prevously changed the file ?
 
why are you talking about errors in php.ini files? there are easy ways to discover these but it's rare that they exist

edit php.ini. if you're not sure where your actual ini file is, create a script with just <?php phpinfo(); ?> in it and run it.

in your php.ini file make sure that the following directives are set

Code:
error_reporting  =  E_ALL
display_errors = On
display_startup_errors = On
log_errors = On

and run your applications again. if there are any startup errors php will tell you what they are. if you get nothing meaningful check the system logs

you cannot 'run' the php.ini file - so don't try. it is not a proper php script file and will NEVER parse properly. it's not intended to.

and i also notice that you have not said what the actual problem is that you are facing. makes it difficult to help you.

remember also that php needs the file to be called php.ini. so you need to rename either the dist or the recommended templates. php will not, by default, assume any other name. it will just load itself up with default settings if it can't find a php.ini file in one of several different places (including the environment path).

remember also that you need to restart the webserver after making changes to php.ini (unless you are using CGI). store php.ini in the same directory as php and make sure that the access privileges are RW for the IUSR_[MACHINE NAME] account (assuming you are using IIS).

 
Ah, got it.
short_open_tag is now off by default, and all my scripts use e.g.
<? echo('test') ?>
etc.

Changed it to on and it works now. Live and learn.

Thanks for all your help.

C:\DOS:>
C:\DOS:>RUN
RUN DOS RUN!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top