[PHP] HEEELP...please
I absolutely cannot understand the include_path directive. Can somebody, please, explain this? I have a situation that I find absolutely incomprehensible: I moved my experimental web-site from FreeBSD 4.5 running php4 v. 4.0 (or something), apache 1.13 where thesite worked just fine to another box with FreeBSD 4.7 running php4 v. 4.2.3, apache 1.13.27_1. All of a sudden, I get the message: Warning: Failed opening '/../lib/somefile.conf' for inclusion (include_path='.:/usr/local/lib/php') in /usr/local/www/html/index.php on line 6 I can find nothing in the httpd.conf files that could account for this; there is no configuration in them for include_path. Obviously, the php file is being parsed correctly, but there is a problem with the line : include "$DOCUMENT_ROOT/../lib/somefile.conf". It works on one machine, but not on the latest version of php4 an apache. I see there are others on the net who have had this problem, but I have not yet found an explanation or a cure. HELP please, PJ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: HEEELP...please
I want to thank all those who made suggestions. All were helpful. Question: As my server is on LAN only, I could turn on the register_globals for debugging purposes etc. But, is the only way to turn register_globals on to uninstall and then reinstall mod_php4 with a modified php.ini file? Or is there another temporary solution until I can modify all my php files? PJ At 08:39 PM 1/9/2003 -0500, you wrote: $DOCUMENT_ROOT is now $_SERVER['DOCUMENT_ROOT'] unless register_globals is on. You need include $_SERVER['DOCUMENT_ROOT'].'/../lib/somefile.conf'; take care, Greg -- phpDocumentor http://www.phpdoc.org <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I absolutely cannot understand the include_path directive. > Can somebody, please, explain this? > I have a situation that I find absolutely incomprehensible: I moved my > experimental web-site from FreeBSD 4.5 running php4 v. 4.0 (or something), > apache 1.13 where thesite worked just fine to another box with FreeBSD 4.7 > running php4 v. 4.2.3, apache 1.13.27_1. > All of a sudden, I get the message: > Warning: Failed opening '/../lib/somefile.conf' for inclusion > (include_path='.:/usr/local/lib/php') in /usr/local/www/html/index.php on > line 6 > > I can find nothing in the httpd.conf files that could account for this; > there is no configuration in them for include_path. > > Obviously, the php file is being parsed correctly, but there is a problem > with the line : > include "$DOCUMENT_ROOT/../lib/somefile.conf". > > It works on one machine, but not on the latest version of php4 an apache. > > I see there are others on the net who have had this problem, but I have not > yet found an explanation or a cure. > > HELP please, > > PJ > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] HEEELP...please
At 12:01 PM 1/10/2003 +, you wrote: > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: 10 January 2003 01:00 > > All of a sudden, I get the message: > Warning: Failed opening '/../lib/somefile.conf' for inclusion > (include_path='.:/usr/local/lib/php') in > /usr/local/www/html/index.php on > line 6 > > I can find nothing in the httpd.conf files that could account > for this; > there is no configuration in them for include_path. Have you also checked in php.ini? -- that would seem to be a more likely place! The only php.ini files are in work directories for installation of mod_php4 and there is no reference to register_globals, which seems to be my problem (by default, php4.2 has register_globals = off) I suppose the only way to temporarily turn the globals on is by modifying the php.ini file. But I am not sure just what the directive should be... :(( Thanks for your help, PJ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: HEEELP...please
At 06:39 PM 1/10/2003 +0100, you wrote: Problem is - the only php.ini file is in a work directory for mod_php4 installation. As far as I know, this file would not be read by apache or the php module. I do get the feeling that the only way to turn the globals on is to reinstall the php module PJ only modify php.ini and restart the server (apache, not the computer), run as root: /etc/init.d/httpd restart [EMAIL PROTECTED] wrote: I want to thank all those who made suggestions. All were helpful. Question: As my server is on LAN only, I could turn on the register_globals for debugging purposes etc. But, is the only way to turn register_globals on to uninstall and then reinstall mod_php4 with a modified php.ini file? Or is there another temporary solution until I can modify all my php files? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: HEEELP...please
At 03:14 AM 1/11/2003 +0900, you wrote: [EMAIL PROTECTED] wrote: [snip] > Problem is - the only php.ini file is in a work directory for mod_php4 > installation. As far as I know, this file would not be read by apache > or the php module. [/snip] Run phpinfo() and see whether there's a reference to where the php.ini being used resides... Then, edit it accordingly (as somebody already mentioned). HTH, - E Duh, I feel a little stupid. I had not worked on my website for a while nor on php, so I forgot all that stuff. Turns out I had a test file already set up for this. :)) All is well now. thanks much. PJ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] global to superglobal
I have a database that was created on an earlier version of PostgreSQL and uses global variables with register_globals = on for php4. I have migrated the database to postgresql-7.3.1 with mod_php-4.2.3 and have set the register_globals to on. In order to use the default setting of register_globals = off, I need to reprogram my php files. I would appreciate some suggestions on how to go about modifying the code. Is there a script that could be run on each file to convert to the superglobals that would work with the register_globals off? I also need to know the exact syntax: for example, one current line is - include "$DOCUMENT_ROOT/../lib/somefile.conf"; Someone did suggest the following: include $_SERVER['DOCUMENT_ROOT'].'/../lib/somefile.conf'; however, there is a difference in the use of the quotation marks and I do not understand the use of the . and .. Could someone explain, please? PJ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] global to superglobal
At 04:16 AM 1/12/2003 +0800, you wrote: On Sunday 12 January 2003 03:45, [EMAIL PROTECTED] wrote: > I have a database that was created on an earlier version of PostgreSQL and > uses global variables with register_globals = on for php4. > I have migrated the database to postgresql-7.3.1 with mod_php-4.2.3 and > have set the register_globals to on. In order to use the default setting of > register_globals = off, I need to reprogram my php files. > I would appreciate some suggestions on how to go about modifying the code. > Is there a script that could be run on each file to convert to the > superglobals that would work with the register_globals off? If only it was that easy ;) That should be: "If only it were that easy" - subjunctive, :)) sorry, it's my English studies that keep coming back at me The best thing to do is crank up error reporting to maximum (errors AND notices). You should see a lot of undefined or uninitialized variables notices/warnings. Find out where those variables are coming from (GET, POST or whatever) and change them appropriately. Eg you have a form with method=POST and a single text element called 'name'. Instead of using just $name in your code you need to use $_POST['name']. > I also need to know the exact syntax: for example, one current line is - > > include "$DOCUMENT_ROOT/../lib/somefile.conf"; > > Someone did suggest the following: > > include $_SERVER['DOCUMENT_ROOT'].'/../lib/somefile.conf'; > > however, there is a difference in the use of the quotation marks and I do > not understand the use of the . and .. It used to be that $DOCUMENT_ROOT was a predefined variable in the global scope. Thus you could use it directly in a string like in your first statement. Now DOCUMENT_ROOT can only be obtained from the $_SERVER array. Between strings and variables the period (.) acts as a concatenation operator. The second statement can be reformatted to make it clearer: $_SERVER['DOCUMENT_ROOT'] . '/../lib/somefile.conf'; Hopefully you can clearly see that the left side is equivalent to $DOCUMENT_ROOT and the right side is just a string. The '..' in the string on the right has nothing to with PHP, it's just the standard way to denote the parent directory. Single-quoted strings are literal strings, double-quoted strings does variable expansion. The second statement can also be rewritten as: "{$_SERVER['DOCUMENT_ROOT']}/../lib/somefile.conf"; Thanks, Jason. This helps somewhat. Most of the variables should be fairly obvious, I should think. So, it should not be too difficult to do some search & replace of stuff like the $_SERVER['DOCUMENT_ROOT'] stuff. I suppose I could then try to run the stuff with error reporting maxed out. Does that seem about right or should I start with the error reports and go at it one by one. Being terribly lazy, I suppose makes me want to find shortcuts. I understand laziness is also a sign of genius... :)) PJ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php