Thanks ken_yap! The location of the error log was something I wanted to find.
php -l yourscript.php
This gave a response: command not found. It must be a php-configuration problem?
This brings us back to the question of the correct location of the php.ini -file. Is it really /etc/php5/apache2/php.ini ?
Shouldn’t the PATH variable refer to the location of any command? Typing echo $PATH shows me the PATH variable, but “/etc/php5/apache2” is not included.
Is there a php.ini -file somewhere else (I found a file called php.ini also in /etc/php5/fastcgi). In /etc/php5/conf.d there are a whole lot of *.ini -files. Should my php.ini also reside there?
(I have quite recently configured my SUSE 10.1, and there are a lot of commands which do not work. For instance “locate”, which would be quite useful)
First, the command is ‘php5’ I believe, or at least it is on my box.
The ‘command now found’ error coming from bash means that the command
you tried (‘php’) and nothing else (ini files or whatever) was not found
in the $PATH (because you didn’t specify a full path to the file). This
is fine… but means that any efforts you spend on your various ‘ini’
files will be completely futile, so first focus on the problem. The
command wasn’t found… in your case I’m guessing it’s the wrong command
so try ‘php5’.
Second issue you brought up… $PATH should ONLY point to binaries that
should be executable without a path. Does that mean every binary on
your system? Definitely not. For example regular users don’t have
/sbin in their path because most commands in /sbin are for ‘root’ so
that is in the ‘root’ user’s path only, by default. That doesn’t mean
you can’t try to run things in there as anybody else, you just need to
specify the path to the file. Having $PATH refer to every location on
the system that there COULD be a binary will destroy system performance
as it searches through every path looking for files to run.
Continuing on this, this has nothing to do with any other file type on
the system… $PATH won’t ever affect finding anything but a binary
that is called with no path like ‘php’ is on the beginning of your line.
Regarding the location of the files… /etc/php5/apache2/php.ini is the
correct path for php.ini for Apache. There is also, I believe, a
version for command-line execution in /etc/php5/cli/php.ini that can be
configured on its own.
Should php.ini reside in other places? No… you may want to start by
checking the php.ini syntax documentation to see why.
Other commands not working… are they installed? What are you trying
to do? Should they work? ‘locate’ can work if it’s installed…
‘locate’ comes with the ‘findutils’ package which you can install via Yast.
Good luck.
tikitin wrote:
> Thanks ken_yap! The location of the error log was something I wanted to
> find.
>
>>
>> php -l yourscript.php
>
> This gave a response: command not found. It must be a php-configuration
> problem?
> This brings us back to the question of the correct location of the
> php.ini -file. Is it really /etc/php5/apache2/php.ini ?
>
> Shouldn’t the PATH variable refer to the location of any command?
> Typing echo $PATH shows me the PATH variable, but “/etc/php5/apache2” is
> not included.
>
> Is there a php.ini -file somewhere else (I found a file called php.ini
> also in /etc/php5/fastcgi). In /etc/php5/conf.d there are a whole lot of
> *.ini -files. Should my php.ini also reside there?
>
> (I have quite recently configured my SUSE 10.1, and there are a lot of
> commands which do not work. For instance “locate”, which would be quite
> useful)
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
I installed a SoL Linux server some 4-5 years ago and since then I have had no need whatsoever to deal with $PATH and all that. The trouble has been, that the **** machine is so noisy, that my girlfriend is not able to sleep with the server running in the same room. So I decided to get a new, more silent machine and installed SuSE this time and decided to upgrade PHP. I firmly believe that SuSE and PHP5 are going to be my dear and reliable friends for at least next four or five years, as soon as I get them running smoothly.
Meanwhile I’m afraid I’m going nuts.
Elaborating a question to a forum is often a very instructive experience. Four messages out of five will never be sent, because during the process of writing I often find the solution myself. But sometimes I press the “send” -button too hastily. This happened now with the “locate” -problem. Immediately after posting the message I went to YaST and found out that “locate” wasn’t installed. I installed it and soon found also that third php.ini -file in
/etc/php5/cli -directory. I wanted to edit that last sentence out from my message, but could not find “edit” button quickly enough…
Anyway, thanks for the lesson on the $PATH. You were much clearer than anything I found in the manuals. Most of the stuff I should’ve known. I guess it is just early dementia.
Still, my original problem prevails. Now I have learned to use command “php5 -l myscript.php” to see the possible parse errors beforehand. And I can find the errors in the error log. But what on earth should I do with the php.ini -file to show the parse errors right on the browser page.
“error_reporting = E_ALL” has been like this by default, and I have uncommented “display_errors” and changed it to “On” in all three php.ini -files (though I assume that only the one in “apache2” is the one that counts). But I keep getting a blank page!!! Don’t tell me I should give up. It’s not in my nature.
For testing create a new webpage that just has the following:
<?php
phpinfo();
?>
and load that in your web browser. Once you have that loaded look at
the settings you are trying to load. Once done make your changes to the
files or set the parameters before calling phpino() and make sure you
see those changing at that time. If you are modifying your ini files be
sure you are reloading Apache each time as I believe they are only
loaded at load time.
Good luck.
tikitin wrote:
>> Yikes… no no no…
>
> Thanks, I humbly receive the scorn…I’m blushing…
>
> I installed a SoL Linux server some 4-5 years ago and since then I have
> had no need whatsoever to deal with $PATH and all that. The trouble has
> been, that the **** machine is so noisy, that my girlfriend is not able
> to sleep with the server running in the same room. So I decided to get a
> new, more silent machine and installed SuSE this time and decided to
> upgrade PHP. I firmly believe that SuSE and PHP5 are going to be my
> dear and reliable friends for at least next four or five years, as soon
> as I get them running smoothly.
>
> Meanwhile I’m afraid I’m going nuts.
>
> Elaborating a question to a forum is often a very instructive
> experience. Four messages out of five will never be sent, because during
> the process of writing I often find the solution myself. But sometimes I
> press the “send” -button too hastily. This happened now with the
> “locate” -problem. Immediately after posting the message I went to YaST
> and found out that “locate” wasn’t installed. I installed it and soon
> found also that third php.ini -file in
> /etc/php5/cli -directory. I wanted to edit that last sentence out from
> my message, but could not find “edit” button quickly enough…
>
> Anyway, thanks for the lesson on the $PATH. You were much clearer than
> anything I found in the manuals. Most of the stuff I should’ve known. I
> guess it is just early dementia.
>
> Still, my original problem prevails. Now I have learned to use command
> “php5 -l myscript.php” to see the possible parse errors beforehand. And
> I can find the errors in the error log. But what on earth should I do
> with the php.ini -file to show the parse errors right on the browser
> page.
>
> “error_reporting = E_ALL” has been like this by default, and I have
> uncommented “display_errors” and changed it to “On” in all three php.ini
> -files (though I assume that only the one in “apache2” is the one that
> counts). But I keep getting a blank page!!! Don’t tell me I should give
> up. It’s not in my nature.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
Hmm, on 11.0 /usr/bin/php is a symlink to /etc/alternatives/php which is a symlink to /usr/bin/php5. I believe it has been so for a few versions now, except that in older distro versions, it could also point to /usr/bin/php4. Anyway I leave it to you to find out why you don’t have a symlink called php.
As for error reporting, I changed the line in /etc/php5/apache2/php.ini to
display_errors = On
and then reloaded apache2 with
/etc/init.d/apache2 reload
which then obligingly showed me the result of a deliberate parse error on the web page. So, did you reload apache2 after editing the ini file?