PHP - The Used Command Is Not Allowed With This Mysql Version
I am not very proficient at MySQL so this came as a shock today. I have moved an entire set of scripts from one machine to another and after ironing out some of the kinks I was hit this error "The used command is not allowed with this MySQL version" and just when I thought it was all over with. LOL
This is the command being run...
load data local infile './AM.dat' into table AM fields terminated by '|';
Similar TutorialsGood Day
I have a bit of an issue with my website I loaded on my domain.
I am getting an error:
SQLSTATE[HY000] [1130] Host 'xxx.xxx.xx.xxx' is not allowed to connect to this MySQL server
Can some one please explain to me in detail how do fix this?
It only shows on my Sale and Rent pages
According to I have a project need to use PHP 5.6.40 connect to mysql version 5.7.34
when I try to connect it by below coding $servername = "localhost"; $username = "user"; $password = "pass"; $db_database = 'db_unelr'; $db_port = '3306'; // Create connection $conn = mysqli_connect($servername, $username, $password,$db_database,$db_port); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } echo "Connected successfully";
it's show 500 internal error.
I have PHP and MYSQL Web Development Fourth Edition by Luke Welling and Laura Thompson I am on Chapter 9 Creating Your Web Database on Page 230 my -h host -u bookorama -D boos -p < bookorama.sql I have been tring to make this code work for 3 weeks and no luck. Can anybody Help Me on this line. They are not clear enough on this line but the book is an awesome book, learning alot. Hi I have tried the mysql forum but have had no joy with an answer to my problem so wondered if php would be better. I want my users to be able to select from 5 different drop down lists where they can chose any combination from 1 up to all 5, I have attached the front end. These lists are being populated from mysql tables. Code for the drop down lists is as follows Code: [Select] <form action="horse-events-devon.php?url_countyid=<?php echo urlencode ($url_countyid ['url_countyid']) ; ?>&go" method="POST"> <table id="searchtable"> <tr> <th>Find By Discipline</th> <th>Find By Venue</th> <th>Find By Championship</th> <th>Find By Organiser</th> <th>Equine Association</th> <th>Submit Your Selections</th> </tr> <tr> <td><select name="dis_id"> <?php $upcomingdis = upcomingdis($url_countyid); $upcoming_dis_bycounty = mysql_fetch_assoc ($upcomingdis); ?> <?php do { ?> <option value="<?php echo $upcoming_dis_bycounty ['dis_id']; ?>" > <?php echo $upcoming_dis_bycounty ['dis_description']; ?></option> <?php } while ($upcoming_dis_bycounty = mysql_fetch_assoc ($upcomingdis)); ?></select></td> <td><select name="ven_id"> <?php $upvenbycounty_set = upcoming_venevents_bycounty($url_countyid); $upcoming_ven_bycounty = mysql_fetch_assoc ($upvenbycounty_set); ?> <?php do { ?> <option value="<?php echo $upcoming_ven_bycounty ['ven_id']; ?>" > <?php echo $upcoming_ven_bycounty ['ven_name']; ?></option> <?php } while ($upcoming_ven_bycounty = mysql_fetch_assoc ($upvenbycounty_set)); ?></select></td> <td><select name="champ_id"> <?php $championship_set = findchampionships(); $champlist = mysql_fetch_assoc ($championship_set); ?> <?php do { ?> <option value="<?php echo $champlist ['champ_id']; ?>" > <?php echo $champlist ['champ_description']; ?></option> <?php } while ($champlist = mysql_fetch_assoc ($championship_set)); ?></select></td> <td> <select name="org_id"> <?php $uporgbycounty_set = upcoming_organevents_bycounty($url_countyid); $upcoming_org_bycounty = mysql_fetch_assoc ($uporgbycounty_set); ?> <?php do { ?> <option value="<?php echo $upcoming_org_bycounty ['org_id']; ?>" ><?php echo $upcoming_org_bycounty ['org_name']; ?></option> <?php } while ($upcoming_org_bycounty = mysql_fetch_assoc ($uporgbycounty_set)); ?></select> </td> <td><select name="ass_id"> <?php $upassbycounty_set = upcoming_assevents_bycounty($url_countyid); $upcoming_assbycounty = mysql_fetch_assoc ($upassbycounty_set); ?> <?php do { ?> <option value="<?php echo $upcoming_assbycounty ['ass_id']; ?>" > <?php echo $upcoming_assbycounty ['ass_description']; ?></option> <?php } while ($upcoming_assbycounty = mysql_fetch_assoc ($upassbycounty_set)); ?></select></td> <td><input name="submit" type="submit" /><input name="countyid" type="hidden" value="<?php echo $url_countyid ['url_countyid']; ?>" /></td> </tr> </table> </form> My search processing is as follows Code: [Select] <?php if (isset($_POST['submit'])){ if (isset($_GET['go'])){ $countyid = $_POST['countyid']; $ven_id = $_POST['ven_id']; $dis_id = $_POST['dis_id']; $champ_id = $_POST['champ_id']; $org_id = $_POST['org_id']; $event_id = $row['event_id']; $sql = "SELECT DATE_FORMAT (events.startdate, '%a, %d, %b') AS stdate, events.event_id, events.title, events.ven_id, events.org_id, venue.county_id, venue.ven_id, eventdisciplines.event_id, eventdisciplines.dis_id, county.county_id, discipline.dis_id \n" . "FROM events \n" . "LEFT OUTER JOIN eventdisciplines \n" . "ON events.event_id = eventdisciplines.event_id \n" . "LEFT OUTER JOIN discipline \n" . "ON eventdisciplines.dis_id = discipline.dis_id \n" . "LEFT OUTER JOIN venue \n" . "ON events.ven_id = venue.ven_id \n" . "LEFT OUTER JOIN county \n" . "ON venue.county_id = county.county_id \n" . "WHERE events.ven_id = ({$ven_id} OR events.org_id = {$org_id})\n" . "AND events.startdate > NOW()\n" . "AND venue.county_id = {$countyid} \n" . "ORDER BY startdate ASC"; $result = mysql_query ($sql, $connection); ?> How am I best to do this please? my OR within the mysql does not work, should I not be doing this with php in the search processing? someones help would really be appreciated, just to point me in the right direction. [attachment deleted by admin] Hi all, But of a PHP newbie so treat me nice but this one is driving me nuts I have the exact same login.php file running on two different servers and they have slightly different versions of PHP installed as follows: 1. PHP Version 5.0.4 - version http://www.trafficpaymaster.com/tpm/phpversion.php 2. PHP Version 5.2.15 - version http://www.dentistsinflorida.org/tpm/phpversion.php The login works fine on the first server from he http://www.trafficpaymaster.com/tpm/login.php Email: test@test.com Pwd: test But try it on the second server he http://www.dentistsinflorida.org/tpm/login.php Using the same email and password (which is correct) it just loops round not letting the user into the main script at index.php Question: Why? What have I got wrong for that later version of PHP? Many thanks guys. I have been looking at this code most of the morning and do not have a clue what is wrong with the code. I am hoping its not a stupid mistake, can someone please help me out? thank you
<title>Inputing Travel Detials</title> <header> <h1 align="center"> Adding Travel Detials </h1> <body> <p> <center><img src="cyberwarfareimage1.png" alt="Squadron logo" style="width:200px;height:200px" style="middle"></center> <table border="1"> <tr> <td><a href="index.php"> Home Page </a></td> <td><a href="administratorhomepage.html">Administrator Home Page </a></td> <td><a href="viewhomepage.html">View Home Page </a></td> <td><a href="Inputhomepage.html">Input Home Page </a></td> <td><a href="traveldetials.html">Enter More Travel Detials </a></td> </table> </p> <?php include "connection.php"; $Applicant_ID = $_POST["Applicant_ID"]; $Method_Of_Travel = $_POST["Method_Of_Travel"]; $Cost = $_POST["Cost"]; $ETA = $_POST["ETA"]; $Main_Gate_Advised = $_POST["Main_Gate_Advised"]; $query = ("UPDATE `int_board_applicant` SET `Method_Of_Travel`=`$Method_Of_Travel', `Cost`=`$Cost', `ETA`='$ETA', `Main_Gate_Advised`='$Main_Gate_Advised' WHERE `Applicant_ID`='$Applicant_ID'"); $result = mysqli_query($dbhandle, $query) or die(mysqli_error($dbhandle)); if($result){ echo "Success!"; } else{ echo "Error."; } // successfully insert data into database, displays message "Successful". if($query){ echo "Successful"; } else { echo "Data not Submitted"; } //closing the connection mysqli_close($dbhandle) ?> Ok this is puzzleing. I am geting "Could not delete data: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1". but its is deleting the entry that needs to be removed. The "1" is the entry. Just not sure what is causing the error. I do have another delete php but I have put that on the back burning for the time being.
<?php $con = mysqli_connect("localhost","user","password","part_inventory"); // Check connection if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } else { $result = mysqli_query($con, "SELECT * FROM amp20 "); $amp20ptid = $_POST['amp20ptid']; // escape variables for security $amp20ptid = mysqli_real_escape_string($con, $_POST['amp20ptid']); mysqli_query($con, "DELETE FROM amp20 WHERE amp20ptid = '$amp20ptid'"); if (!mysqli_query($con, $amp20ptid)); { die('Could not delete data: ' . mysqli_error($con)); } echo "Part has been deleted to the database!!!\n"; mysqli_close($con); } ?> Hi guys
I have this code below and all works fine when submitting this online application apart from when someone types either ' # & into one of the comment fields in which it throws up the error. Have tried various fixes from across the internet but no joy. Can anyone offer suggestions?
<?php
$con = mysql_connect("localhost:3306","root","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db('sfapp', $con);
$sql="INSERT INTO 'sfapp' ('surname_add','forename_add','dob_add','hometele_add','mobiletele_add','homeadd_add','siblings_add','schoolname_add','headname_add','schooladd_add','schooltele_add','schoolem_add','alevel_add','personstate_add','nameprovided_add','pe_add','se_add','PredGrade_Art','PredGrade_AScience','PredGrade_BusStudies','PredGrade_Electronics','PredGrade_EnglishLang','PredGrade_EnglishLit','PredGrade_French','PredGrade_German','PredGrade_Geog','PredGrade_Graphics','PredGrade_History','PredGrade_Maths','PredGrade_SepScience','PredGrade_ProductDesign','PredGrade_Spanish','PredGrade_Other','Gender_Male','Gender_Female','Sub_EnglishLit','Sub_Maths','Sub_FurtherMaths','Sub_Biology','Sub_Chemistry','Sub_Physics','Sub_French','Sub_German','Sub_Spanish','Sub_Geography','Sub_History','Sub_RE','Sub_FineArt','Sub_Business','Sub_Computing','Sub_GlobPersp','Sub_DramaAndTheatre','Sub_PE','Sub_Dance','Sub_Politics','Sub_Psychology','Sub_Sociology','readprospect_chk','Sib_Yes','Sib_No','Current_Student_Yes','Current_Student_No','I_Understand_chk','Current_Education_chk','Local_Care_chk','Staff_Cwhls_chk','Sub_Film')
VALUES
('$_POST[surname_add]','$_POST[forename_add]','$_POST[dob_add]','$_POST[hometele_add]','$_POST[mobiletele_add]','$_POST[homeadd_add]','$_POST[siblings_add]','$_POST[schoolname_add]','$_POST[headname_add]','$_POST[schooladd_add]','$_POST[schooltele_add]','$_POST[schoolem_add]','$_POST[alevel_add]','$_POST[personstate_add]','$_POST[nameprovided_add]','$_POST[pe_add]','$_POST[se_add]','$_POST[PredGrade_Art]','$_POST[PredGrade_AScience]','$_POST[PredGrade_BusStudies]','$_POST[PredGrade_Electronics]','$_POST[PredGrade_EnglishLang]','$_POST[PredGrade_EnglishLit]','$_POST[PredGrade_French]','$_POST[PredGrade_German]','$_POST[PredGrade_Geog]','$_POST[PredGrade_Graphics]','$_POST[PredGrade_History]','$_POST[PredGrade_Maths]','$_POST[PredGrade_SepScience]','$_POST[PredGrade_ProductDesign]','$_POST[PredGrade_Spanish]','$_POST[PredGrade_Other]','$_POST[Gender_Male]','$_POST[Gender_Female]','$_POST[Sub_EnglishLit]','$_POST[Sub_Maths]','$_POST[Sub_FurtherMaths]','$_POST[Sub_Biology]','$_POST[Sub_Chemistry]','$_POST[Sub_Physics]','$_POST[Sub_French]','$_POST[Sub_German]','$_POST[Sub_Spanish]','$_POST[Sub_Geography]','$_POST[Sub_History]','$_POST[Sub_RE]','$_POST[Sub_FineArt]','$_POST[Sub_Business]','$_POST[Sub_Computing]','$_POST[Sub_GlobPersp]','$_POST[Sub_DramaAndTheatre]','$_POST[Sub_PE]','$_POST[Sub_Dance]','$_POST[Sub_Politics]','$_POST[Sub_Psychology]','$_POST[Sub_Sociology]','$_POST[readprospect_chk]','$_POST[Sib_Yes]','$_POST[Sib_No]','$_POST[Current_Student_Yes]','$_POST[Current_Student_No]','$_POST[I_Understand_chk]','$_POST[Current_Education_chk]','$_POST[Local_Care_chk]','$_POST[Staff_Cwhls_chk]','$_POST[Sub_Film]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
?>
<?php
//if "email" variable is filled out, send email
if (isset($_REQUEST['pe_add'])) {
//Email information
$admin_email = $_REQUEST['pe_add'];
$forename = $_REQUEST['forename_add'];
$email = "autoreply@testing.com";
$subject = "Application";
$desc =
"Dear $forename
Thank you for submitting your online application, we will be in touch shortly.
"
;
//send email
mail($admin_email, "$subject", "$desc", "From:" . $email);
//Email response
echo "Thank you for contacting us!";
}
//if "email" variable is not filled out, display the form
else {
?>
If you are seeing this, you need to go back and fill out the Personal Email section!
<?php
}
header("location:complete.php");
mysql_close($con)
?>
Thanks in advance.
What file size is allowed with this code?
if (@$_POST['submit'] != "") { $allowed_ext = array("gif", "jpeg", "jpg", "png", "pdf", "doc", "docs", "zip", "flv", "mp4"); $extension = end(explode(".", $_FILES["file"]["name"])); if (($_FILES["file"]["size"] < 524288000) && in_array($extension, $allowed_ext)) { I'm having real difficulty with something that should simply work... I've got a script that reads files within a specific folder defined elsewhere. Then it returns the filenames (image files) to an array. Relatively simple, you'd think... Here's the process loop : Code: [Select] // Read directory for images @$dh = opendir($img_dir); while (false !== (@$filename = readdir($dh))) { if (($filename == '.') || ($filename == '..') || ($filename == 'Thumbs.db')) { } else { $files[] = $filename; } } There is a maximum of 4 images in each folder. This process will run once per page load. I have checked my php settings: memory_limit 256M post_max_size 64M upload_max_filesize 62M (just for good measure). IMHO 256m works for another site I developed which processes up to three images using imagemagick, and I've tested this with a 4mb png file too.... Yet I get this error : Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 35 bytes) in F:\html\bishopstrings\components\com_content\views\article\tmpl\default.php on line 43 This is telling me it's trying to allocate 35bytes when there is 268435456 bytes available... Yet this fails - any help I need to strip some html tags out of an uploaded string of code. I need to keep the <td> tags...but some code that is being uploaded include <p> tags INSIDE the <td> tag.
How would I go about stripping ALL other tags inside these allowed tags: <td> <tr><table>
I apologize if this isn't the exact right location for this question, but it's the best place I could find. I work for a small business and the server hosting our website recently disabled FormMail. We no longer have a webdesigner per se and I've been the one taking care of the website. Unfortunately the few programming classes I've taken have mostly left me by now and I'm banging my head against the wall trying to find a way to get back our multiple feedback forms. I'm sure the best thing would be to hire someone, but business hasn't been great and the boss is counting on me, so I'm hoping someone here may have some suggestions. I've been corresponding with our server trying to get some suggestions on what to do and this is the best they've been able to tell me; "The reason being that Shared Servers must have the ability for php/cgi to send mail disabled as a protection against darkmailer, so any form or scripts that would send mail must be able to authenticate itself to the server as a valid user." "If you can find a method to send the mail without php/cgi, or one that does go through the steps to authenticate as a valid user (specifically, as you), then we can probably get you all set up." "The only option at this point would be to correct your script to authenticate as a valid email user." "...you would need to change your scripts to login with a mail user to authenticate and send mail." Now I'm not completely programming illiterate; I mean, I passed my classes in college, but I can't figure out how to do this. They say they don't allow any FormMail or FormMail Clones, so I'm fairly lost. If anyone has any helpful hints or suggestions I would appreciate it greatly. Thanks, Zach Hey guys...I have a php that loads when the user is being taken after making a purchase. On that php file, echo and print are disabled...and I need to send a variable from that php file to flash, doesnt matter is flash, could be other php file, html, anyway... <param name="movie" value="retorno.swf?userId=<?php echo $Referencia; ?>" /> On the example above I am using echo $Referencia...I need some function to substitue echo/print... Any ideas??? Thanks in advance! Hello, I have no experience when dealing with large files so I am not sure what to do about this. I have attempted to read several large files using file_get_contents ; the task is to clean and munge them using preg_replace(). My code runs fine on small files ; however, the large files (40 MB) trigger an Memory exhausted error: Code: [Select] PHP Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 41390283 bytes) I was thinking of using fread() instead but I am not sure that'll work either. Is there a workaround for this problem? Thanks for your input. Al. Hello guys, I'm new in php and now I'm trying to make an php installer Right now it compress php project/dump database with gzip in a file called install.php and the idea is when the user run install.php in his browser he can choose directory, overwrite existing file etc... The problem is that when I try to run install.php in firefox I get this error: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 134217728 bytes) in Unknown on line 0 and when I run it with chrome I get this: <code> <?php //Compressed with Php Installer 0.5 //Directory list $directory = array(); $directory['C:\xampp\htdocs\magnatest'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/3dtags/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/__grundlayout/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/__grundlayout/bilder/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/actions/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/admin/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/admin/images/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/admin/images/customize/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/admin/jpgraph/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/admin/jpgraph/lang/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/attachments/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/attachments/process/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/cache/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/cache/ideas/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/cache/ideas/idea_0000002/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/cache/ideas/idea_0000007/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/cache/ideas/idea_0000015/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/cache/ideas/idea_0000019/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/cache/ideas/idea_0000026/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/cache/ideas/idea_0000028/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/cache/ideas/idea_0000029/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/cache/ideas/idea_0000030/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/cache/ideas/idea_0000031/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/cache/ideas/idea_0000034/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/cache/ideas/idea_0000035/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/cache/ideas/idea_0000062/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/cache/ideas/idea_0000064/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/cache/ideas/idea_0000065/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/cache/ideas/idea_0000068/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/cache/ideas/idea_0000070/'] = array( 'perms' => 16895 ); $directory['C:\xampp\htdocs\magnatest/cache/ideas/idea_0000072/'] = array( 'perms' => 16895 ); ................................................. .... ................................................. ............ ................................................. </code> Can anyone tell me what might be the problem ? Is it a memory size problem ? This topic has been moved to PHP Freelancing. http://www.phpfreaks.com/forums/index.php?topic=331336.0 hello dear php-freaks
well this is just a question that came up to my mind today:
can we put amazon-customer reviews on private websites just ran across this statement: aybe. I wrote the original answer below earlier. I don't have time to look into this right now because I'm no longer on a project concerned with Amazon reviews, but their webpage at Product Advertising API states "The Product Advertising API helps you advertise Amazon products using product search and look up capability, product information and features such as Customer Reviews..." as of 2011-12-08. So I hope someone looks into it and posts back here; feel free to edit this answer. derived he https://stackoverflo...9451851#9451851 so what is the case: just let us know ? Well there are some plugins out there that do that: eg. for wordpress we can use ScrapeAZon. I guess that it does exactly what many many are loooking for. cf https://wordpress.or...on/screenshots/ On a shortnote: probably it is not allowed in some states - in others it probalby will be allowed. What do you say.. Code what i made so far.
$inputText = 'This is testing http://www.youtube.com'; $allowedDomains = 'www.google.com youtube.com/ http://www.test.org'; $array = preg_split('/[\s]+/', $allowedDomains); $regex = '';//Need this line if(preg_match($regex, $inputText)){ print 'Domain match!'; }else{ print 'Domain not match!'; } Edited by jacob21, 16 October 2014 - 08:31 AM. Hi again, I did a simple request and i get right response from curl_exec($ch); but when i call the static method str_get_html my result is always the same. QuoteFatal error: Allowed memory size of 536870912 bytes exhausted I tried increase the memory memory_limit=2048M but the result is the same. Proof of memory limit: Memory Limit I also tried ->clear(); unset(); but doesn't work. I'm using the following library: kub-at/php-simple-html-dom-parser My code: $url = "https://www.php.net"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, []); $this->callback = HtmlDomParser::str_get_html(curl_exec($ch)); .... Any tips? I can use regular expression, but will be my last choice. Thank you! I'm getting a fatal memory error and have been unable to figure out what is causing it. To make it worse, the allowed memory size does not appear to be related in any way to the memory_limit value. Here's the information: Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 128 bytes) in template.php on line 164 Excerpt from template.php (line 164 is where $max is assigned): ... else if(isDateType($type) || isTimestampType($type) || isDatetimeType($type)) { $min = htmlentities($countpost['constraints'][$tablename][$fieldname]['min'], ENT_QUOTES); $max = htmlentities($countpost['constraints'][$tablename][$fieldname]['max'], ENT_QUOTES); echo "\t\tFrom: <input name=\"constraints[$tablename][$fieldname][min]\"" ." type=text value=\"$min\" onclickXSSCleaned=\"toggleCalendar(this)\" readonly>\n"; echo "\t\tTo: <input name=\"constraints[$tablename][$fieldname][max]\"" ." type=text value=\"$max\" onclickXSSCleaned=\"toggleCalendar(this)\" readonly>\n"; } ... These two lines were included at the top of the script and printed "Base Memory Usage: 473172 Memory Limit: -1": echo "Base Memory Usage: ". memory_get_usage() ."\n"; echo "Memory Limit: ". ini_get('memory_limit') ."\n"; I also get the same error in a slightly different location: Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 1 bytes) in template.php on line 153 Excerpt from template.php (line 153 is the simple variable assignment of an empty string): ... if(!isset($countpost['constraints'][$tablename][$fieldname]['value'])) $countpost['constraints'][$tablename][$fieldname]['value'] = ""; ... If I refresh the page repeatedly, the error will predictably occur at the same place. Once I change any code (even slightly), the location of the error will change to a new location, sometimes into an included file. The size of "tried to allocate X bytes" also changes. The only constant in this whole mess is the allowed memory size (which is ALWAYS 262144, no matter what the actual memory limit is). I had previously set memory_limit to -1 in the php.ini file, which seems to have no effect on the error. I am not using a .htaccess file. Changing the memory_limit doesn't change the "allowed memory size" whether it's set to 16M, 64M or whatever. I've restarted apache after each change in php.ini. I have memory_get_usage in the code several times to watch the memory. There are small changes, and a change of about 300k when I first load another file. The max gets up to 1048576 bytes (memory_get_peak_usage). 1 Mb does not seem very large to me and is much smaller than the memory_limit. Also, today I wrote a short php script to just use up memory. This was just to test php and see if my installation is messed up. It worked just fine and I got up to 128Mb used without encountering the error above. So it's something in my code. This is using php 5.3.2, apache2 2.2.14, on Ubuntu 10.04. Any insights would be greatly appreciated. |