php,templates,str-replaceRelated issues-Collection of common programming errors
Iain
apache-2.2 php centos suphp
We have a server that’s handling uploads. The memory limit is set at a ridiculously high level in php.ini (800 M).. however we have gd, which is managing the image resizing, but it is dying at about 60M of memory usage (our error log is reporting a fatal error at this stage).From all our Apache config files (CPanel/WHM managed), I can’t find a RLimitMem that’s set anywhere either.I’ve looked as well if there’s any limits set in our kernel, but can’t find anything there as well.Is there somethin
Haresh Vidja
ubuntu php wordpress
I have moved my server data PHP + WordPress and database(mysql) from one server to another server… All things working fine… but some time i got page blank in click submit button.. This problem occures some time ..I didnt get any error or fatal error in errorLog file and not get access entry in accsessLog file also on time of blank page.. Black page issue occurs some time on same taskSo how can I fix this problem..
Scott Pack
apache-2.2 php centos
So the same code works on my Ubuntu server but when I upload it to my dedicated hosting server running CentOS it seems to add an extra prefix of .:/usr/share/pear:/usr/share/php: I tried setting includepath to different things but it just doesn’t work. The file is in a directory called language in the same folder as the file that is including it and I’m using:include dirname(__FILE__).DIRECTORY_SEPARATOR.”language”.DIRECTORY_SEPARATOR.”storage.inc”; include dirname(__FILE__).”/language/language.
mike
php cpanel pdo
Getting this error: Fatal error: Class ‘PDO’ not foundHave these lines in php.ini:extension=pdo.so extension=pdo_sqlite.so extension=sqlite.so extension=pdo_mysql.soThis shows up in php.info()– –enable-pdo=shared’ ‘Have access to whm but there is no “software” tab from which to access easyapatche? Any suggestions??
Mahbubur R Aaman
php centos zend-framework
Shows PHP Fatal Errormain(): Failed opening required ‘Zend/Loader.php’I have installed ZF on /usr/share/phpzf command is working. I can create project and do other works using zf command. But while including the library path then shows the error.Am i missing something?
Passionate Developer
apache-2.2 php
I am getting below errors despite setting memory_limit in php.ini to 64mb:Fatal error: Out of memory (allocated 6291456) (tried to allocate 91284 bytes) in /home/favstayc/public_html/coverbuddy2/cake/libs/configure.php on line 1067What could I change to fix this issue?
BlaM
php iis7 stdout stderr
Okay, this is slowly getting annoying. I’m used to work with Apache Webservers and never had any of these problems. IIS seems to try to be intelligent – or whatever.Here’s my situation: My customer wants a PHP website and it is supposed to run on an Windows IIS webserver.For my development environment I could use my Apache – but just to be sure I want to do it with IIS, too. So I set up a dev-server with Windows Vista, all the latest Updates and installed IIS. Everything fine!I quickly found ins
WerkkreW
apache-2.2 php varnish
We recently migrated our site to a load balanced apache cluster behind varnish. Since that time a very small subset of users is reporting they cannot view any pages. I have narrowed the issue down quite a bit. This issue was not present before the move, the old infrastructure was a single large box.We are on Rackspace Cloud running 8 apache2 instances behind varnish 3.0 all load balanced using Rackspace Cloud load balancers (Zeus) and 2 mysql instances for a total of 10 servers, all linux.Use
Uvais Ibrahim
php php-extensions pecl expect
I got some serious error while installing expect extension in PHP.I ran sudo pecl install channel://pecl.php.net/expect-0.3.1I got error like this while running make,running: make /bin/bash /tmp/pear/temp/pear-build-rootvXp7LZ/expect-0.3.1/libtool –mode=compile cc -I. -I/tmp/pear/temp/expect -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootvXp7LZ/expect-0.3.1/include -I/tmp/pear/temp/pear-build-rootvXp7LZ/expect-0.3.1/main -I/tmp/pear/temp/expect -I/usr/include/php5 -I/usr/include/php5/main -I/u
Justin808
php http httpd hostgator
OK, so I’m uploading a 350meg zip file. The file one uploaded is unzipped and the contents are processed. The processing consists of reading in a data file, then copying and thumbnailing images, the adding data to a database. This is all once process start to finish. I can see in the log that the datafile is processed. I can see on the filesystem the thumbnails get created. But then it looks like the whole this starts over from scratch with blank post data and it fails.When I look at the httpd l
Lodder
templates joomla error-handling joomla3.1
I’m struggling to improve my Joomla website. I’m getting a 500 error when I try to open my articles in the front end, so I changed the error reporting to “Developed”. I then received the following error:Fatal error: Class ‘Jhtml’ not found in /xxx/components/com_comment/templates/default/default.php on line 49How to I prevent this error from occuring? Could someone also point out a good free template website if the problem lays in me changing the template?
timrau
c++ templates overloading friend unions
While working on my basic vector library, I’ve been trying to use a nice syntax for swizzle-based printing. The problem occurs when attempting to print a swizzle of a different dimension than the vector in question. In GCC 4.0, I originally had the friend << overloaded functions (with a body, even though it duplicated code) for every dimension in each vector, which caused the code to work, even if the non-native dimension code never actually was called. This failed in GCC 4.2. I recently r
Vincent
c++ templates types casting
I’m implementing some classes for linear algebra operations on very small constant size vector and matrices. Currenty, when I do :MyMathVector<int, 3> a ={1, 2, 3}; MyMathVector<double, 3> b ={1.3, 2.3, 3.3}; std::cout<<“First = “<<a+b<<std::endl; std::cout<<“Second = “<<b+a<<std::endl;Then First = {2, 4, 6} and Second = {2.3, 4.3, 6.3}, because the second element is casted to the first element type by the compiler. Is there any “easy” way to provi
Dark_Daiver
c++ templates
I have a simple hash table template, template <class K, class V, long H(K)> class HashTableAbs{/* …. */} //where K is key type, V is value type, H gives hash code for K valueand simple inheritor classtemplate <class K, class V, long H(K)> class HashTable:public HashTableAbs<K, V, H> {}; and i want to specialize this template for string, with my default hash functiontemplate <class V> class HashTable<std::string, V, strSimpleHash>:public HashTableAbs<std::strin
Brandon Pelfrey
c++ linux ide templates
I have a friend who is trying to make the switch to Linux, but is hung up on the apparent lack of debugging/IDE environments for C++, especially as they relate to template programming. He has been using visual studio for years and is maybe a little spoiled by their awesome IDE. Does anyone have any good suggestions for an environment where he can, under Linux, develop and debug with all of the usual things (Breakpoints, line highlighting for compilation errors, step in/over/out/etc, etc) that he
MadScienceDreams
c++ templates c++11 variadic-templates
So someone asked a question then deleted it, but I found it an interesting challenge.They had this weird type, and had run into the problem that Concat and Range were castable to Sequences but were not Sequences (for obvious reasons)template<unsigned… Is> struct Sequence{}; template<typename… Is> struct Concat{}; template<unsigned… Is> struct Concat<Sequence<Is…>> : public Sequence<Is…> {}; template<unsigned… Is, unsigned… Js, typename… R
Ancurio
c++ templates pointers reference virtual
Consider following code:template<typename T> struct MyTempl {virtual void doStuff(const T &value) = 0; };struct MyImpl : MyTempl<int> {void doStuff(const int &value) {} };struct MyPtrImpl : MyTempl<int*> {void doStuff(const int* &value) {} };MyImpl imp1; MyPtrImpl imp2;This will not compile correctly: the compiler tells me that doStuff() in MyPtrImpl is pure virtual, ie. I failed to correctly override it. If I however typedef int* to something like int_ptr, and use
SoapBox
c++ templates
I have a template class with an overloaded + operator. This is working fine when I am adding two ints or two doubles. How do I get it to add and int and a double and return the double?template <class T> class TemplateTest { private:T x;public:TemplateTest<T> operator+(const TemplateTest<T>& t1)const{return TemplateTest<T>(x + t1.x);} }in my main function i havevoid main() {TemplateTest intTt1 = TemplateTest<int>(2);TemplateTest intTt2 = TemplateTest<int>
sbi
c++ templates programming-languages semantics
I am looking at some c++ code and do not understand the purpose of the template declaration in this situation:template<> void operator>>(const ClassA& s, const ClassB d) {…}What is the semantic of template<>?
Mihai Stancu
php mysql database templates phpmyadmin
http://dl.dropbox.com/u/11246427/naysof_template.rarI am using XAMPP and set up my db using phpmyadmin.above is my current project. I am trying to set up a database to this “quote” template. As you may see, most of the user’s input are the <textarea>.I want the invoice number to be auto-increment, and when save is clicked(i made a button on other template already), it will store the data into the database. I created database, tables but i am not sure how to set this up.Do I include all tex
user1860536
php function preg-replace str-replace
I try change characters by functions<?php $string = “Hi everybody people [gal~images/articles~100~100~4] here other imagen [gal~images/products~100~100~3]”;$regex = “/\[(.*?)\]/”; preg_match_all($regex, $string, $matches);for($i=0; $i<count($matches[1]);$i++) { $match = $matches[1][$i]; $array = explode(‘~’, $match);//$newValuet=”gal(“”.$array[1].””,””.$array[2].””,””.$array[3].””,””.$array[4].””)”;$newValue=”gal(“.$array[1].”,”.$array[2].”,”.$array[3].”,”.$array[4].”)”;$string = str_repl
Clay Smith
php str-replace
I am getting an error on the str_replace line. I am trying to replace the $_SESSION variable with the constant of it. What am i missing?$resume = fopen(‘creative/’.$_SESSION[‘user’].’/resume.php’, ‘r’) or die(‘error when opening the file’); $fp = fopen(‘creative/’.$_SESSION[‘user’].’/resume2.php’, ‘w’); $creative = $_SESSION[‘creative’]; $user = $_SESSION[‘user’]; if ($resume){ while (($buffer = fgets($resume, 4096)) !== false) {str_replace(“\$_SESSION[creative]”, $creative, $buffer);str_replace
user3185672
javascript php xmlhttprequest youtube-api str-replace
I have this PHP code, which try to get the description of a YouTube channel, and run it in a JS file (xhr_object), and I’ve got this error : Unexpected token ILLEGAL. But I found the problem : $channel_descr contains a simple quote in somes cases, which break the JS code. I’ve already tried to use str_replace() but it doesn’t change anything..$json = file_get_contents(“…?alt=json&part=snippet”); $data = json_decode($json, true);$channel_descr = $data[‘entry’][‘content’][‘$t’]; $channel_des
sparkle
php str-replace
String (JSON): {“title”:”\”Copper\””}I have tried$output = str_replace(‘\\”‘, “”, $output);but I got{“title”:”” Copper””}What I expect{“title”:”Copper”}
DevatoTech
php str-replace
$embedCode = <<<EOF getApplicationContent(‘video’,’player’,array(‘id’ => $iFileId, ‘user’ => $this->iViewer, ‘password’ => clear_xss($_COOKIE[‘memberPassword’])),true) EOF; $name = str_replace($embedCode,”test”,$content);I’m trying to replace a section of code with another piece of code. I can do it with smaller strings but once I added the larger strings to $embedCode, it throw an “unexpected T_ENCAPSED_AND_WHITESPACE” error
binki
php arrays str-replace
php > echo str_replace(array(‘0’, ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’, ‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’),array(‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’, ‘g’, ‘h’, ‘i’, ‘j’, ‘k’, ‘l’, ‘m’, ‘n’, ‘o’, ‘p’),’01234567890abcdef’) . PHP_EOL; klmnopghijkklmnopI expected this str_replace() call to give me something like abcdefghijklmnop. But it seems that the numeric strings in my search array are being treated as something other than strings.I am ultimately just going for the functionality of tr(1) (e.g., tr
Isaac Boda
php str-replace
<?php $date = date(‘n/j/Y’); $lines = file(‘../lines.txt’);foreach($lines as $line)$line = str_replace($date, ”, $line);echo $line; ?>Why will the above str_replace work for me, no matter how I re-arrange it I get this error:Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in File line 20 ($line = str_replace ….)
HamZa
php str-replace
I have to alter two things in this example text:example_1,example_2I need to appear this way: example 1, example 2So I need to replace the “_” with a space ” ” as well as the “,” to “, ” with a space. Currently I have this code below and it replaces the underscore fine, but I don’t know how to also integrate the “,” part in this code. str_replace(‘_’, ‘ ‘, $test)Would it be something like this:str_replace((‘_’, ‘ ‘,),(‘,’, ‘ ‘), $test)
joelrnorris
php syntax str-replace autoloader psr-0
I’m dabbling w/ a ‘lightweight’ PSR-0 AutoLoader for a WordPress Plugin, it runs fine on my local dev server, but when i push it up to one of WPEngine’s staging servers, i get this:Parse error: syntax error, unexpected ‘[‘, expecting ‘)’ in /nas/wp/www/staging/ahsodesigns/wp-content/plugins/AhSoFunctionality/start.php on line 30here’s the AutoLoader, // lightweight psr-0 autoloader spl_autoload_register(function ($classname) {// make sure we’re only loading classes from our directory,if (preg_m
Fuxi
php str-replace
i’m having the following php code:$html = ‘<p>[tag]</p>’;$test = “<a href=’#’><div class=’test’>button</div></a>”;$html = str_replace(“[tag]”, $test, $html);when using echo htmlentities($html) i’m getting the expected result:<p><a href=’#’><div class=’test’>button</div></a></p> but when echoing the $html, firefox renders it like this:<p> <a href=”#”></a> </p> <div class=”test”> <p></p&g
Web site is in building