[PHP] PHP error tracking on new server
My hosting service recently switched to a newer server and in transporting the websites (many) over, they set up php different (vers 4.3.10). I know it's not nice to show errors on a published website, but I don't have a testing server, and I need to debug scripts once in a while. The problem is that when an error occurs, the page just comes up blank, and I have to practically pick it apart one line at a time to track down the problem. I tried ini_set('display_errors',TRUE); error_reporting(E_ERROR | E_WARNING | E_PARSE); but that doesn't seem to matter either. From phpinfo() it says display_errors is set off and error_reporting is 7. Any ideas on what flag may need to be set and how to do it on a file- by-file basis so I am only tweaking it when testing? Terry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] 404 Not Found - refresh to directory
An interesting idea. I'll work on this next week and see how it goes. Can I ask: why two versions of $uriparams? Terry -Original Message- From: Andras Kende [EMAIL PROTECTED] Sent: Jul 14, 2005 9:53 PM To: 'Terry Romine' [EMAIL PROTECTED], 'php' php-general@lists.php.net Subject: RE: [PHP] 404 Not Found - refresh to directory .htaccess: RewriteEngine on RewriteRule ^([\w-]+)$ index.php/$1 index.php: ?php $uriparams = explode(/,$REQUEST_URI); $uriparams = explode(?,$REQUEST_URI); $agent = $uriparams[0]; $agent = eregi_replace(/,,$agent); // Select from mysql where agent = agent etc.. etc.. echo (Location: agent_profile.php?agent=.$agent); ? Best regards, Andras Kende http://www.kende.com -- 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
[PHP] 404 Not Found - refresh to directory
I have a website that has several hundred agents in a mysql database. The client wants to be able to enter the domain.com/agentname and be redirected to a standard page where we show the agent information. An example would be an agent named John Smith whose agentname would be jsmith. So the user would enter domain.com/jsmith and get the agent's profile. I tried initially to dummy up a 404 page, where if the link was like: domain.com/jsmith that it would parse the agent name and pass it through to domain.com/agent_profile.php?agent=jsmith. It failed to work, ending up with a recursive call to the 404 page and getting hung. Right now, I have directories set up for each agent, with an index.php that does the redirect. It's really getting to be a mess with so many directories. I need to be able to check the mysql database for the agent name, and if found, do a redirect (header(Location: agent_profile.php?agent=agentID) and if not, continue to a standard 404 error page, or a sorry not found page. I think my question is: is there an easy way to use a 404 page written in php to capture the parameters from the missing page request and test against a db, resulting in either a valid page redirect or a not found redirect? Terry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: iPowerWeb ISP Are they good?
I had a client hosted on Powweb and I dropped that service pretty fast. Now I host primarily on eHostPros.com (past 2-3 years). I've had a few problems, but they work pretty close with the clients to handle issues. Maybe a 90-95% satisfaction rate for me. The nice thing is their billing system; they use PayPal and can charge monthly/quarterly/yearly as the customer needs. Terry -Original Message- From: chris [EMAIL PROTECTED] Sent: Jul 7, 2005 4:51 PM To: php-general@lists.php.net Subject: [PHP] Re: iPowerWeb ISP Are they good? I have used iPowerWeb for a few years now and have only had maybe 5 min. worth out outages. Even when I had a question on a Sunday, there was someone to answer the tech phone. It did take a while but still, its all good in my book. Chris Jason Manaigre [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi everyone, currently I have a site hosted with Powweb and suffice it to say, it's not good, so I wanted to get everyone's opinion here on iPowerWeb? Or can you recommend another ISP that you swear by which has similar features http://www.ipowerweb.com/products/webhosting/index.html Thanks people. -- 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] Register globals and ini_set
I'm having a serious pain with globals.. maybe someone can help. My major client moved her service from one server to another, and with it, PHP went from 4.1 to 4.2+. Register Globals was turned off, and when everything failed to work, tech support turned them back on via .htaccess. I'm planning to update the hundreds of scripts over the next weekend or so, but for right now, my $_SESSION['variable'] seem to be failing sporatically. It doesn't seem to make a difference whether I have session_start() at the top of the file or not. Shouldn't something like this work? ?php session_start(); $my_local=$_SESSION['global_var']; echo($my_local); ? where $global_var is set in one file and then used in another? Thanks for any help Terry -Original Message- From: Sebastian [EMAIL PROTECTED] Sent: Jul 8, 2005 6:42 AM To: [EMAIL PROTECTED] Cc: php-general@lists.php.net Subject: Re: [PHP] Register globals and ini_set if you have php = 4.2.3 yes, otherwise no. it has to be set in php.ini, .htaccess, or httpd.conf [EMAIL PROTECTED] wrote: Hi, If i use, at the beginning of my scripts, ini_set('register_globals', 0), register globals will be turned off? Thanks -- 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] Register globals and ini_set
I was setting the $_SESSION by: $_SESSION['var_name'] = this; or $my_local = this; $_SESSION['var_name'] = $my_local; I had stopped using session_register() some time back. Sporatically meaning that some of my variables are working fine, while others seem to become empty when referenced by a later script. These scripts were working fine on the older PHP version. I'm sure it's just a quick determination as to what to change, and then I can do a global update across the site. There are about 20-30 websites that this affects, so you can see my frustration in trying to do this by bits and pieces. I had done a test file like this: test1.php: ?php $_SESSION['check'] = test 1; echo($_SESSION['check']); ? a href='test2.php'Click/a and test2.php: ?php echo($_SESSION['check']); ? test1.php displays test1 but test2.php displays nothing. Terry -Original Message- From: Jason Barnett [EMAIL PROTECTED] Sent: Jul 8, 2005 9:15 AM To: php-general@lists.php.net Subject: Re: [PHP] Register globals and ini_set Since you mention the PHP version was old (4.1) then I have to ask: were you using the $_SESSION array all along or were you using session_register to register session variables? Although you probably aren't since that would be rather easy to debug. The script in which your global_variable was set makes absolutely no difference. PHP is just looking for the SID someplace anyways (whether that's COOKIE, GET or POST) and then it goes and retrieves that session that matches that SID. OK... when you say that it fails sporadically, what do you mean exactly? Probably, based on what you've just said, you're somehow assigning into your $_SESSION variables through the use of global variables that have the same name as your $_SESSION indexes. http://php.net/manual/en/ref.session.php#ini.session.bug-compat-42 -- NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php -- 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
[PHP] reg split address
I have a submit field that may have an address formatted like: 1234 main st or may just be the street name: main I need to split the number off if present so I can test against database fields. I need a eregi, split or preg_split that could do that. I've tried a few and either get the whole string in the first array element, or it fails to see the digits. if(eregi('[:digits:]+',$streetSearch,$streetArray)) die(num: $streetArray[0] name=$streetArray[1]); if(eregi('([\d]+) (.+)',$streetSearch,$streetArray)) die(num: $streetArray[0] name=$streetArray[1]); list($streetNum,$streetName)=split('(\d+) ',$streetSearch);die($streetNum); $streetArray=preg_split('/^(\d+) (.+)/',$streetSearch); die(street number: $streetArray[0] street name:$streetArray[1]); any help would be appreciated. Terry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] set global working??
Not quite a mystery, but I wondered if anyone could throw a couple of suggestions my way. My client's websites were moved last year from an old php server to a newer one. At that time, I had to upgrade all her scripts because set_globals were off on the new server, and so I went to using $_SESSION variables. All seemed to be doing fine until sometime last week when the scripts on a new website I am working on, being hosted on her server, started flaking out. Variables were becoming persistent, retaining previous values and refusing to change. I checked the php settings and found that the version running on the sever is 4.1.2 with globals on. That surprised me. I don't have admin access and would be cautious about trying to change this and possibly messing up someone else's site. Anyway, to test my theory, I created a simple script that turns session_start on and off. If session_start is off, variables work fine. With session_start on, variable will change once, and then refuse to change. I've attached the script. Does this indeed mean that I have to go through all my scripts and comment out session_start and convert my $_SESSION defines back?? Yeachh!! Terry ? if($pers) session_start(); // check for persistance if(!$ag) $ag=8; // set as default switch($ag){ case 8: $office=Modesto; break; case 7: $office=Livermore;break; case 9: $office=Fremont; break; case 10: $office=San Lorenzo; break; case 28: $office=Berkeley; break; case 25: $office=Mountain View; break; } if($switch) $pers=(!$pers); // switch persistence on/off ? div align=centerfont size=5 color=#00015d face=Verdanab?=$office?/b/font/div/td br / a href=check.php?ag=?=$ag?pers=?=$pers?switch=1Switch Persistence ?=$pers?/a br / a href=check.php?ag=7pers=?=$pers?Livermore/a a href=check.php?ag=8pers=?=$pers?Modesto/a a href=check.php?ag=9pers=?=$pers?Fremont/a a href=check.php?ag=10pers=?=$pers?San Lorenzo/a a href=check.php?ag=28pers=?=$pers?Berkeley/a br / -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Assist with session persistance
I have a site that is using $_SESSION['variablename'] for many variables that are loaded when the user first enters the site (index.php), and then referenced on each page (display.php): ex: index.php session_start(); $agencyID=9; $agencyName=fremont; $_SESSION['agencyID'] = $agencyID; $_SESSION['agencyName'] = $agencyName; ex: display.php session_start(); $agencyID=$_SESSION['agencyID']; $agencyName=$_SESSION['agencyName']; But after awhile, the session seems to fail and I end up back at the index page because the $agencyID gets voided. Is there a timeout on sessions other than closing the browser? If so, is there a way to set timeout if one doesn't have server admin access? Should I be doing something like: ex: display.php session_start(); $agencyID=$_SESSION['agencyID']; $agencyName=$_SESSION['agencyName']; $_SESSION['agencyID'] = $agencyID; $_SESSION['agencyName'] = $agencyName; to update the session variables with each page? Terry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] Re: [PHP] RE: [PHP-DB] Best way to check if a query succeeded
On Thursday, March 29, 2001, at 08:32 AM, Nick Davies wrote: Doesn't the command return 1 or 0 in success or failure? You may not have a result Probably wrong but something like if (mysql_query($query)) { } else { } What I understand is that the return from the query only tells you if the syntax is correct. NOT whether there were any records returned. That is what the mysql_num_rows gets you-- the number of records returned. Terry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] passing variables
I do this kind of thing all the time. Consider using hidden for the various values you are passing, and name the buttons "doAction" and set the values to "Add", "Delete", "View" ... Then the php file can do: switch($doAction) { case "Add": // your code break; case "Delete": // your code break; case "View": // your code break; } From: Ben Weinberger [EMAIL PROTECTED] Date: Sat, 03 Mar 2001 08:57:30 -0600 To: "george" [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] passing variables You could still use a form, but just have a very small one... something like: form method=post action="yourpage.html" input type=IMG name=REPLY value=submitimg src="ImageForReplies" input type=IMG name=DELETE value=submitimg src="ImageForDeletions" /FORM This would then pass any variables you wanted to the next page... -Ben At 03:49 PM 3/3/2001 +0100, Ernest E Vogelsinger wrote: At 15:41 03.03.2001, george said: [snip] I plan to add hidden fields for all the information pulled out the db my question is this how do you pass variables into the next page without using a form. can it be done say instead of a form there was a link next to each message which said view, clicking on this takes you to a page where you read the full mail, then there are another 2 links on for reply and one for delete.How could that be done [snip] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]