Search Results

Search found 42698 results on 1708 pages for 'php in array'.

Page 47/1708 | < Previous Page | 43 44 45 46 47 48 49 50 51 52 53 54  | Next Page >

  • Run a PHP-script from a PHP-script without blocking

    - by Nicklas Ansman
    I'm building a spider which will traverse various sites and data mining them. Since I need to get each page separately this could take a VERY long time (maybe 100 pages). I've already set the set_time_limit to be 2 minutes per page but it seems like apache will kill the script after 5 minutes no matter. This isn't usually a problem since this will run from cron or something similar which does not have this time limit. However I would also like the admins to be able to start a fetch manually via a HTTP-interface. It is not important that apache is kept alive for the full duration, I'm, going to use AJAX to trigger a fetch and check back once in a while with AJAX. My problem is how to start the fetch from within a PHP-script without the fetch being terminated when the script calling it dies. Maybe I could use system('script.php &') but I'm not sure it will do the trick. Any other ideas?

    Read the article

  • Accumulate 2D Array by Index

    - by Tegan Snyder
    I have an array that looks like this: Array ( [0] => Array ( [amount] => 60.00 [store_id] => 1 ) [1] => Array ( [amount] => 40.00 [store_id] => 1 ) [2] => Array ( [amount] => 10.00 [store_id] => 2 ) ) What would be a good method to reduce the array to a similar array that totals the 'amount' related to a store_id. For Instance I'd like to get this: Array ( [0] => Array ( [amount] => 100.00 [store_id] => 1 ) [2] => Array ( [amount] => 10.00 [store_id] => 2 ) )

    Read the article

  • PHP ZF: I can't debug my IndexController.php actions code

    - by overthetop
    Hi I'm new to php and I'm using xampp, eclipse pdt, xdebug. I've set xdebug so that I can debug my site on apache but when I click 'debug as web page' in the eclipse ide only the breakpoint in the public/index.php and in the views get hit. If I put a breakpoin here public function indexAction() { // action body $this->view->s = "deam"; } the debugger don't stop?! why is that? I can't debug the most important part of my application. :( Plese help me with this.

    Read the article

  • PHP float bug: PHP Hangs On Numeric Value

    - by jeroen
    I just read an interesting article about php hanging on certain float numbers, see The Register and Exploring Binary. I never explicitly use floats, I use number_format() to clean my input and display for example prices. Also, as far as I am aware, all input from for example forms are strings until I tell them otherwise so I am supposing that this problem does not affect me. Am I right, or do I need to check for example Wordpress and Squirrelmail installations on my server to see if they cast anything to float? Or better, grep all php files on my servers for float?

    Read the article

  • php DOM, get values from xml document, php xml

    - by Michael
    I'm trying to get some information (itemID, title, price and mileage) for multiple listings from ebay website using their api . So far I got this link up http://open.api.ebay.com/shopping?callname=GetMultipleItems&responseencoding=XML&appid=Morcovar-c74b-47c0-954f-463afb69a4b3&siteid=0&version=525&IncludeSelector=ItemSpecifics&ItemID=220617293997,250645537939,230485306218 I've saved the document as .xml file using php curl and now I need to get/extract the values(itemID, title, price and mileage) into arrays and store them in database. Unfortunately I never worked with php dom and I can't figure it out how to extract the values . I tried to follow the tutorial found on IBM website http://www.ibm.com/developerworks/library/os-xmldomphp/ but I had no success. Some help would be highly appreciated.

    Read the article

  • How to convert submitted form array to this array on php?

    - by drfanai
    Lets suppose i have the following array submitted by a html form: array( 'firstname' => array('Sara','Jim'), 'lastname' => array('Gibson','Jobs') ); What i wanna achieve is the following array: array( array( 'firstname' => 'sara', 'lastname' => 'Gibson' ), array( 'firstname' => 'Jim', 'lastname' => 'Jim' ) ); I need a function to automatically sort the array not manually by entering data but automatically processing array data.

    Read the article

  • two php arrays - sort one array with the value order of another

    - by Tisch
    Hi there, I have two PHP arrays like so: Array of X records containing the ID of Wordpress posts (in a particular order) Array of Wordpress posts The two arrays look something like this: Array One (Sorted Custom Array of Wordpress Post IDs) Array ( [0] => 54 [1] => 10 [2] => 4 ) Array Two (Wordpress Post Array) Array ( [0] => stdClass Object ( [ID] => 4 [post_author] => 1 ) [1] => stdClass Object ( [ID] => 54 [post_author] => 1 ) [2] => stdClass Object ( [ID] => 10 [post_author] => 1 ) ) I would like to sort the array of wordpress posts with the order of the ID's in the first array. I hope this makes sense, and thanks in advance of any help. Tom edit: The server is running PHP Version 5.2.14

    Read the article

  • Splitting data from MySQL using PHP & Javascript works in IE but not in FF

    - by MTSzabo
    I have the following JavaScript function on a page: function setFields(){ var menu = document.getElementById('EditLocation'); var itemDataArray = menu[menu.selectedIndex].value.split('|'); form.LocationShortName.value = itemDataArray[0]; form.LocationLongName.value = itemDataArray[1]; form.Phone.value = itemDataArray[2]; form.Address1.value = itemDataArray[3]; form.CityStateZip.value = itemDataArray[4]; form.MapLink.value = itemDataArray[5]; } Down on the Form, I have the following: <select class="input2" name="EditLocation" id="EditLocation" onchange = "setFields();"> <option value="-Add New-"<?php if($editlocation=='-Add New-'){echo(' selected="selected"');} ?>>-Add New-</option> <?php require_once('connection.php'); $connection = mysql_connect($hostname,$username,$password) or die (mysql_errno().": ".mysql_error()."<BR />"); mysql_select_db($database); $sql = "SELECT * FROM directions ORDER BY dirshortname"; $query = mysql_query($sql); while ($row = mysql_fetch_array($query)) { echo('<option value="'.stripslashes($row['dirshortname']).'|'.stripslashes($row['dirlongname']).'|'.stripslashes($row['dirphone']).'|'.stripslashes($row['dirstreet']).'|'.stripslashes($row['dircsz']).'|'.stripslashes($row['dirmaplink']).'"'); if ($editlocation==stripslashes($row['dirshortname'])) { echo(' selected="selected"'); } echo('>'.stripslashes($row['dirshortname']).'</option>'); } ?> In essence, the PHP is supposed to pack the data elements pulled from MySQL into the OPTION VALUE portion of the SELECT box. Once the user selects a record, the JavaScript pulls the packed data apart and populates the other data elements on the FORM. It all works wonderfully in IE, but in FF the fields do not populate with data. The form is somewhat long, but I'll include it anyway for the sake of completeness. <form action="admin-dirs.php" method="post" enctype="multipart/form-data" style="margin:0px; padding:0px " id="form"> <table width="587" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="60">&nbsp;</td> <td width="185">Select Location to Edit: </td> <td width="342"><select class="input2" name="EditLocation" id="EditLocation" onchange = "setFields();"> <option value="-Add New-"<?php if($editlocation=='-Add New-'){echo(' selected="selected"');} ?>>-Add New-</option> <?php require_once('connection.php'); $connection = mysql_connect($hostname,$username,$password) or die (mysql_errno().": ".mysql_error()."<BR />"); mysql_select_db($database); $sql = "SELECT * FROM directions ORDER BY dirshortname"; $query = mysql_query($sql); while ($row = mysql_fetch_array($query)) { echo('<option value="'.stripslashes($row['dirshortname']).'|'.stripslashes($row['dirlongname']).'|'.stripslashes($row['dirphone']).'|'.stripslashes($row['dirstreet']).'|'.stripslashes($row['dircsz']).'|'.stripslashes($row['dirmaplink']).'"'); if ($editlocation==stripslashes($row['dirshortname'])) { echo(' selected="selected"'); } echo('>'.stripslashes($row['dirshortname']).'</option>'); } ?> </select></td> </tr> <tr> <td width="60">&nbsp;</td> <td colspan="2"><span class="main" style=" padding-left:12px; padding-right:12px; padding-top:6px"><br /> (Note: Leaving the Long Name blank will duplicate the Short Name.)</span></td> </tr> <?php if(!$errlocationshortname=='' ){echo(' <tr> <td width="60">&nbsp;</td> <td width="185">&nbsp;</td> <td width="342"><span class="redtxterror">'.$errlocationshortname.'</span></td> </tr>');} ?> <tr> <td>&nbsp;</td> <td>Location Short Name: <span class="red_star">*</span> </td> <td><input name="LocationShortName" id="LocationShortName" type="text" class="input2<?php if(!$errlocationshortname==''){echo('r');} ?>" value="<?php echo($locationshortname); ?>" maxlength="50"></td> </tr> <?php if(!$errlocationlongname=='' ){echo(' <tr> <td width="60">&nbsp;</td> <td width="185">&nbsp;</td> <td width="342"><span class="redtxterror">'.$errlocationlongname.'</span></td> </tr>');} ?> <tr> <td>&nbsp;</td> <td>Location Long Name: <span class="red_star">*</span> </td> <td><input name="LocationLongName" id="LocationLongName" type="text" class="input2<?php if(!$errlocationlongname==''){echo('r');} ?>" value="<?php echo($locationlongname); ?>" maxlength="50"></td> </tr> <?php if(!$erraddress=='' ){echo(' <tr> <td width="60">&nbsp;</td> <td width="185">&nbsp;</td> <td width="342"><span class="redtxterror">'.$erraddress.'</span></td> </tr>');} ?> <tr> <td>&nbsp;</td> <td>Street Address: <span class="red_star">*</span> </td> <td><input name="Address1" id="Address1" type="text" class="input2<?php if(!$erraddress==''){echo('r');} ?>" value="<?php echo($address); ?>"></td> </tr> <?php if(!$errcsz=='' ){echo(' <tr> <td width="60">&nbsp;</td> <td width="185">&nbsp;</td> <td width="342"><span class="redtxterror">'.$errcsz.'</span></td> </tr>');} ?> <tr> <td>&nbsp;</td> <td>City, State, Zip: <span class="red_star">*</span> </td> <td><input name="CityStateZip" id="CityStateZip" type="text" class="input2<?php if(!$errcsz==''){echo('r');} ?>" value="<?php echo($csz); ?>"></td> </tr> <?php if(!$errphone=='' ){echo(' <tr> <td width="60">&nbsp;</td> <td width="185">&nbsp;</td> <td width="342"><span class="redtxterror">'.$errphone.'</span></td> </tr>');} ?> <tr> <td>&nbsp;</td> <td>Location Phone Number: <span class="red_star">*</span> </td> <td><input name="Phone" id="Phone" type="text" class="input2<?php if(!$errphone==''){echo('r');} ?>" value="<?php echo($phone); ?>" maxlength="20"></td> </tr> <?php if(!$errmaplink=='' ){echo(' <tr> <td width="60">&nbsp;</td> <td width="185">&nbsp;</td> <td width="342"><span class="redtxterror">'.$errmaplink.'</span></td> </tr>');} ?> <tr> <td>&nbsp;</td> <td>Paste Link to Map: <span class="red_star">*</span> </td> <td><input name="MapLink" id="MapLink" type="text" class="input2<?php if(!$errmaplink==''){echo('r');} ?>" value="<?php echo($maplink); ?>" maxlength="125"></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td><div align="right" style="padding-right:25px"> <input type="hidden" id="action" name="action" value="submitform" /> <input type="submit" id="savenew" name="savenew" value="Save & New" /> <input type="submit" id="submit" name="submit" value="Save & Close" /> <?php if(!isset($_POST['action'])) {?> <input type="reset" id="reset" name="reset" value="Reset" /> <?php } ?> </div></td> </tr><tr> <td>&nbsp;</td> <td>&nbsp;</td> <td class="main_d"><div align="right" style="padding-right:25px">Your IP Address is Logged as: <?php echo($ip); ?></div></td> </tr> </table> </form>

    Read the article

  • Changing a php "echoed" div attribute with php

    - by Zakaria
    Hi everybody, I'm using PHP to echo a content stored on my database. The content is a DIV carrying any type of data. The problem is that I don't know the ID and I have some problems with these DIVs if I try to display them more that once. So, the idea is to modify the DIV id each time I'd like to display them. Something like this: <?php modify_div_id($data,"id-456"); ?> Is there a solution for this problem? Thank you very much, regards.

    Read the article

  • c# Multi diemention (array, arraylist, or hashtable) ?

    - by Data-Base
    hello, I'm trying to figure out how to build a multi dimensional "array" that is: flexible size use 2 keys 1st key is int (flexible) 2nd key is string (kind of limited) the use will be like console.writelen(array[0]["firstname"]); console.writelen(array[0]["lastname"]); console.writelen(array[0]["phone"]); console.writelen(array[1]["firstname"]); console.writelen(array[1]["lastname"]); console.writelen(array[1]["phone"]); ..... ..... console.writelen(array[x]["firstname"]); console.writelen(array[x]["lastname"]); console.writelen(array[x]["phone"]); something like this

    Read the article

  • In PHP how do i update values in an asssociative array and store the entire array?

    - by amnesia-55
    Here's a code example: $array = array(); $array['master']['slave'] = "foo"; foreach ($array as $key => $value) { foreach ($value as $key2 => $value2) { if (preg_match('/slave/',$key2)) { $value[$key2] = "bar"; print "$value[$key2] => $key2 => $value2\n"; } } } print_r($array); Output: bar => slave => foo Array ( [master] => Array ( [slave] => foo ) ) Rather i would like to have the following as the final array: Array ( [master] => Array ( [slave] => bar ) ) What wrong am i doing here? Thank you!

    Read the article

  • Array iteration issue

    - by Tao
    i have this array which i echo and get this results: $hostess_ids[]=$row['hostess_id']; $j=0; foreach($hostess_ids as $hostess_selected){ $hostess_array= explode("-",$hostess_selected); echo var_dump($hostess_array); This is the output array(1) { [0]=> string(2) "16" } array(1) { [0]=> string(2) "16" } array(1) { [0]=> string(0) "" } array(1) { [0]=> string(0) "" } array(2) { [0]=> string(2) "17" [1]=> string(1) "1" } array(1) { [0]=> string(0) "" } array(2) { [0]=> string(2) "17" [1]=> string(1) "1" } array(2) { [0]=> string(2) "17" [1]=> string(2) "16" } How can i iterate in this array to get the first ceel values, then the second one, etc etc... Thanks..

    Read the article

  • Need reccomendation for transferring ASP.NET MVC skills to PHP

    - by Tuck
    I am looking to translate my skills in .NET to PHP - specifically in regards to ASP.NET MVC. At work I am currently using .NET MVC 2.0 on a variety of projects and thoroughly enjoy the platform. Specifically I enjoy the very minimal configuration required to get a project up and running (just create the project, define routes, and start coding), as well as the ability for controller actions to return different items (i.e. ActionResult, JsonResult). Another piece I really like is the way the view/model interaction can be handled. For example I like being able to call return View(model) and having a view page (.aspx) load and having the full model object available to the view, regardless of the model type. I'm looking for a PHP implementation of MVC that is the most similiar to what I am already familiar with. I don't anything apart from the MVC functionality. I've looked at Zend, Symfony, CodeIgniter, etc. and, while they look like they'll be fun to play with in the future, they provide much more functionality than I need. I'd prefer to write my own DAL,form helpers, delegate handlers,authentication/ACL pieces, etc. In short, I just need something to handle the routing and view interactions and will worry about the model implementation myself. Can someone please point me to some lightweight code that accomplishes or comes close to accomplishing my objectives above. Or, can someone identify just the portions of a larger framework that do the same (again, I'm not currently interested in implementing something on a big framework, just the MVC portion and want to implement the model portion myself as much as possible). Thanks in advance...

    Read the article

  • LEMP Stack on Ubuntu Server 13.04 not parsing PHP Switch Statement Properly

    - by schester
    On my Ubuntu 12.04 Server LTS on nginx 1.1.19, the following PHP code works properly: switch($_SESSION['user']['permissions']) { case 9: echo "Super Admin Privileges"; break; case 0: echo "Operator Privileges"; break; case 1: echo "Line Leader Privileges"; break; case 2: echo "Supervisor Privileges"; break; case 3: echo "Engineer Privileges"; break; case 4: echo "Manager Privileges"; break; case 5: echo "Administrator Privileges"; break; default: echo "Operator Privileges"; } However, I have a backup server running Ubuntu Server 13.04 on nginx 1.4.1 which has the exact same copy of the script (synced) but instead of breaking on the break; command, it echos the whole php script. The output on the 12.04 Box is similar to this: You are logged in with Super Admin Privileges But on the 13.04 Box, the output is like this: You are logged in logged in with Super Admin Privileges"; break; case 0: echo "Operator Privileges"; break; case 1: echo "Line Leader Privileges"; break; case 2: echo "Supervisor Privileges"; break; case 3: echo "Engineer Privileges"; break; case 4: echo "Manager Privileges"; break; case 5: echo "Administrator Privileges"; break; default: echo "Operator Privileges"; } ?> I have also tried changing the script from switch statement to if statements but same results. Any idea what is wrong?

    Read the article

  • Need recommendation for transferring ASP.NET MVC skills to PHP

    - by Tuck
    I am looking to translate my skills in .NET to PHP - specifically in regards to ASP.NET MVC. At work I am currently using .NET MVC 2.0 on a variety of projects and thoroughly enjoy the platform. Specifically I enjoy the very minimal configuration required to get a project up and running (just create the project, define routes, and start coding), as well as the ability for controller actions to return different items (i.e. ActionResult, JsonResult). Another piece I really like is the way the view/model interaction can be handled. For example I like being able to call return View(model) and having a view page (.aspx) load and having the full model object available to the view, regardless of the model type. I'm looking for a PHP implementation of MVC that is the most similiar to what I am already familiar with. I don't anything apart from the MVC functionality. I've looked at Zend, Symfony, CodeIgniter, etc. and, while they look like they'll be fun to play with in the future, they provide much more functionality than I need. I'd prefer to write my own DAL, form helpers, delegate handlers, authentication/ACL pieces, etc. In short, I just need something to handle the routing and view interactions and will worry about the model implementation myself. Can someone please point me to some lightweight code that accomplishes or comes close to accomplishing my objectives above. Or, can someone identify just the portions of a larger framework that do the same (again, I'm not currently interested in implementing something on a big framework, just the MVC portion and want to implement the model portion myself as much as possible). Thanks in advance.

    Read the article

  • passing data to php in ajax [closed]

    - by MertMETIN
    i try to pass my data, actually checkboxes has some datas in their ids, and i read try to read them. like that, <input align="right" type=checkbox name="checkArtist[]" class="checkClass" id ="{$movieId}-{$mCast.id}"></li> dont worry about {$movieId}-{$mCast.id} They are template lite tags. I successfully read checkboxes datas in ajax side. The problem is that i cannot send these datas to my php. var artistIds = new Array(); $(".p16 input:checked").each()(function(){ artistIds.push($(this).attr('id')); }); $.post('/json/crewonly/deleteDataAjax2', { 'artistIds': artistIds },function(response){ if(response=='ok') alert("ok"); }); above code is my ajax but in php side $artistIds is always empty. I found a topic in stackoverflow http://stackoverflow.com/questions/5571646/how-to-pass-a-javascript-array-via-jquery-post-so-that-all-its-contents-are-acce It says how to pass js arrays $.post('/url/to/page', {'someKeyName': variableName}); This is same with my code. What's going wrong ?

    Read the article

  • libc-bin errors when trying to install php

    - by jonney
    i am trying to update and install php into my ubuntu server 12.04 using the command below: apt-get upgrade php apt-get install php5-curl php5-gd php5-mysql php5-pgsql However i receive this error all the time: gzip: stdout: No space left on device E: mkinitramfs failure cpio 141 gzip 1 update-initramfs: failed for /boot/initrd.img-3.2.0-34-generic with 1. run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1 Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-3.2.0-34-generic.postinst line 1010. dpkg: error processing linux-image-3.2.0-34-generic (--configure): subprocess installed post-installation script returned error exit status 2 dpkg: dependency problems prevent configuration of linux-image-server: linux-image-server depends on linux-image-3.2.0-33-generic; however: Package linux-image-3.2.0-33-generic is not configured yet. dpkg: error processing linux-image-server (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of linux-server: linux-server depends on linux-image-server (= 3.2.0.33.36); however: Package linux-image-server is not configured yet. dpkg: error processing linux-server (--configure): dependency problems - leaving unconfigured Setting up libpq5 (9.1.10-0ubuntu12.04) ... No apport report written because the error message indicates it's a follow-up error from a previous failure. No apport report written because MaxReports has already been reached Setting up php5-curl (5.3.10-1ubuntu3.8) ... Setting up php5-pgsql (5.3.10-1ubuntu3.8) ... Processing triggers for initramfs-tools ... update-initramfs: Generating /boot/initrd.img-3.2.0-32-generic gzip: stdout: No space left on device E: mkinitramfs failure cpio 141 gzip 1 update-initramfs: failed for /boot/initrd.img-3.2.0-32-generic with 1. dpkg: error processing initramfs-tools (--configure): subprocess installed post-installation script returned error exit status 1 No apport report written because MaxReports has already been reached Processing triggers for libc-bin ... ldconfig deferred processing now taking place Errors were encountered while processing: linux-image-3.2.0-33-generic linux-image-3.2.0-34-generic linux-image-server linux-server initramfs-tools E: Sub-process /usr/bin/dpkg returned an error code (1) Not sure whats wrong and why it cant process the linux-image files?

    Read the article

  • Formatting php, what works more efficiently?

    - by JamesM-SiteGen
    Hello fellow programmers, I was just wondering what makes php work faster, I have a few methods that I always go and do, but that only improves the way I can read it, but how about the interpreter? Should I include the curly braces when there is only one statement to run? if(...){ echo "test"; } # Or.. if(...) echo "test"; === Which should be used? I have also found http://beta.phpformatter.com/ and I find the following settings to be good, but are they? Indentation: Indentation style: {K&R (One true brace style)} Indent with: {Tabs} Starting indentation: [1] Indentation: [1] Common: [x] Remove all comments [x] Remove empty lines [x] Align assignments statements nicely [ ] Put a comment with the condition after if, while, for, foreach, declare and catch statements Improvement: [x] Remove lines with just a semicolon (;) [x] Make normal comments (//) from perl comments (#) [x] Make long opening tag (<?php) from short one (<?) Brackets: [x] Space inside brackets- ( ) [x] Space inside empty brackets- ( ) [x] Space inside block brackets- [ ] [x] Space inside empty block brackets- [ ] Tiny var names: often I go through my code and change $var1 to $a, $var2 to $b and so on. I do include comments at the start of the file to show to me what each letter(s) mean.. Final note: So am I doing the right thing with the curly braces and the settings? Are there any great tips that help it run faster?

    Read the article

  • PHP rand function (or not so rand)

    - by Badr Hari
    I was testing PHP rand function to write on a image. Of course the output shows that it's not so random. The code I used: <?php header('Content-Type: image/png'); $lenght = 512; $im = imagecreatetruecolor($lenght, $lenght); $blue = imagecolorallocate($im, 0, 255, 255); for ($y = 0; $y < $lenght; $y++) { for ($x = 0; $x < $lenght; $x++) { if (rand(0,1) == 0) { imagesetpixel($im, $x, $y, $blue); } } } imagepng($im); imagedestroy($im); ?> My question is, if I use image width/lenght (variable $lenght in this example) number like 512, 256 or 1024, it is very clear that it's not so random. When I change the variable to 513 for an example, it is so much harder for human eye to detect it. Why is that? What is so special about these numbers? 512: 513: Edit: I'm running xampp on Windows to test it.

    Read the article

  • Is '@' Error Suppression a Valid Technique for Testing for an Optional Array Key?

    - by MikeSchinkel
    Rarst and I were debating offline about the use of the '@' error suppression operator in PHP, specifically for use to test for existence of "optional" array keys, i.e. array keys that are being used as a switch here a their lack of existence in the array is functionally equivalent to the array having the key with a value equaling false. Here is pseudo-code for this scenario: function do_something( $args = array() ) { if ( @$args['switch'] ) { // Do something with this switch } // continue on... } vs. this approach: function do_something( $args = array() ) { if ( ! empty( $args['switch'] ) && $args['switch'] ) { // Do something with this switch } // continue on... } Of course in most use-cases, suppressing errors would not be A Good Thing(tm). However in this use-case where an array is passed with an optional element, it seems to me that it is actually a very good technique but I could be wrong and would like to hear other's opinions on the subject before I make up my mind. I do know that there are alleged performance hits for using the former approach but I'd like to know how they compare with the alternative and if they performance hits really matter in real world scenarios? P.S. I decided to post this because, after debating this offline with Rarst, he asked a more general question here on Programmers but didn't actually give a detailed example of the specific use-case we were debating. And since I'm pretty sure he'll want to use the out-of-context answers on that other question as justification for why the above is "bad" I decided I needed to get opinions on this specific use-case.

    Read the article

  • Invalid operation dist-ugprade

    - by drdarwin
    i'm running Apache 2 on Debian at my VPS. Naturally i have problem with restricted GD-library of my php package and i need to fix it (i need imagerotate() function). Before installing php-gd pugin it's necessary to update php 5.2 to php 5.3 my /etc/apt/sources.list is: #deb http://ftp.ru.debian.org/debian/ lenny main contrib non-free #deb http://security.debian.org lenny/updates main contrib non-free #deb http://ftp.ru.debian.org/debian lenny main #deb-src http://volatile.debian.org/debian-volatile lenny/volatile main contrib deb http://packages.dotdeb.org stable all deb-src http://packages.dotdeb.org stable all The problem comes after apt-get dist-ugprade executing: /$ apt-get update Hit http://packages.dotdeb.org stable Release.gpg Hit http://packages.dotdeb.org stable Release Ign http://packages.dotdeb.org stable/all Packages/DiffIndex Ign http://packages.dotdeb.org stable/all Sources/DiffIndex Hit http://packages.dotdeb.org stable/all Packages Hit http://packages.dotdeb.org stable/all Sources Reading package lists... /$ apt-get dist-ugprade E: Invalid operation dist-ugprade What can cause this problem? How much should i wait while Reading package lists...? Is there any simple guideline for further php-gd installation?

    Read the article

  • APC module causing strange error

    - by clifgriffin
    When I run php -v I get: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/apc.so' - /usr/lib64/php/modules/apc.so: undefined symbol: php_pcre_exec in Unknown on line 0 This isn't my first rodeo. I've setup APC multiple times. This is a MediaTemple Dedicated Virtual 4.0 with Plesk 11. Plesk 11 is the only thing essentially different from the other servers I've set this up on. I've verified that pcre-devel is installed. I've compiled APC from source as well as used pecl to install it. No difference. I also tried downgrading to APC 3.0.19, with no love.

    Read the article

  • How to Rotate different data in days of the week in php [migrated]

    - by shihon
    I am working on a project in which i have to distribute different ad's per day, the ad's in form of array are: $ad = array( 'attribute1_value' => "12", 'attribute2_value' => "xyz", 'attribute3_value' => 'http://example.com', 'attribute4_value' => 'data'); The logic i am using with switch case : $day = date('w',time()); switch ($day) { case '0': if($day == '0') { $count = 0; echo $ad; $count++; } else { $count = 7; echo $ad; } break; case '1': if($day == '1') { $count = 1; echo $ad; $count++; } else { $count = 8; echo $ad; } break; Problem is if i have ~15 ad's then i want to distribute ad/day, date('w') output's the present day but after day 7 i.e saturday, on sunday ad number 8 initiate. I have to implement this scenario using date function. Also i have to send ad's to those user who are not experience this ad before. I am not expert in php, as a beginner working in php/mysql. Kindly help me to improve this concept

    Read the article

  • php5-fpm.sock file doesn't exist

    - by Caballero
    I've just compiled and installed PHP-FPM 5.5.5 following this tutorial. I have ignored the apache setup section, because I'm running nginx. Everything seems to be fine: php -v PHP 5.5.5 (cli) (built: Oct 18 2013 21:56:02) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies Problem is, I need to link it to my nginx conf via a socket, but /var/run/php5-fpm.sock file doesn't exist. How do I create it? The file /etc/php5/fpm/pool.d/www.conf does include the line listen = /var/run/php5-fpm.sock It is possible (though I'm not sure) that it's a leftover of an older php version 5.5.3 which was installed and removed via apt-get. I'm running Ubuntu 13.10 (Saucy Salamander)

    Read the article

< Previous Page | 43 44 45 46 47 48 49 50 51 52 53 54  | Next Page >