Search Results

Search found 31819 results on 1273 pages for 'sphinx php'.

Page 45/1273 | < Previous Page | 41 42 43 44 45 46 47 48 49 50 51 52  | Next Page >

  • Anemic Domain Model, Business Logic and DataMapper (PHP)

    - by sunwukung
    I've implemented a rudimentary ORM layer based on DataMapper (I don't want to use a full blown ORM like Propel/Doctrine - for anything beyond simple fetch/save ops I prefer to access the data directly layer using a SQL abstraction layer). Following the DataMapper pattern, I've endeavoured to keep all persistence operations in the Mapper - including the location of related entities. My Entities have access to their Mapper, although I try not to call Mapper logic from the Entity interface (although this would be simple enough). The result is: // get a mapper and produce an entity $ProductMapper = $di->get('product_mapper'); $Product = $ProductMapper->find('[email protected]','email'); //.. mutaute some values.. save $ProductMapper->save($Product) // uses __get to trigger relation acquisition $Manufacturer = $Product->manufacturer; I've read some articles regarding the concept of an Anemic Domain model, i.e. a Model that does not contain any "business logic". When demonstrating the sort of business logic ideally suited to a Domain Model, however, acquiring related data items is a common example. Therefore I wanted to ask this question: Is persistence logic appropriate in Domain Model objects?

    Read the article

  • Sometimes my page can't access PHP session varible

    - by Anusha
    I am working on E-commerce Web Application, which is having users and permissions to them.. So according to their permission, For Ex: I am storing variable $chk = 'write' or $chk = 'read' on session and my condition is if ($chk == 'write') { // some function here to modify the page & its content // If true, then display SAVE button to save all changes made. } But, Sometimes my page cant access this variable, the value of $chk is unknown hence its not displaying SAVE button. But, it shows the button after refreshing the page or visiting sometime later. Can anyone help me to solve this.. Thanks in advance

    Read the article

  • Doubt related to PHP Cookies

    - by Richa
    Hey guys! I have a doubt, I will appreciate if you can clear it . COOKIES What are cookies? When described as entities, which is how cookies are often referenced in conversation, you can be easily misled. Cookies are actually just an extension of the HTTP protocol. Specifically, there are two additional HTTP headers: Set-Cookie and Cookie.The operation of these cookies is best described by the following series of events: Client sends an HTTP request to server. Server sends an HTTP response with Set-Cookie: foo=bar to client. Client sends an HTTP request with Cookie: foo=bar to server. Server sends an HTTP response to client. Thus, the typical scenario involves two complete HTTP transactions. In step 2, the server is asking the client to return a particular cookie in future requests. In step 3, if the user’s preferences are set to allow cookies, and if the cookie is valid for this particular request, the browser requests the resource again but includes the cookie. Now my question is....... why you cannot determine whether a user’s preferences are set to allow cookies during the first request????

    Read the article

  • Reporting Solution in PHP / CodeIgniter - Server side logic vs client side

    - by dot
    I'm building a report for an end user. They would like to see a list of all widgets... but then also like to see widgets with missing attributes, like missing names, or missing size. So i was thinking of creating one method that returns json data containing all widgets... and then using javascript to let them filter the data for missing data, instead of requerying the database. Ultimately, they need to be able to save all "reports" (filtered versions of data) inside a csv file. These are the two options I'm mulling over: Design 1 Create 3 separate methods in my controller/model like: get_all_data() get_records_with_missing_names() get_records_with_missing_size() And then when these methods are called, I would display the data on screen and give them a button to save to csv file. Design 2 Create one method called get_all_data() and then somehow, give them tools in the view to filter the json data using tables etc... and then letting them save subsets of the data. The reality is, in order to display all data, I still need to massage the data, and therefore, I know which records are missing attributes. So i'd rather not create separate methods by each filter. I'm not sure how I would do that just yet but at this point, i would like to know some pros/cons of each method. Thanks.

    Read the article

  • Cookie manager PHP

    - by HaCos
    I own a Joomla commerce store and although I use Google Analytics in order to track visitors, I need to install a cookie manager in order to be able to track cookies that were installed on customer when he punctuate an order. To be more specific , I am planning to join an affiliate network and I need somehow to track no only the last visit of a customer but if he has a cookie and from which affiliate network as well.

    Read the article

  • How do I change the NGINX user?

    - by danielfaraday
    I have a PHP script that creates a directory and outputs an image to the directory. This was working just fine under Apache but we recently decided to switch to NGINX to make more use of our limited RAM. I'm using the PHP mkdir() command to create the directory: mkdir(dirname($path['image']['server']), 0755, true); After the switch to NGINX, I'm getting the following warning: Warning: mkdir(): Permission denied in ... I've already checked all the permissions of the parent directories, so I've determined that I probably need to change the NGINX or PHP-FPM 'user' but I'm not sure how to do that (I never had to specify user permissions for APACHE). I can't seem to find much information on this. Any help would be great! (Note: Besides this little hang-up, the switch to NGINX has been pretty seamless; I'm using it for the first time and it literally only took about 10 minutes to get up and running with NGINX. Now I'm just ironing out the kinks.)

    Read the article

  • design an extendible and pluggable business logic flow handler in php

    - by Broncha
    I am working on a project where I need to allow a pluggable way to inject business processes in the normal data flow. eg There is an ordering system. The standard flow of the application is A consumer orders an item. Pays for it and card is authorized. Admin captures the payment. Order is marked as complete and item is shipped. But this process may vary (extra steps in between) for different clients. Say a client would need to validate the location of the consumer before he is presented with a credit card form, OR his policies might require some other processes in between. I am thinking of using State Pattern for processing orders, saving the current state of the order in database, and initializing the state of order from the saved state. I would also need some mechanism, where a small plugin would be able to inject business specific states in the state machine. Am I thinking the right way? Are there already implemented patterns for this kind of situation? I am working with Codeigniter and basically this would mean for me, to redirect to proper controller according to the current state of the order. Like, if the state of the order is unconfirmed then redirect the user to details page and then change the state to pending. If some client would need to do some validation, then register an intermediate state between unconfirmed and pending Please suggest.

    Read the article

  • Is this the correct approach to an OOP design structure in php?

    - by Silver89
    I'm converting a procedural based site to an OOP design to allow more easily manageable code in the future and so far have created the following structure: /classes /templates index.php With these classes: ConnectDB Games System User User -Moderator User -Administrator In the index.php file I have code that detects if any $_GET values are posted to determine on which page content to build (it's early so there's only one example and no default): function __autoload($className) { require "classes/".strtolower($className).".class.php"; } $db = new Connect; $db->connect(); $user = new User(); if(isset($_GET['gameId'])) { System::buildGame($gameId); } This then runs the BuildGame function in the system class which looks like the following and then uses gets in the Game Class to return values, such as $game->getTitle() in the template file template/play.php: function buildGame($gameId){ $game = new Game($gameId); $game->setRatio(900, 600); require 'templates/play.php'; } I also have .htaccess so that actual game page url works instead of passing the parameters to index.php Are there any major errors of how I'm setting this up or do I have the general idea of OOP correct?

    Read the article

  • php request youtube video is not working [closed]

    - by m3tsys
    what is wrong to this code? header('Content-type: application/x-shockwave-flash'); $video_id = $_REQUEST['id']; $content = readfile("http://www.youtube.com/watch?v=$video_id"); echo $content; or header('Content-type: application/x-shockwave-flash'); $video_id = $_REQUEST['id']; $content = readfile("http://localhost/embed/player.swf?file=http://www.youtube.com/watch?v=$video_id"); echo $content; Why this code is not working? How should look the code?

    Read the article

  • best practice for initializing class members in php

    - by rgvcorley
    I have lots of code like this in my constructors:- function __construct($params) { $this->property = isset($params['property']) ? $params['property'] : default_val; } Is it better to do this rather than specify the default value in the property definition? i.e. public $property = default_val? Sometimes there is logic for the default value, and some default values are taken from other properties, which was why I was doing this in the constructor. Should I be using setters so all the logic for default values is separated?

    Read the article

  • PHP efficiency question [closed]

    - by Ron
    Hello everyone. I am working on website and I am trying to make it fast as much as possible - especially the small things that can make my site a little bit quicker. So, my to my question - I got loop that run 5 times and in each time it echo something, If I'll make variable and the loop will add the text I want to echo into the variable and just in the end I'll echo the variable - will it be faster? loop 1 (with the echo inside the loop) for ($i = 0;$i < 5;$i++) { echo "test"; } loop 2 (with the echo outside [when the loop finish]) $echostr = ""; for ($i = 0;$i < 5;$i++) { $echostr .= "test"; } echo $echostr; I know that loop 2 will increase a bit the file size and therefore the user will have to download more bytes but If I got huge loop will it be better to use second loop or not? Thanks.

    Read the article

  • SQL binary value to PHP variable leading zeros

    - by Agony
    Using sql query to pull data from a mssql database results in a value that still has leading zeros. The data in database is stored as binary(13) - so it will pull all 13 digits. However the value is a text, so any leading zeros will generally show up as '?' in a form on the site - and in return will update wrong data to the database later. So what i need is to only select/display the text itself, not all 13 bytes. using: SELECT CONVERT(char,uilock_pw) AS uipwd FROM tbl_UserAccount or SELECT uilock_pw FROM tbl_UserAccount still adds the leading zeros to the char array. Example in database: 0x71776531323300000000000000 Would show up as: qwe123??????? But should be: qwe123 Im not even sure what character those ? represent. Using Echo results in a normal qwe123 - but not in a form.

    Read the article

  • Wordpress - how to replace <!--more--> with string on the_content() in single.php [migrated]

    - by Bob Cavezza
    I want to add text on a single wordpress blog post page where the "read more" text would usually be inserted. However, I can't configure a plugin to replace that text. I tried a few different sources, but I'm having trouble finding the solution. After looking through WordPress plugin: finding the <!--more--> in the_content and the page it links to, I still haven't been able to find a solution to this.

    Read the article

  • retrieve data based on date range using mysql ,php [on hold]

    - by preethi
    I am working on WPF where I have two datepickers when I try to retrieve the information on date range it displays only one record on all dates(same record displaying multiple times eg : date chosen from 01/10/2013 - 3/10/2013) where I have 3 different records on each day but my output is the first record displayed 3 times with same date and time. function cpWhitelistStats() { $startDate = $_POST['startDate']; $startDateTime = "$startDate 00:00:00"; $endDate = $_POST['endDate']; $endDateTime = "$endDate 23:59:59"; $cpId = $_POST['id']; $cpName = etCommonCpNameById($cpId); print "<h2 style=\"text-align: center;\">Permitted Vehicle Summary</h2>"; print "<h2 style=\"text-align: center;\">for $cpName</h2>"; $tmpDate = explode("/", $startDate); $startYear = $tmpDate[2]; $startMonth= $tmpDate[1]; $startDay = $tmpDate[0]; $tmpDate = explode("/", $endDate); $endYear = $tmpDate[2]; $endMonth= $tmpDate[1]; $endDay = $tmpDate[0]; $startDateTime = "$startYear-$startMonth-$startDay 00:00:00"; $endDateTime = "$endYear-$endMonth-$endDay 23:59:59"; $custId = $_SESSION['customerID']; $realCustomerId = $_SESSION['realCustomerId']; $maxVal = 0; if ($custId != "") { $conn = &newEtConn($custId); // Get the whitelist plates $staticWhitelistArray = etCommonMkWhitelist($conn, $cpId); array_shift($staticWhitelistArray); $startLoopDate = strtotime($startDateTime); $endLoopDate = strtotime($endDateTime); $oneDay = 60 * 60 * 24; // Get the entries $plateList = array_keys($staticWhitelistArray); $plate_lookup = implode('","', $plateList); $sql = "SELECT plate, entry_datetime, exit_datetime FROM stats WHERE plate IN (\"$plate_lookup\") AND entry_datetime > \"$startDateTime\" AND entry_datetime < \"$endDateTime\" AND carpark_id=\"$cpId\" "; $result = $conn->Execute($sql); if (!$result) { print $conn->ErrorMsg(); exit; } $rows = $result->fields; if ($rows != "") { unset($myArray); foreach($result as $values) { $plate = $values['plate']; $new_platelist[] = $plate; $inDateTime = $values['entry_datetime']; $outDateTime = $values['exit_datetime']; $tmp = explode(' ', $inDateTime); $inDate = $tmp[0]; $in_ts = strtotime($inDateTime); $out_ts = strtotime($outDateTime); $duration = $out_ts - $in_ts; $dur_array = intToDateArray($duration); $dur_string = ''; if ($dur_array['days'] > 0) { $dur_string .= $dur_array['days'] . ' days '; } if ($dur_array['hours'] > 0) { $dur_string .= $dur_array['hours'] . ' hours '; } if ($dur_array['mins'] > 0) { $dur_string .= $dur_array['mins'] . ' minutes '; } if ($dur_array['secs'] > 0) { $dur_string .= $dur_array['secs'] . ' secs '; } $myArray[$plate][] = array($inDateTime, $outDateTime, $inDate, $dur_string); } } while ($startLoopDate < $endLoopDate) { $dayString = strftime("%a, %d %B %Y", $startLoopDate); $dayCheck = strftime("%Y-%m-%d", $startLoopDate); print "<h2>$dayString</h2>"; print "<table width=\"100%\">"; print " <tr>"; print " <th>VRM</th>"; print " <th>Permit Group</th>"; print " <th>Entry Time</th>"; print " <th>Exit Time</th>"; print " <th>Duration</th>"; print " </tr>"; foreach($new_platelist as $wlPlate) { if ($myArray[$wlPlate][0][2] == $dayCheck) { print "<tr>"; print "<td>$wlPlate</td>"; if (isset($myArray[$wlPlate])) { print "<td>".$staticWhitelistArray[$wlPlate]['groupname']."</td>"; print "<td>".$myArray[$wlPlate][0][0]."</td>"; print "<td>".$myArray[$wlPlate][0][1]."</td>"; print "<td>".$myArray[$wlPlate][0][3]."</td>"; } else { print "<td>Vehicle Not Seen</td>"; print "<td>Vehicle Not Seen</td>"; print "<td>Vehicle Not Seen</td>"; } print "</tr>"; } } print "</table>"; $startLoopDate = $startLoopDate + $oneDay; } } }

    Read the article

  • Using UNION in a query with PHP [migrated]

    - by work
    I have an SQL query which links 3 tables using UNION: $sql ="(SELECT Drive.DriveID,Ram.Memory from Drive,Ram where Drive.DriveID = Ram.RamID) UNION (SELECT Drive.DriveID,External.Memory from Drive, External where Drive.DriveID = External.ExtID)"; Suppose I want to get Ram.Name as well. How do I do this? If I use Ram.Name in the first SELECT statement it would not produce the correct result. Any method for tackling this? I want to do it using UNION.

    Read the article

  • how can i create thumbnailed photo gallery with php?

    - by hd
    i have some pictures that want to show them as a thumbnailed photo gallery. images are in 400x300 and the thumbnails should be in 50x50. i am sure scaling photos to small size is not a good way (cause of increasing page load time), so how can i create online these thumbnails without need to save them in small size? i want to do it with php. i know how to create thumbnail with php,but in the way i know,thumbnail should be store as a file and then display it.but i don't want to store it. is it possible??

    Read the article

  • Microsoft SQL for PHP driver

    - by Jonas B
    Hello I am running a W2K3 x64 server with IIS 7 + FastCGI + PHP 5.3 (x64) I have trouble geting the SQL for php driver to work. It seems it doesn't get loaded, but no error is thrown. I've doublechedked the php.ini a multitude of times and I'm pretty sure I use the right version of the sql for php driver (version 1.1 CTP) and sql native client x64 is installed. Any ideas what could be wrong? Thanks

    Read the article

  • nginx, php-cgi and "No input file specified."

    - by Stephen Belanger
    I'm trying to get nginx to play nice with php-cgi, but it's not quite working how I'd like. I'm using some set variables to allow for dynamic host names--basically anything.local. I know that stuff is working because I can access static files properly, however php files don't work. I get the standard "No input file specified." error which normally occurs when the file doesn't exist, but it definitely does exist and the path is correct because I can access the static files in the same path. It could possibly be a permissions thing, but I'm not sure how that could be an issue. I'm running this on Windows under my own user account, so I think it should have permission unless php-cgi is running under a different user without me telling it to. . Here's my config; worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; gzip on; server { # Listen for HTTP listen 80; # Match to local host names. server_name *.local; # We need to store a "cleaned" host. set $no_www $host; set $no_local $host; # Strip out www. if ($host ~* www\.(.*)) { set $no_www $1; rewrite ^(.*)$ $scheme://$no_www$1 permanent; } # Strip local for directory names. if ($no_www ~* (.*)\.local) { set $no_local $1; } # Define default path handler. location / { root ../Users/Stephen/Documents/Work/$no_local.com/hosts/main/docs; index index.php index.html index.htm; # Route non-existent paths through Kohana system router. try_files $uri $uri/ /index.php?kohana_uri=$request_uri; } # pass PHP scripts to FastCGI server listening on 127.0.0.1:9000 location ~ \.php$ { root ../Users/Stephen/Documents/Work/$no_local.com/hosts/main/docs; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; } # Prevent access to system files. location ~ /\. { return 404; } location ~* ^/(modules|application|system) { return 404; } } }

    Read the article

  • nginx probably deliering wrong filetype for .css file with php tags

    - by Katai
    And again - NGINX is giving me many Questions today :) Like always, I already tried around for a while, but cant seem to fix this issue: I just configured NGINX to handle my .css files equal to my .php files (to parse PHP tags inside the CSS file). This works perfectly, and the file is found and delivered. I could debug it with FIrebug, and everything is OK (it displays the contents of the .css inside the opened <link> tag). So, everything working, right? Wrong. It has the CSS, but it does not interpret it! What I mean by this: apparently, the file-type of the CSS (or aplication-type, whatever) is wrong. The Page can access the CSS, but doesnt bother at all to actually use it. What I checked / tried: There are no PHP errors inside of the .css, so that one is out The .css is accessible. I can call the URI manually, or check if the included URL finds it: both works The .css has no syntax errors (i switched to a css that just has body {background-color: #000; } It works whitout NGINX I deleted the browser cache / restarted NGINX after config rewrites Here the configuration: server { listen 80; server_name localhost; access_log /var/log/nginx/board.access_log; error_log /var/log/nginx/board.error_log warn; root /var/www/board/public; index index.php; fastcgi_index index.php; location / { try_files $uri $uri /index.php; } location ~ (\.php|\.css)$ { try_files $uri =404; include /etc/nginx/fastcgi_params; #keepalive_timeout 0; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:7777; } } Firebug 'Network' Response Header: Connection keep-alive Content-Encoding gzip Content-Type text/html Date Sat, 16 Jun 2012 10:08:40 GMT Server nginx/1.0.5 Transfer-Encoding chunked X-Powered-By PHP/5.3.6-13ubuntu3.7 I think I just answered my own question. Is the Content-Type text/html the problem? How can I remove that? My personal guess is that I have to use this in some way include /etc/nginx/mime.types; default_type application/octet-stream; But I'm not sure... anyone an idea how to solve this? TLDR; CSS file is delivered correctly, but it doesnt seem to be 'used' as CSS from the browser. (Tested, works on apache)

    Read the article

  • Apache Error Upgrading to PHP 5.5

    - by user195385
    I am trying to upgrade php and received this error at the command line: httpd: Syntax error on line 493 of /private/etc/apache2/httpd.conf: Syntax error on line 8 of /private/etc/apache2/other/+php-osx.conf: Cannot load /usr/local/php5/libphp5.so into server: dlopen(/usr/local/php5/libphp5.so, 10): Symbol not found: _libiconv\n Referenced from: /usr/local/php5/lib/libintl.8.dylib\n Expected in: /usr/lib/libiconv.2.dylib\n in /usr/local/php5/lib/libintl.8.dylib I was trying to upgrade at http://php-osx.liip.ch/ using the command: curl -s http://php-osx.liip.ch/install.sh | bash -s 5.5 Any help would be appreciated!

    Read the article

  • Hide .php add a slash

    - by Matthew
    This script works perfect it forces the trailing slash and hides the .php extension BUT! it does not redirect people going directly to the .php extension. How can I also force people going directly to the file.php to /file/ RewriteEngine On RewriteRule ^(.*)/$ /$1.php [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !(.*)/$ RewriteRule ^(.*)$ http://www.mysite.com/$1/ [R=301,L]

    Read the article

  • Notepad++: Adding color highlighting for PHP functions?

    - by Jebego
    I've recently begun using Notepad++, and have found a part of its styling functionality that confuses me. I'm currently attempting to color all of PHP's defined functions (such as count(), strlen(), etc.). In the Settings-Style Configurator, you cannot add a new style for such a function list. Instead, I have begun editing the stylers.xml and langs.xml. To add the new coloring, in langs.xml, I've modified the php section to the following: <Language name="php" ext="php php3 phtml" commentLine="//" commentStart="/*" commentEnd="*/"> <Keywords name="instre1">[default keywords]</Keywords> <Keywords name="instre2">[my function list]</Keywords> </Language> The [default keywords] and [my function list] are replaced with wordlists. I've also edited the php section in stylers.xml to look like the following: <LexerType name="php" desc="php" ext=""> <WordsStyle name="QUESTION MARK" styleID="18" fgColor="FF0000" bgColor="FDF8E3" fontName="" fontStyle="0" fontSize="" /> <WordsStyle name="DEFAULT" styleID="118" fgColor="000000" bgColor="FEFCF5" fontName="" fontStyle="0" fontSize="" /> <WordsStyle name="STRING" styleID="119" fgColor="FF0000" bgColor="FEFCF5" fontName="" fontStyle="0" fontSize="" /> <WordsStyle name="STRING VARIABLE" styleID="126" fgColor="FF0000" bgColor="FEFCF5" fontName="" fontStyle="1" fontSize="" /> <WordsStyle name="SIMPLESTRING" styleID="120" fgColor="FF0000" bgColor="FEFCF5" fontName="" fontStyle="0" fontSize="" /> <WordsStyle name="WORD" styleID="121" fgColor="008040" bgColor="FEFCF5" fontName="" fontStyle="1" fontSize="" keywordClass="instre1">True False</WordsStyle> <WordsStyle name="NUMBER" styleID="122" fgColor="FF0000" bgColor="FEFCF5" fontName="" fontStyle="0" fontSize="" /> <WordsStyle name="VARIABLE" styleID="123" fgColor="0080FF" bgColor="FEFCF5" fontName="" fontStyle="0" fontSize="" /> <WordsStyle name="COMMENT" styleID="124" fgColor="FF8040" bgColor="FEFCF5" fontName="" fontStyle="0" fontSize="" /> <WordsStyle name="COMMENTLINE" styleID="125" fgColor="FF8040" bgColor="FEFCF5" fontName="" fontStyle="0" fontSize="" /> <WordsStyle name="OPERATOR" styleID="127" fgColor="8000FF" bgColor="FEFCF5" fontName="" fontStyle="0" fontSize="" /> <WordsStyle name="FUNCTIONS" styleID="128" fgColor="000080" bgColor="FEFCF5" fontName="" fontStyle="1" fontSize="" keywordClass="instre2"></WordsStyle> </LexerType> The changed part is the last "FUNCTIONS" line. When I restart Notepad++ and go into the Settings-Style Configurator section, under the php language, the FUNCTIONS style exists. I can change the style's color, and can see the entire keyword list under 'Default Keywords'. However, it is not changing the coloring of the words in my code. When I edit the WORD style, which contains stuff like 'if', 'and', and 'true', things change accordingly in my code. Any ideas on how to make this work?

    Read the article

  • PHP hits 100% CPU and eats RAM at the same time Monday to Friday

    - by Daniel Samuels
    We run a learning platform for primary schools here in the UK and it's all been running extremely well. However at around 4PM Monday to Friday we see the same issue arise -- 1-2 PHP threads will spike to 100% CPU and gradually start eating up RAM until the server(s) fall over. 98%+ of our requests are HTTPS, these come into our Layer 7 load balancer which then decrypts the SSL data, adds the X-HTTP-Forwarded-For header and forwards the data onto an application server (we have 2 of those at the moment) on port 80. Our application servers have Varnish on port 80 which takes in the request from the load balancer and passes the request through to Nginx on port 81. Nginx then works out which 'vhost' it needs to use and passes any PHP processing through to PHP-CGI which is listening on a socket (managed through spawn-fcgi). There's an instance of Memcached running too, MySQL runs on a separate server / slave setup. Throughout the day the load will typically go no higher than 0.8 on either of the application servers, however at around 4PM our problem arises. I've managed to run strace on a few of the actual threads when they cause the problem and I always see the same thing: stat("/usr/share/zoneinfo/Europe/London", {st_mode=S_IFREG|0644,st_size=3661, ...}) = 0 stat("/usr/share/zoneinfo/Europe/London", {st_mode=S_IFREG|0644,st_size=3661, ...}) = 0 This is repeated infinitely and never stops until you SEGKILL the process or oomkiller kills it. There are no cron jobs scheduled to run at that time and I don't have any way of seeing exactly what Nginx request is associated with the PHP process which is running. We are running PHP 5.3.14 which we upgraded to from 5.3.8 last week to rule out the older version being the problem. This issue has been going on a few months now and we have no idea what is causing it. We deploy our software very frequently, so it's difficult to track down a specific release which may have started the problem - especially as we do not know the date of the first occurrence of this issue. Varnish is version 3.0.1, Nginx is 1.0.6 (which I understand is about a year old now), our servers are running CentOS release 5.7 (Final) they have Intel i3 540s at 3.07Ghz and 8GB of RAM. There's a discussion on the Debian mailing list about something very similar, you can find that here. Has anyone seen anything like this in the past, does anyone have any ideas or suggestions? Are there a way of linking an Nginx request directly to a PHP thread? Is there a better way of seeing what the PHP process is doing? (I've seen GDB mentioned, though I'll have to recompile PHP) Thanks!

    Read the article

  • PHP-FPM performing worse than mod_php

    - by lordstyx
    Recently the website I maintain has been growing a lot and I saw the point coming where I'd want to switch from apache to nginx, because I kept on reading that it performs way better. Now I've done the switch, and I have to say, nginx is keeping up just fine. However, php-fpm is forming a problem. Where the php pages used to take 0.1 second to generate with the same load they now take around 3 seconds! Furthermore the error.log from nginx is being spammed with errors like: upstream timed out (110: Connection timed out) while connecting to upstream, client: ... I also tried using unix sockets instead, but those would complain about the following: connect() to unix:/tmp/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream I've fiddled with settings here and there but nothing seems to work. Changing the amount of pm.max_children doesn't seem to help a lot either, but with it's current amount at 350 it seems to be the lesser of all evil. The server that's being used has 3 GB RAM (not all of it is free due to a MySQL server also running) along with 2 dual-core processors (4 cores in total). Am I doing something majorly wrong with the settings here, or is the server simply not capable enough? EDIT: Here is the nginx server block server { listen 80; listen [::]:80 default ipv6only=on; root /var/www; index index.php index.html index.htm; server_name localhost; location / { try_files $uri $uri/ /index.html; } location /doc/ { alias /usr/share/doc/; autoindex on; allow 127.0.0.1; deny all; } location = /50x.html { root /usr/share/nginx/www; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini try_files $uri = 404; # With php5-cgi alone: fastcgi_pass 127.0.0.1:9000; # With php5-fpm: #fastcgi_pass unix:/tmp/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } location ~ /\.ht { deny all; } } And the php-fpm pool: [www] user = www-data group = www-data listen = 127.0.0.1:9000 ;listen = /tmp/php5-fpm.sock listen.backlog = -1 pm = dynamic pm.max_children = 350 pm.start_servers = 200 pm.min_spare_servers = 10 pm.max_spare_servers = 350 pm.max_requests = 1536 rlimit_files = 65536 rlimit_core = unlimited chdir = /

    Read the article

  • How to downgrade a certain ubuntu 10.04 package (php) back to karmic

    - by Eugene
    Hi! I've updated from 9.10 to 10.04 but unfortunately the PHP provided with 10.04 is not yet supported by zend optimizer. As far as I understand I need to somehow replace the PHP 5.3 package provided under 10.04 with an older PHP 5.2 package provided under 9.10. However I am not sure whether this is the right way to downgrade PHP and if yes, I don't know how to replace the 10.04 package with 9.10 package. Could you please help me with that?

    Read the article

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