Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 05-06-2003, 11:42 AM   #1 (permalink)
bdl
Senior Contributor
 
Join Date: May 2002
Location: vta.ca.usa
Posts: 555
bdl is on a distinguished road
PHP as CGI??

Anyone familiar with using PHP as CGI? I've just about completed a good sized project for work, all the PHP is formatted to run pretty universally across versions of PHP4 and up, although I am using superglobals, all the code is usable with register_globals off. Everything has been developed and tested under Linux with PHP 4.1 and running as an Apache module. The server they want to move the scripts to is running Linux, PHP as CGI and it's V4.0.6. Any thoughts on problem areas? Obviously superglobals won't work with that version but are there any 'gotchas' about working in CGI mode vs Apache mod?
bdl is offline   Reply With Quote
Old 05-06-2003, 02:45 PM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,444
sde is on a distinguished road
i could be wrong, .. but i believe i developed on a cgi install on windows... it's been a while, but i don't think that it runs much different.
__________________
Mike
sde is offline   Reply With Quote
Old 05-07-2003, 06:48 AM   #3 (permalink)
Admin
$_['Your_Mom'];
 
Admin's Avatar
 
Join Date: May 2002
Location: Santee
Posts: 627
Admin is on a distinguished road
you need to escape ' & " in your variables, other than that i havent run into any problems
__________________


Urban Clothing
Admin is offline   Reply With Quote
Old 05-07-2003, 05:28 PM   #4 (permalink)
bdl
Senior Contributor
 
Join Date: May 2002
Location: vta.ca.usa
Posts: 555
bdl is on a distinguished road
Thanks for the replies, guys. I'm pretty dissapointed and pissed at this point because half of my scripts fail for some reason or other on the CGI server, gonna have to spend some quality time troubleshooting, and here I thought I was almost done!

One bizarre problem I have yet to figure out (of course I havent really looked into it or Googled it yet) is the fact that my includes are failing. I have one 'master' include file called 'all_func.php' that has three entries of other included files within. When I include that file, it works fine, but the includes within it fail. Example:
PHP Code:
<?
// somescript.php
include("./inc/all_func.php"); // works, but in itself fails and issues an error
include("./inc/header.php"); // works
echo 'somescript';
include(
"./inc/footer.php"); // works
?>
PHP Code:
<?
// all_func.php - 'master  include'
include("db_func.php"); // fails
include("misc_func.php"); // fails
?>
Other weirdness includes the fact that I'm getting index errors pertaining to $HTTP_POST_VARS['somevalue'], which never happened until I changed over to this old version. They do have register_globals on so I can't see where I'm losing any vars that way...

bdl is offline   Reply With Quote
Old 05-07-2003, 06:10 PM   #5 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,444
sde is on a distinguished road
what is your error reporting set to in your php.ini .. try this if it isn't setup:
Code:
error_reporting  =  E_ALL & ~E_NOTICE
it might just be reporting notices.
__________________
Mike
sde is offline   Reply With Quote
Old 05-07-2003, 08:17 PM   #6 (permalink)
bdl
Senior Contributor
 
Join Date: May 2002
Location: vta.ca.usa
Posts: 555
bdl is on a distinguished road
Quote:
Originally posted by sde
what is your error reporting set to in your php.ini .. try this if it isn't setup:
Code:
error_reporting  =  E_ALL & ~E_NOTICE
it might just be reporting notices.
Actually, that's exactly what it's set to. Aside from that, I've put

PHP Code:
error_reporting(E_ALL); 
at the top of my scripts.
bdl is offline   Reply With Quote
Old 05-07-2003, 08:30 PM   #7 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,444
sde is on a distinguished road
why do you put that at the top of yoru scripts .. notice the

~E_NOTICE

if you put "error_reporting(E_ALL);" at the top of every page ..then that cancels out the "~E_NOTICE" which means "dont' report notices .. just all other errors "

try to either take that errro_reporting() function off of the top of each page .. or add the ~E_NOTICE to it as well.
__________________
Mike
sde is offline   Reply With Quote
Old 05-08-2003, 07:56 AM   #8 (permalink)
bdl
Senior Contributor
 
Join Date: May 2002
Location: vta.ca.usa
Posts: 555
bdl is on a distinguished road
Ok, well so far, aside from removing error_reporting() from my scripts (thought it might be helpful in troubleshooting, apparently not), looks like most of it is working alright on the new server. I've got some issues with my SESSION code, but that can wait for now..
bdl is offline   Reply With Quote
Old 05-08-2003, 08:29 AM   #9 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,444
sde is on a distinguished road
the NOTICE messages are a pain in the ass. you must declare every variable before you use them to avoid notices. in a lot of the php installs, notices are enabled to report.. but older installs did not.

glad you got things working.
__________________
Mike
sde is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Comes of Age sde Code Newbie News 0 04-14-2004 11:41 AM
new to php jhoop2002 PHP 12 08-06-2003 02:45 PM
I need to learn PHP Nitro PHP 9 06-28-2003 11:24 AM
Php Vs. Asp sde PHP 6 06-06-2003 06:02 PM
PHP Command-Line Arguments? Antagony PHP 3 05-02-2003 12:26 PM


All times are GMT -8. The time now is 06:33 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting