Search Results

Search found 2027 results on 82 pages for 'php5 gd'.

Page 4/82 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Trying to generate proportionally cropped thumbnails at a fixed width/height with PHP GD

    - by Chuck
    I'm trying to create a Thumbnail Generator in PHP with GD that will take an image and reduce it to a fixed width/height. The square it takes from the original image (based on my fixed width/height) will come from the center of the image to give a proportionally correct thumbnail. I'll try to demonstrate that confusing sentence with some nice ASCII :} LANDSCAPE EXAMPLE: XXXXXXXXXXXXXXXX XXXXOOOOOOOOXXXX XXXXOOOOOOOOXXXX XXXXOOOOOOOOXXXX XXXXOOOOOOOOXXXX XXXXXXXXXXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX PORTRAIT EXAMPLE: XXXXXXXX XXXXXXXX OOOOOOOO OOOOOOOO OOOOOOOO OOOOOOOO XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX As you can see, it pulls out a square from the center of the image to use as a thumbnail. It seems simple, in theory, to get the height/width of the image and then calculate the offset based on my fixed width/height to get the thumbnail. But I can't seem to think of a way to code it :/ Also, how would I go about resizing the image before pulling out the center square? So the thumbnail contains a detailed image of the original rather than some zoomed in graphic?

    Read the article

  • [PHP-GD] Background transperancy in imagerotate()

    - by KPL
    Hello people, Since last 2 days, I was trying to add transperancy to the background after rotating an image using imagerotate() PHP-GD function. But, to my great disappointment, it's not working at all. It's just giving out a black background behind it. Here's my code - $patchImageS = 'image.png'; // the image to be patched over the final bg $patchImage = imagecreatefrompng($patchImageS); // resource of image to be patched $patchImage = imagerotate($patchImage, 23, 0, 0); imagepng($patchImage,'tt.png'); I tried to change the parameters being passed in function to imagerotate($patchImage, 23, 5, 0); imagerotate($patchImage, 23, 0, 5); Any help would be highly appreciated.

    Read the article

  • Create a picture with GD containing other images

    - by Jensen
    Hi, I would like to create a picture in PHP with GD composed by different other pictures. For example I have 6 pictures (or more) and I would like to create ONE picture who contain these different pictures. The Difficulty is that my final picture must have a fixed width and height (304x179), so if the different pictures are too big they must be cut. This is an example from IconFinder : This picture is composed by 6 images, but the 3rd bird (green) is cutted, and the 4, 5 and 6 are cutted in the bottom. This is what I want, can you give me some help to write this code in PHP ? Thanks

    Read the article

  • PHP GD issues with ImageCreateTrueColor and PNGs

    - by DrPheltRight
    I am resizing PNG images using the GD image library function ImageCopyResampled(). It all works fine, I can even keep alpha blending transparency with the use of ImageCreateTrueColor() rather than using ImageCreate() to create the resized image. The problem is, that if I use ImageCreateTrueColor() rather than ImageCreate() the file size of PNG files increases from something like 80kb to 150kb. If I use ImageCreate() the file size stays around the same size, but colors screw! So my question is, how can I retain alpha blending when resizing PNG images without increasing the file size? Oh and I am reducing the dimensions of the PNGs.

    Read the article

  • How can I override mod-php5's .php mapping to php4-cgi per VirtualHost or Directory?

    - by geocoo
    I am running Debian Linux with apache2 and libapache2-mod-php5 5.3.3-7. I have one VirtualHost which requires php4. So I researched and compiled php4-cgi. However, I cannot seem to: Override mod-php5's mapping of .php in that vhost (or even globally, without disabling php completley). Even find where that mapping is made, in hope of disabling it and enabling mod-php5 or php4-cgi per vhost. This is my php4-cgi mapping (Inside the one php4 vhost): ScriptAlias /php4 /usr/local/php4/bin <Directory /usr/local/php4/bin> Options +ExecCGI +FollowSymLinks </Directory> <Directory /www/test> AddHandler php4-cgi-script .php Action php4-cgi-script /php4/php Options +ExecCGI </Directory> This does not work, mod-php5 still runs all .php files in that vhost/directory. If I change the file extension in the AddHandler above from .php to .php4, then .php4 files do run php4-cgi as expected, but I can't change all the files in the app to .php4. I thought maybe I could disable the mod-php5's mapping in my vhost or directory, then do my cgi-config (as above) but many combinations of these in different contexts did not work: RemoveHandler .php RemoveType .php php_flag engine off (this seems to even disable my php4-cgi so that wont work) The only other place I can find any mapping is in /etc/mime.types, but commenting out the relevant lines and restarting apache2 does not affect mod-php5's .php mapping. I have searched as much as I can, it is now a mystery to me. Any help or direction would be greatly appreciated.

    Read the article

  • compiling php5.4 on macosx 10.6.8

    - by ling
    I'm trying to compile php 5.4.7 on mac osx 10.6.8. I could install it using the default procedure: ./configure \ --prefix=/usr/local \ --with-config-file-path=/usr/local/etc \ --with-apxs2=/usr/local/apache2/bin/apxs \ --with-mysql sudo make clean sudo make sudo make install But now if I try to install to compile php with the curl module it fails: ./configure \ --prefix=/usr/local \ --with-config-file-path=/usr/local/etc \ --with-curl=/usr \ --with-apxs2=/usr/local/apache2/bin/apxs \ --with-mysql sudo make clean sudo make = last lines of make output: Undefined symbols: "_CRYPTO_set_locking_callback", referenced from: _zm_shutdown_curl in interface.o _zm_startup_curl in interface.o "_CRYPTO_num_locks", referenced from: _zm_shutdown_curl in interface.o _zm_startup_curl in interface.o "_CRYPTO_get_id_callback", referenced from: _zm_startup_curl in interface.o "_CRYPTO_set_id_callback", referenced from: _zm_shutdown_curl in interface.o _zm_startup_curl in interface.o ld: symbol(s) not found collect2: ld returned 1 exit status make: * [libs/libphp5.bundle] Error 1 I read somewhere ( http://user.xmission.com/~georgeps/documentation/tutorials/compilation_and_makefiles.html ) that in this case, I should tell the compiler where to find the missing library, so that it can links the missing files. The problem is that I don't what library I should look for, is it libssl2 ?

    Read the article

  • How can I enable PHP5 for a site? Having problems with every single method.

    - by user347662
    I'm working on a client site that is hosted on someone's DIY Debian Linux server [Apache/1.3.33 (Debian GNU/Linux)], and I'm trying to install a script that requires PHP5. By default, the server parses .php files with PHP 4.3.10-22, which is configured at /etc/php4/apache/php.ini, according to phpinfo(). On the server I can see a config directory for PHP5 adjacent to the PHP4 directory: /etc/php5.0/apache2/php.ini. I have tried multiple methods to enable PHP5 for the document root where the site's files are hosted, including all available methods mentioned here. By far, the most common suggestion I've found is to add one or both of the following lines to the site's .htaccess file: AddHandler application/x-httpd-php5 .php AddType application/x-httpd-php5 .php Trouble is, when either or both of those lines are present, the site forces my browser to download any .php files requested, without parsing the PHP at all. All of the other methods mentioned in the above article cause a 500 Internal Server Error. There is no hosting control panel I can access in a browser to enable PHP5 for the site, but I do have shell access. When I asked the server administrator about this issue, he encouraged me to search for the answer on Google. Where could I begin to troubleshoot this issue? Are there ways to test or verify the server's specific PHP5 installation and configuration, using the command line or some other method? Do you have other suggestions to enable PHP5?

    Read the article

  • PNG composition using GD and PHP

    - by Dominic
    I am trying to take a rectangular png and add depth using GD by duplicating the background and moving it down 1 pixel and right 1 pixel. I am trying to preserve a transparent background as well. I am having a bunch of trouble with preserving the transparency. Any help would be greatly appreciated. Thanks! $obj = imagecreatefrompng('rectangle.png'); $depth = 5; $obj_width = imagesx($obj); $obj_height = imagesy($obj); imagesavealpha($obj, true); for($i=1;$i<=$depth;$i++){ $layer = imagecreatefrompng('rectangle.png'); imagealphablending( $layer, false ); imagesavealpha($layer, true); $new_obj = imagecreatetruecolor($obj_width+$i,$obj_height+$i); $new_obj_width = imagesx($new_obj); $new_obj_height = imagesy($new_obj); imagealphablending( $new_obj, false ); imagesavealpha($new_obj, true); $trans_color = imagecolorallocatealpha($new_obj, 0, 0, 0, 127); imagefill($new_obj, 0, 0, $trans_color); imagecopyresampled($new_obj, $layer, $i, $i, 0, 0, $obj_width, $obj_height, $obj_width, $obj_height); //imagesavealpha($new_obj, true); //imagesavealpha($obj, true); } header ("Content-type: image/png"); imagepng($new_obj); imagedestroy($new_obj);

    Read the article

  • Problem with php GD image not creating

    - by ThinkingInBits
    With the following code, my browser is returning 'image not created or saved'. I assure you the location of the image exists. So the line within the if statement is returning false for some reason, and yes GD is installed. Any ideas? if ($img = @imagecreatefromjpeg("/var/www/images/upload/1/1.jpg")) { $image_width = imagesx($img); $image_height = imagesy($img); $target_width = 150; $target_height = 150; if ($image_width > $image_height) { $percentage = ($target_width / $image_width); } else { $percentage = ($target_height / $image_height); } $new_image_width = round($image_width * $percentage); $new_image_height = round($image_height * $percentage); $imgResized = imagecreatetruecolor($new_image_width, $new_image_height); imagecopyresampled($imgResized, $img, 0, 0, 0, 0, $new_image_width, $new_image_height, $image_width, $image_height); imagejpeg($imgResized, $this->path, 100); imagedestroy($img); imagedestroy($imgResized); $this->storeThumbnailLocation(); } else { die ("image was not created or saved"); }

    Read the article

  • Upgrade php5-gd on 12.04?

    - by metrobalderas
    I'm working with the GD library for image manipulation, to which I need to create some transparent PNGs. Instead, I'm getting a black background. I've looked everywhere on how to generate a blank, transparent PNG canvas with it and all the answers just don't work for me. On further inspection, I'm working with an old GD version: The functions needed to create a transparent PNG requires 2.0.1 altough 2.0.28 or later is recommended. I installed php5-gd with apt-get, and aptitude haven't found new packages. Do I have to add a new PPA? Where can I find it? What about forcing a version? Thanks in advance!

    Read the article

  • PHP GD Allowed memory size exhausted

    - by gurun8
    I'm trying to process a directory of JPEG images (roughly 600+, ranging from 50k to 500k) using PHP: GD to resize and save the images but I've hit a bit of a snag quite early in the process. After correctly processing just 3 images (30K, 18K and 231K) I get a Allowed memory size of 16777216 bytes exhausted PHP Fatal error. I'm cycling through the images and calling the code below: list($w, $h) = getimagesize($src); if ($w > $it->width) { $newwidth = $it->width; $newheight = round(($newwidth * $h) / $w); } elseif ($w > $it->height) { $newheight = $it->height; $newwidth = round(($newheight * $w) / $h); } else { $newwidth = $w; $newheight = $h; } // create resize image $img = imagecreatetruecolor($newwidth, $newheight); $org = imagecreatefromjpeg($src); // Resize imagecopyresized($img, $org, 0, 0, 0, 0, $newwidth, $newheight, $w, $h); imagedestroy($org); imagejpeg($img, $dest); // Free up memory imagedestroy($img); I've tried to free up memory with the imagedestroy function but it doesn't seem to have any affect. The script just keeps consistently choking at the imagecreatefromjpeg line of code. I checked the php.ini and the memory_limit = 16M setting seems like it's holding correctly. But I can't figure out why the memory is filling up. Shouldn't it be releasing the memory back to the garbage collector? I don't really want to increase the memory_limit setting. This seems like a bad workaround that could potentially lead to more issues in the future. FYI: I'm running my script from a command prompt. It shouldn't affect the functionality but might influence your response so I thought I should mention it. Can anyone see if I'm just missing something simple or if there's a design flaw here? You'd think that this would be a pretty straightforward task. Surely this has to be possible, right?

    Read the article

  • PHP+GD creating random black thumbnails

    - by rroberto
    Hello, This function is creating some random black images like.. 10% of the time, is not much, but.. you know.. shouldnt be happening. class ImgResizer { private $originalFile = ''; public function __construct($originalFile = '') { $this -> originalFile = $originalFile; } public function resize($newWidth, $targetFile) { if (empty($newWidth) || empty($targetFile)) { return false; } $src = imagecreatefromjpeg($this -> originalFile); list($width, $height) = getimagesize($this -> originalFile); $newHeight = ($height / $width) * $newWidth; if ($newHeight<'335') { //$newHeight='335'; } $tmp = imagecreatetruecolor($newWidth, $newHeight); #$tmp = imagecreate($newWidth, $newHeight); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height); if (file_exists($targetFile)) { unlink($targetFile); } imagejpeg($tmp, $targetFile, 85); // 85 is my choice, make it between 0 – 100 for output image quality with 100 being the most luxurious } } no errors given in error_log. Here is gd_info(): Array( [GD Version] => bundled (2.0.34 compatible) [FreeType Support] => [T1Lib Support] => [GIF Read Support] => 1 [GIF Create Support] => 1 [JPG Support] => 1 [PNG Support] => 1 [WBMP Support] => 1 [XPM Support] => 1 [XBM Support] => 1 [JIS-mapped Japanese Font Support] => )1 server is linux. function is being called like this: assuming $imagen is the actual source image, and $imagendestino is the path and filename of the new thumbnail. if (!file_exists($imagendestino)) { $work = new ImgResizer($imagen); $work -> resize(475, $imagendestino); } Thanks in advance!

    Read the article

  • imagecreatefromjpeg() stops working after server upgrade

    - by John Conde
    We have a server located at a local company's place of business running Solaris/Apache/PHP. They recently did an update to Solaris, Apache, and PHP (security update patches, etc.). Unfortunately it has caused the image manipulation portion of our software to break. imagecreatefromjpeg() is now generating the following error: Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: '/path/to/file/filename.jpg' is not a valid JPEG file in /path/to/file/Image.class.php on line XX No PHP code was changed during the server upgrade and it was fully functional before the software upgrades. I checked the files being passed to imagecreatefromjpeg() and they are indeed valid (they open successfully in both image editing software and in my browser). I checked the permissions of the directory from which the files are being opened and they do have read permission. GD library is enabled. I'm not sure what else I can check. Based on the scenario above I am guessing something changed in the software but I don't know what it could be. PHP was version 5.2.5 and is now 5.2.13. I appreciate any guidance as to what could be cause of this issue.

    Read the article

  • PHP/GD - Cropping and Resizing Images

    - by Alix Axel
    I've coded a function that crops an image to a given aspect ratio and finally then resizes it and outputs it as JPG: <?php function Image($image, $crop = null, $size = null) { $image = ImageCreateFromString(file_get_contents($image)); if (is_resource($image) === true) { $x = 0; $y = 0; $width = imagesx($image); $height = imagesy($image); /* CROP (Aspect Ratio) Section */ if (is_null($crop) === true) { $crop = array($width, $height); } else { $crop = array_filter(explode(':', $crop)); if (empty($crop) === true) { $crop = array($width, $height); } else { if ((empty($crop[0]) === true) || (is_numeric($crop[0]) === false)) { $crop[0] = $crop[1]; } else if ((empty($crop[1]) === true) || (is_numeric($crop[1]) === false)) { $crop[1] = $crop[0]; } } $ratio = array ( 0 => $width / $height, 1 => $crop[0] / $crop[1], ); if ($ratio[0] > $ratio[1]) { $width = $height * $ratio[1]; $x = (imagesx($image) - $width) / 2; } else if ($ratio[0] < $ratio[1]) { $height = $width / $ratio[1]; $y = (imagesy($image) - $height) / 2; } /* How can I skip (join) this operation with the one in the Resize Section? */ $result = ImageCreateTrueColor($width, $height); if (is_resource($result) === true) { ImageSaveAlpha($result, true); ImageAlphaBlending($result, false); ImageFill($result, 0, 0, ImageColorAllocateAlpha($result, 255, 255, 255, 127)); ImageCopyResampled($result, $image, 0, 0, $x, $y, $width, $height, $width, $height); $image = $result; } } /* Resize Section */ if (is_null($size) === true) { $size = array(imagesx($image), imagesy($image)); } else { $size = array_filter(explode('x', $size)); if (empty($size) === true) { $size = array(imagesx($image), imagesy($image)); } else { if ((empty($size[0]) === true) || (is_numeric($size[0]) === false)) { $size[0] = round($size[1] * imagesx($image) / imagesy($image)); } else if ((empty($size[1]) === true) || (is_numeric($size[1]) === false)) { $size[1] = round($size[0] * imagesy($image) / imagesx($image)); } } } $result = ImageCreateTrueColor($size[0], $size[1]); if (is_resource($result) === true) { ImageSaveAlpha($result, true); ImageAlphaBlending($result, true); ImageFill($result, 0, 0, ImageColorAllocate($result, 255, 255, 255)); ImageCopyResampled($result, $image, 0, 0, 0, 0, $size[0], $size[1], imagesx($image), imagesy($image)); header('Content-Type: image/jpeg'); ImageInterlace($result, true); ImageJPEG($result, null, 90); } } return false; } ?> The function works as expected but I'm creating a non-required GD image resource, how can I fix it? I've tried joining both calls but I must be doing some miscalculations. <?php /* Usage Examples */ Image('http://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png', '1:1', '600x'); Image('http://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png', '2:1', '600x'); Image('http://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png', '2:', '250x300'); ?> Any help is greatly appreciated, thanks.

    Read the article

  • PHP GD Text Transparency..

    - by Deagle
    Hello, I can't slove this. I'm trying to make a text transparency but doesn't work.. Here how it looks: qshort.com/userbar/gd.php Here how if possible to show with transparency: qshort.com/userbar/transparent.png Is that possible? Here my PHP Code: <?php header('Content-type: image/png'); $im = imagecreatefrompng("signature.png"); $white = imagecolorallocate($im, 255, 255, 255); $grey = imagecolorallocate($im, 114, 114, 114); $black = imagecolorallocate($im, 0, 0, 0); $tr = imagecolorallocatealpha($im, 255, 255, 255, 20); $trg = imagecolorallocatealpha($im, 114, 114, 114, 50); $font = 'TCCB.TTF'; $mtext="Money: $0"; $mx="261"; $my="80"; $ms="16"; imagettftext($im, $ms, 0, $mx+1, $my, $grey, $font, $mtext); imagettftext($im, $ms, 0, $mx-1, $my, $grey, $font, $mtext); imagettftext($im, $ms, 0, $mx, $my+1, $grey, $font, $mtext); imagettftext($im, $ms, 0, $mx, $my-1, $grey, $font, $mtext); imagettftext($im, $ms, 0, $mx, $my, $white, $font, $mtext); $atext="Score: 0"; $ax="261"; $ay="100"; $as="16"; imagettftext($im, $as, 0, $ax+1, $ay, $grey, $font, $atext); imagettftext($im, $as, 0, $ax-1, $ay, $grey, $font, $atext); imagettftext($im, $as, 0, $ax, $ay+1, $grey, $font, $atext); imagettftext($im, $as, 0, $ax, $ay-1, $grey, $font, $atext); imagettftext($im, $as, 0, $ax, $ay, $white, $font, $atext); $ctext="Properties: 0"; $cx="261"; $cy="120"; $cs="16"; imagettftext($im, $cs, 0, $cx+1, $cy, $grey, $font, $ctext); imagettftext($im, $cs, 0, $cx-1, $cy, $grey, $font, $ctext); imagettftext($im, $cs, 0, $cx, $cy+1, $grey, $font, $ctext); imagettftext($im, $cs, 0, $cx, $cy-1, $grey, $font, $ctext); imagettftext($im, $cs, 0, $cx, $cy, $white, $font, $ctext); $ntext="Nickname"; $nx="20"; $ny="45"; $ns="35"; imagettftext($im, $ns, 0, $nx+1, $ny, $trg, $font, $ntext); imagettftext($im, $ns, 0, $nx-1, $ny, $trg, $font, $ntext); imagettftext($im, $ns, 0, $nx, $ny+1, $trg, $font, $ntext); imagettftext($im, $ns, 0, $nx, $ny-1, $trg, $font, $ntext); imagettftext($im, $ns, 0, $nx, $ny, $tr, $font, $ntext); imagepng($im); imagedestroy($im); ?> Thanks, Waiting for answer.

    Read the article

  • My PNG has transparency, but after saving with PHP GD, transparency is lost [closed]

    - by Harry Stroker
    I found the solution to my problem. See below the original post and completely at the bottom my solution. I made a stupid mistake :) First I crop an image and then save it to a png file. Right after this, I also show the image. However, the saved png does not have transparency and the shown one has. What is going on? $this->resource = imagecreatefrompng($this->url); imagealphablending($this->resource, false); imagesavealpha($this->resource, true); $newResource = imagecreatetruecolor($destWidth, $destHeight); imagealphablending($newResource, false); imagesavealpha($newResource, true); $resample = imagecopyresampled($newResource,$this->resource,0,0,$srcX1,$srcY1,$destWidth,$destHeight,$srcX2-$srcX1, $srcY2-$srcY1); imagedestroy($this->resource); $this->resource = $newResource; // SAVING imagepng($this->resource, $destination, 100); // SHOWING header('Content-type: image/png'); imagepng($this->resource); The reason I also save the image is for caching. If the script is executed on a png, it saves a cached png. Next time the image is requested, the png file will be shown, but it has lost its transparency. Even stranger: When I save that cached png image as (within Firefox), it saves it suddenly as a jpg, even though the extension was png. Downloading the cached png using chrome and opening it in Photoshop gives the error: "file-format module cannot parse the file". I will show you the shown PNG and the generated PNG: http://www.foodmuseum.nl/SaveProblemTransparency.png Once I try to show that saved PNG with the GD library, it gives me an error. EDIT NO NO NO NO THIS IS NOT A DUPLICATE!!!... I ALREADY USED THEIR SOLUTION. The solution in the supposedly duplicate works for showing my image. But I also try to save it with the exact same resource, but then it has no transparency. EDIT 2 - SOLUTION I found out what the problem was. It was a stupid mistake. The script I provided above were cut out of a class and placed as sequential code, while in real this is not what exactly happened. The save image function: function saveImage($destination,$quality = 90) { $this->loadResource(); switch($extension){ default: case 'JPG': case 'jpg': imagejpeg($this->resource, $destination, $quality); break; case 'gif': imagegif($this->resource, $destination); break; case 'png': imagepng($this->resource, $destination); break; case 'gd2': imagegd2($this->resource, $destination); break; } } However... $extension does not exist. I fixed it by adding: $extension = $this->getExtension($destination);

    Read the article

  • php5 , how makes templates?

    - by oussama17
    I am currently developing a social network using PHP5 without any framework , I create the template by this method , every time I put the header -content -footer but I found that the previous template still there , how can I make templates with this method and show me the path to the best method to play with templates in PHP5.public function affiche($afficheTPL){ $this->registry->getObject('template')->addTemplateBit('hello', 'hellop.tpl.php'); $this->registry -> getObject('template') -> buildFromTemplates($afficheTPL.'/header.tpl.php', $afficheTPL.'/main.tpl.php', $afficheTPL.'/footer.tpl.php'); $this->registry -> getObject('template') -> parseOutput(); print $this -> registry -> getObject('template') -> getPage() -> getContentToPrint(); }

    Read the article

  • Debian x86_64 + Nginx + PHP5-FPM optimization

    - by Olal'a
    I used to have a VPS (512MB) from Linode and I was running nginx + php5-fpm (which comes with php5.3.3) on Debian Lenny (i686). The total memory usage was about 90-100MB. Now I have another VPS (different hosting company) and I also run nginx + php5-fpm on Debian Lenny (x86_64). The system is 64-bit, so the memory usage is higher now, about 210-230MB, which I think is too much. Here is my php5-fpm.conf: pm = dynamic pm.max_children = 5 pm.start_servers = 2 pm.min_spare_servers = 2 pm.max_spare_servers = 5 pm.max_requests = 300 That's what top command tells me: top - 15:36:58 up 3 days, 16:05, 1 user, load average: 0.00, 0.00, 0.00 Tasks: 209 total, 1 running, 208 sleeping, 0 stopped, 0 zombie Cpu(s): 0.0%us, 0.0%sy, 0.0%ni, 99.9%id, 0.1%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 532288k total, 469628k used, 62660k free, 28760k buffers Swap: 1048568k total, 408k used, 1048160k free, 210060k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 22806 www-data 20 0 178m 67m 31m S 1 13.1 0:05.02 php5-fpm 8980 mysql 20 0 241m 55m 7384 S 0 10.6 2:42.42 mysqld 22807 www-data 20 0 162m 43m 22m S 0 8.3 0:04.84 php5-fpm 22808 www-data 20 0 160m 41m 23m S 0 8.0 0:04.68 php5-fpm 25102 www-data 20 0 151m 30m 21m S 0 5.9 0:00.80 php5-fpm 10849 root 20 0 44100 8352 1808 S 0 1.6 0:03.16 munin-node 22805 root 20 0 145m 4712 1472 S 0 0.9 0:00.16 php5-fpm 21859 root 20 0 66168 3248 2540 S 1 0.6 0:00.02 sshd 21863 root 20 0 66028 3188 2548 S 0 0.6 0:00.06 sshd 3956 www-data 20 0 31756 3052 928 S 0 0.6 0:06.42 nginx 3954 www-data 20 0 31712 3036 928 S 0 0.6 0:06.74 nginx 3951 www-data 20 0 31712 3008 928 S 0 0.6 0:06.42 nginx 3957 www-data 20 0 31688 2992 928 S 0 0.6 0:06.56 nginx 3950 www-data 20 0 31676 2980 928 S 0 0.6 0:06.72 nginx 3955 www-data 20 0 31552 2896 928 S 0 0.5 0:06.56 nginx 3953 www-data 20 0 31552 2888 928 S 0 0.5 0:06.42 nginx 3952 www-data 20 0 31544 2880 928 S 0 0.5 0:06.60 nginx So, the question is there any way to use less memory? Btw, I have 16 cores and it would be nice to make use of them...

    Read the article

  • Debian x86_64 + Nginx + PHP5-FPM optimization

    - by user55859
    I used to have a VPS (512MB) from Linode and I was running nginx + php5-fpm (which comes with php5.3.3) on Debian Lenny (i686). The total memory usage was about 90-100MB. Now I have another VPS (different hosting company) and I also run nginx + php5-fpm on Debian Lenny (x86_64). The system is 64-bit, so the memory usage is higher now, about 210-230MB, which I think is too much. Here is my php5-fpm.conf: pm = dynamic pm.max_children = 5 pm.start_servers = 2 pm.min_spare_servers = 2 pm.max_spare_servers = 5 pm.max_requests = 300 That's what top command tells me: top - 15:36:58 up 3 days, 16:05, 1 user, load average: 0.00, 0.00, 0.00 Tasks: 209 total, 1 running, 208 sleeping, 0 stopped, 0 zombie Cpu(s): 0.0%us, 0.0%sy, 0.0%ni, 99.9%id, 0.1%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 532288k total, 469628k used, 62660k free, 28760k buffers Swap: 1048568k total, 408k used, 1048160k free, 210060k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 22806 www-data 20 0 178m 67m 31m S 1 13.1 0:05.02 php5-fpm 8980 mysql 20 0 241m 55m 7384 S 0 10.6 2:42.42 mysqld 22807 www-data 20 0 162m 43m 22m S 0 8.3 0:04.84 php5-fpm 22808 www-data 20 0 160m 41m 23m S 0 8.0 0:04.68 php5-fpm 25102 www-data 20 0 151m 30m 21m S 0 5.9 0:00.80 php5-fpm 10849 root 20 0 44100 8352 1808 S 0 1.6 0:03.16 munin-node 22805 root 20 0 145m 4712 1472 S 0 0.9 0:00.16 php5-fpm 21859 root 20 0 66168 3248 2540 S 1 0.6 0:00.02 sshd 21863 root 20 0 66028 3188 2548 S 0 0.6 0:00.06 sshd 3956 www-data 20 0 31756 3052 928 S 0 0.6 0:06.42 nginx 3954 www-data 20 0 31712 3036 928 S 0 0.6 0:06.74 nginx 3951 www-data 20 0 31712 3008 928 S 0 0.6 0:06.42 nginx 3957 www-data 20 0 31688 2992 928 S 0 0.6 0:06.56 nginx 3950 www-data 20 0 31676 2980 928 S 0 0.6 0:06.72 nginx 3955 www-data 20 0 31552 2896 928 S 0 0.5 0:06.56 nginx 3953 www-data 20 0 31552 2888 928 S 0 0.5 0:06.42 nginx 3952 www-data 20 0 31544 2880 928 S 0 0.5 0:06.60 nginx So, the question is there any way to use less memory? Btw, I have 16 cores and it would be nice to make use of them...

    Read the article

  • Unable to install PHP-FPM on Apache (Failed to connect to FastCGI server)

    - by Nyxynyx
    I have been having problem installing php-fpm for use with apache2-mpm-worker. This is the guide that I am following. According to the guide's Step 5, Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization However I cannot find php5-fcgi at /usr/lib, but only /usr/bin/php5-cgi and /usr/bin/php-cgi, which I am not sure if they are the same. So I changed the lines in Step 5 to: Alias /php5-fcgi /usr/bin/php5-fcgi FastCgiExternalServer /usr/bin/php5-fcgi -host 127.0.0.1:9000 -pass-header On restarting Apache, it's logs gave the errors: [notice] caught SIGTERM, shutting down [alert] (4)Interrupted system call: FastCGI: read() from pipe failed (0) [alert] (4)Interrupted system call: FastCGI: the PM is shutting down, Apache seems to have disappeared - bye [notice] Apache/2.2.22 (Ubuntu) mod_fastcgi/mod_fastcgi-SNAP-0910052141 configured -- resuming normal operations [notice] FastCGI: process manager initialized (pid 16348) And on loading the index page [error] [client 10.0.2.2] (111)Connection refused: FastCGI: failed to connect to server "/usr/bin/php5-cgi": connect() failed [error] [client 10.0.2.2] FastCGI: incomplete headers (0 bytes) received from server "/usr/bin/php5-cgi" [error] [client 10.0.2.2] File does not exist: /var/www/mydomain/public/favicon.ico Question: Any idea why php5-fcgi is missing, and how should this problem be fixed? Thank you!! :)

    Read the article

  • Windows7 IIS7: zips don't have php5isapi.dll Can I use php.dll instead?

    - by Pete Alvin
    The page: How to Install PHP 5.2 on IIS 7and Windows Vista (and a few others) reference a mysterious php5isapi.dll which is not in the Windows install, or the zip files: php-5.3.2-Win32-VC9-x86.zip - VC9 x86 Thread Safe php-5.3.2-nts-Win32-VC9-x86.zip - VC9 x86 Non Thread Safe There was another post on stackoverflow that said it's obsolete and replaced by "fastapi" but no instructions mention this. I did find a php.dll in the zip file. Can I use that instead of php5isapi.dll? It's very frustrating trying to install basic PHP5 on Windows with MySQL.

    Read the article

  • php gd image quality

    - by apueee
    I 'm trying to add text on a specific image. Its working perfectly but the quality of image is low especially for papyrus.ttf font. How can i improve the quality of text in the image. But i need high quality to print the output. Here is my code.. its very simple. header("Content-Type: image/jpeg"); $im = imagecreatefromjpeg("cosmos.jpg"); $black = ImageColorAllocate($im, 0, 0, 0); Imagettftext($im, 14, 0, 10, 15, $black, 'papyrus.ttf', "Corey and Lisa "); Imagettftext($im, 14, 0, 10, 35, $black, 'papyrus.ttf', " 1994, june"); Imagejpeg($im, '', 100); ImageDestroy($im); Download: http://wneeds.com/gdtest.zip

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >