Search Results

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

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

  • Why does PHP overwrite values when I iterate through this array twice (by reference, by value)

    - by jeremy
    If I iterate through an array twice, once by reference and then by value, PHP will overwrite the last value in the array if I use the same variable name for each loop. This is best illustrated through an example: $array = range(1,5); foreach($array as &$element) { $element *= 2; } print_r($array); foreach($array as $element) { } print_r($array); Output: Array ( [0] = 2 [1] = 4 [2] = 6 [3] = 8 [4] = 10 ) Array ( [0] = 2 [1] = 4 [2] = 6 [3] = 8 [4] = 8 ) Note that I am not looking for a fix, I am looking to understand why this is happening. Also note that it does not happen if the variable names in each loop are not each called $element, so I'm guessing it has to do with $element still being in scope and a reference after the end of the first loop.

    Read the article

  • Troubles with DateTime and PHP 5.2

    - by Nate Wagar
    I'm attempting to use the PHP DateTime class on a server with PHP 5.2.6, with a test server running PHP 5.3. Here is the code: <?php try { $dt = new DateTime('2009-10-08'); $dt->setDate(2009,10,8); print_r($dt); }catch (Exception $e) { echo $e->getMessage(); } On the test server, things work flawlessly, this is what prints: DateTime Object ( [date] => 2009-10-08 00:00:00 [timezone_type] => 3 [timezone] => America/New_York ) On the server I need to use it on, however, this is what prints: DateTime Object ( ) Removing the setDate makes no difference whatsoever. Any ideas why this might be happening? Thanks!

    Read the article

  • Getting a file pointer from file descriptor

    - by Naga Kiran
    In PHP 5.2.3, "fdopen" was used to read/write to a file descriptor that's opened by another application. fdopen(<fileDescriptorId>,"rw"); //It worked fine with PHP 5.2.3 After upgrading PHP to 5.3.2, it's throwing "undefined reference to 'fdopen' function". Please suggest whats the replacement for this in PHP 5.3.2 or any workaround.

    Read the article

  • PHP Magic faster than simply setting the class attribute?

    - by Marc Trudel
    Well, not exactly that, but here is an example. Can anyone explain the difference between B and C? How can it be faster to use a magic function to dynamically set a value instead of simply setting the value in the attribute definition? Here is some code: [root@vm-202-167-238-17 ~]# cat test.php; for d in A B C; do echo "------"; ./test.php $d; done; #!/usr/bin/php <?php $className = $argv[1]; class A { public function __get($a) { return 5; } } class B { public $a = 5; } class C { public function __get($a) { $this->a = 5; return 5; } } $a = new $className; $start = microtime(true); for ($i=0; $i < 1000000; $i++) $b = $a->a; $end = microtime(true); echo (($end - $start) * 1000) ." msec\n"; ------ 598.90794754028 msec ------ 205.48391342163 msec ------ 189.7759437561 msec

    Read the article

  • PHP 5.3: Late static binding doesn't work for properties when defined in parent class while missing in child class

    - by DavidPesta
    Take a look at this example, and notice the outputs indicated. <?php class Mommy { protected static $_data = "Mommy Data"; public static function init( $data ) { static::$_data = $data; } public static function showData() { echo static::$_data . "<br>"; } } class Brother extends Mommy { } class Sister extends Mommy { } Brother::init( "Brother Data" ); Sister::init( "Sister Data" ); Brother::showData(); // Outputs: Sister Data Sister::showData(); // Outputs: Sister Data ?> My understanding was that using the static keyword would refer to the child class, but apparently it magically applies to the parent class whenever it is missing from the child class. (This is kind of a dangerous behavior for PHP, more on that explained below.) I have the following two things in mind for why I want to do this: I don't want the redundancy of defining all of the properties in all of the child classes. I want properties to be defined as defaults in the parent class and I want the child class definition to be able to override these properties wherever needed. The child class needs to exclude properties whenever the defaults are intended, which is why I don't define the properties in the child classes in the above example. However, if we are wanting to override a property at runtime (via the init method), it will override it for the parent class! From that point forward, child classes initialized earlier (as in the case of Brother) unexpectedly change on you. Apparently this is a result of child classes not having their own copy of the static property whenever it isn't explicitly defined inside of the child class--but instead of throwing an error it switches behavior of static to access the parent. Therefore, is there some way that the parent class could dynamically create a property that belongs to the child class without it appearing inside of the child class definition? That way the child class could have its own copy of the static property and the static keyword can refer to it properly, and it can be written to take into account parent property defaults. Or is there some other solution, good, bad, or ugly?

    Read the article

  • Any PHP MVC framework planning to use 5.3 features?

    - by alexandrul
    I would like to get started with PHP, and 5.3 release seems to bring many nice features (namespaces, lambda functions, and many others). I have found some MVC frameworks, and some of them support only PHP 5: PHP Frameworks PHP MVC Frameworks Model–view–controller on Wikipedia but can anyone recommend one of those MVC frameworks that plans to actively use PHP 5.3 features, not just being compatible with PHP 5.3? Update Results so far: Zend Framework 2.0 (in development) Lithium (in development, based on CakePHP) Symfony (in development) FLOW3 (in development, alpha)

    Read the article

  • PHP 5 functioning returning an array- interaction without assignment?

    - by Lee
    I'm wondering if this kind of thing will ever be possible in PHP (and whether it already is and I'm just missing something...) <?php function test() { return array( 'id'=>10, 'name'=>'John' ); } echo 'Your name is: '.test()['name']; ?> I'd really like to be able to use returned arrays directly instead of first assigning them to a var... possible?

    Read the article

  • Fastest way to check for value existance.

    - by Itay Moav
    I have a list of values I have to check my input against it for existence. What is the faster way? This is really out of curiosity on how the internals work, not any stuff about premature optimization etc... 1. $x=array('v'=>'','c'=>'','w'=>); .. .. array_key_exists($input,$x); 2. $x=array('v','c','w'); .. .. in_array($input,$x);

    Read the article

  • Parse error after upgrading to PHP 5.3

    - by poer
    I have a php code that works well in PHP 5.2 but throwing "Parse error: syntax error, unexpected '}'" after upgrading to PHP 5.3. When I use echo/print or heredocs to print all the HTML part of the code, the error is gone. My question is, why this error occurred? Is this mean that in PHP 5.3 we are no longer allowed to put HTML code inside PHP code? This is my php code: function pk_stt2_admin_print_delete_form(){ global $wpdb; if ( isset($_POST['delete_terms']) && !empty($_POST['delete_terms']) ){ $msg = 'Search terms'; $success = pk_stt2_db_delete_searchterms( $_POST['delete_terms'] ); } elseif ( isset($_POST['delete_all']) ){ $msg = 'All search terms'; $success = pk_stt2_db_delete_searchterms( 'delete_all_terms' ); } else { ?> <div id="message" class="updated fade"> <p> Please enter the search terms to be deleted, separate them with a comma. </p> </div> <?php } if ( $success ){ ?> <div id="message" class="updated fade"> <p> <?php echo $msg; ?> have been deleted, <?php echo $success; ?> rows effected. </p> </div> <?php } else { ?> <div id="message" class="updated fade"> <p> Failed to delete search terms. </p> </div> <?php } } Thanks.

    Read the article

  • Unable to load PHP5 with a new installation of Apache?

    - by Doug
    Cannot load /usr/lib/apache2/modules/libphp5.so into server: /usr/lib/apache2/modules/libphp5.so: undefined symbol: unixd_config I spent the last hour or so googling, and it seems that I have to create a new PHP5 after installing my new Apache (2.4.2). Debian didn't have Apache 2.4.2 and it's a requirement I was given. I still have the PHP 5.4.4 from Debian wheezy repository. I tried including it in the new Apache 2.4.2 that I installed, but it throws the error you see above. Is there a way to "reglue" everything? I was going to just install a fresh PHP, but I ran into some errors on ./configure, so I wanted to see if there were easier ways before I spend more time on installing a new copy.

    Read the article

  • Nothing is written in php5-fpm.log

    - by jaypabs
    I have two servers which is Ubuntu 12.04 and Ubuntu 14.04. When I use Ubuntu 14.04 in my new server and enabled the php-fpm log file found under /etc/php5/fpm/php-fpm.conf that reads as follows: error_log = /var/log/php5-fpm.log I noticed that most of the log that I found in Ubuntu 12.04 is not written in 14.04. For example, if I restart php5-fpm in my Ubuntu 12.04, a restart log is being written, however, this does not happen in 14.04. Another log which I missed in 14.04 are the following: [23-Aug-2014 16:23:03] NOTICE: [pool web42] child 118098 exited with code 0 after 12983.480191 seconds from start [23-Aug-2014 16:23:03] NOTICE: [pool web42] child 147653 started [23-Aug-2014 17:27:31] WARNING: [pool web8] child 76743, script '/var/www/mysite.com/web/wp-comments-post.php' (request: "POST /wp-comments-post.php") executing too slow (12.923022 sec), logging I really wanted to have this kind of log so I will know the length of time a slow script has executed. Does anyone know if there are other settings in Ubuntu 14.04 that I need to change in addition to /etc/php5/fpm/php-fpm.conf?

    Read the article

  • php5-suhosin Broken Installation

    - by h00j
    Hi i get the following error when trying to install, have you any idea how to fix? apt-get install php5-suhosin Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: php5-suhosin : Depends: phpapi-20090626 E: Unable to correct problems, you have held broken packages. I get the following error in my apache2 error log [Mon May 07 21:43:15 2012] [error] [client ip] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525/suhosin.so' - /usr/lib/php5/20100525/suhosin.so: cannot open shared object file: No such file or directory in Unknown on line 0

    Read the article

  • Apache downloads php files instead of running their source

    - by Devils Child
    I have just recently upgraded PHP 5.3 to 5.4 on my Debian Squeeze server. Now, instead of executing PHP files, Apache just downloads them, which is really bad. When I try to follow these steps, I get "broken packages" upon installing the libapache2-mod-php5 package. Also the answer tells me to add something to my httpd.conf, but it's empty. Question: How can I make apache execute php files again, instead of just passing them through as download? dpkg -l | grep php returns this rc libapache2-mod-php5 5.3.3-7+squeeze15 server-side, HTML-embedded scripting language (Apache 2 module) rc php5-cli 5.3.3-7+squeeze15 command-line interpreter for the php5 scripting language ii php5-common 5.4.15-1~dotdeb.2 Common files for packages built from the php5 source rc php5-gd 5.3.3-7+squeeze15 GD module for php5 rc php5-mcrypt 5.3.3-7+squeeze15 MCrypt module for php5 rc php5-mysql 5.3.3-7+squeeze15 MySQL module for php5 rc php5-suhosin 0.9.32.1-1 advanced protection module for php5 rc phpmyadmin 4:3.3.7-7 MySQL web administration tool And apt-get install libapache2-mod-php5 produces this error The following packages have unmet dependencies: libapache2-mod-php5 : Depends: libdb5.1 but it is not installable Depends: libssl1.0.0 (>= 1.0.0) but it is not installable Depends: libxml2 (>= 2.8.0) but 2.7.8.dfsg-2+squeeze7 is to be installed Recommends: php5-cli but it is not going to be installed E: Broken packages

    Read the article

  • apache2 + mod_fastcgi + suexec + php5.2 = unstable on high load...

    - by redguy..pl
    I am hosting several (~30) different sites on one server with apache2+fastcgi+suexec+php5. Sites have different loads and different execution times of their scripts (some of them process request for 5-7 seconds, some <1sek). Sometimes when single site receives very high load (all php instances of this site are created and used) - whole apache server hangs. Apache (worker mpm) creates new processes up to the upper limit. It looks like it is starting to queue ALL new request for EVERY site, not only the one that has high load and quickly achieves process limits... restart of apache solves the problem... config: FastCgiConfig -singleThreshold 1 -multiThreshold 10 -listen-queue-depth 30 -maxProcesses 80 -maxClassProcesses 12 -idle-timeout 30 -pass-header HTTP_AUTHORIZATION -pass-header If-Modified-Since -pass-header If-None-Match (earlier have default -listen-queue-depth = 100, but it didn't change anything...) Any suggestions? Another question - how is implemented this listen queue? is it one queue for whole apache, or unique queue for every defined php apllication (suexec site)? I would like to achieve something like this: when one site receives high load and its queue is full - server bounces next request, but only for this one site.. Other sites should work properly...

    Read the article

  • can I have multiline text with GD and PHP?

    - by alekone
    hello! I'm trying to output multiline text with GD+PHP but can't get it working. my php knowledge is really basic. here's the code, any idea on how to output 2 or 3 lines of text? $theText = (isset($_GET['caption']))? stripslashes($_GET['caption']) :''; imagettftext($baseImage, $textSize, $textAngle, $textXposition, $textYposition, $textColor, $fontName, $theText);

    Read the article

  • httpd 2.2.15 + suPHP + suExec + php5 = permission and information ?

    - by Prix
    Hi, i am currently playing around with suexec, suphp, php5 on my apache on slackware 13.1. Everything is installed and working properly but now i did like to got further into the directory permissions and at suphp settings and options available. initially i was planning to leave suphp disabled unless a virtualhost has it specified to be enabled but it does not seem to work, see sample: mod_php.conf which is included in my httpd.conf # # mod_php & mod_suPHP - PHP Hypertext Preprocessor module # # Load the PHP module: LoadModule php5_module lib/httpd/modules/libphp5.so # Load the suPHP module: LoadModule suphp_module lib/httpd/modules/mod_suphp.so <IfModule mod_php5.c> # Tell Apache to feed all *.php files through PHP. If you'd like to # parse PHP embedded in files with different extensions, comment out # these lines and see the example below. <FilesMatch \.php$> SetHandler application/x-httpd-php </FilesMatch> </IfModule> <IfModule mod_suphp.c> # This option tells mod_suphp if a PHP-script requested on this server (or # VirtualHost) should be run with the PHP-interpreter or returned to the # browser "as it is". suPHP_Engine off </IfModule> With the above first sample it makes suPHP and PHP not work if i comment out the php5 stuff but the module it will run just fine ... So my first question is, how could i possible make this setup work ? Leave suPHP disabled using php5 by default and if a virtualhost has suPHP enabled it will disable php5 and use suPHP. if any information is lacked here please let me know and i will update with any additional information you may need. Thanks in advance.

    Read the article

  • Why when i rotate the image black borders appear? PHP GD

    - by EAGhost
    This code generates two images using GD and rotates one of them. When I rotate the image black borders begin to appear. Anyone have an idea of how to resolve this? imagefilledrectangle($im, 0, 0, 300, 400, $black); imagefilledrectangle($im, 1, 1, 298, 398, $grey); imagefilledrectangle($im, 49, 69, 251, 271, $black); imagefilledrectangle($im, 50, 70, 250, 270, $white); imagefttext($im, 13, 0, 90, 30, $black, $font_file, "Wind Direcction"); $source=imagecreatetruecolor(100, 100); imagefilledrectangle($source, 0, 0, 100, 100, $white); $values = array( 20, 30, // Point 1 (x, y) 50, 0, 80, 30, 65, 30, 65, 100, 35, 100, 35, 30 // Point 7 (x, y) ); imagefilledpolygon($source, $values, 7, $black1); $asd=imagerotate($source, $rotate, 0); imagecolortransparent($asd, $black); imageantialias($asd, true); $insert_x = imagesx($asd); $insert_y = imagesy($asd); if($rotate==0 || $rotate==90 || $rotate==180 || $rotate==270){ imagecopymerge ( $im , $asd , 100 , 130 , 0 , 0 , $insert_x , $insert_y , 100 ); } if($rotate==45 || $rotate==135 || $rotate==225 || $rotate==315){ imagecopymerge ( $im , $asd , 85 , 110 , 0 , 0 , $insert_x , $insert_y , 100 ); } imageantialias($im, true); header('Content-Type: image/png'); imagepng($im); imagedestroy($im); ?

    Read the article

  • Unknown Apache2 + PHP5 FastCGI 500 error .. caused by search engine bots?

    - by rdjurovich
    My Ubuntu server is configured with Apache 2.2.8 and PHP 5.2.4-2ubuntu5.18 in FastCGI mode. Everything works well, except I am seeing 500 errors that only seem to come from bots accessing the server.. for example (access.log): x.125.71.104 - - [16/Nov/2011:10:27:39 +1100] "GET / HTTP/1.1" 500 41377 "-" "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)" x.40.103.239 - - [16/Nov/2011:11:05:56 +1100] "GET / HTTP/1.0" 500 14717 "-" "Mozilla/5.0 (compatible; mon.itor.us - free monitoring service; http://mon.itor.us)" x.249.67.114 - - [14/Nov/2011:20:57:17 +1100] "GET / HTTP/1.1" 500 101 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" x.55.39.85 - - [14/Nov/2011:19:31:06 +1100] "GET / HTTP/1.1" 500 7032 "-" "msnbot/2.0b (+http://search.msn.com/msnbot.htm)._" It is my understanding that a 500 error will be thrown when the PHP process fails to respond to Apache, which could be caused by a fatal PHP error or if PHP runs out of processes.. so my assumption is that either the bots are hitting the server too hard, killing the PHP processes, or something in the request header from bots is causing a fatal error in my PHP script? If anyone can offer advice on this it would be greatly appreciated! Ryan

    Read the article

  • Xdebug 2.0.5 with Zend Server CE PHP5.2.12 possible?

    - by notbrain
    I'm using Zend Server CE with PHP 5.2.12 on OSX Snow Leopard and want to use Xdebug. I've turned off Zend Data Cache, Zend Optimizer+, and Zend Debugger in the console. When I run $ cd ~/Downloads/xdebug-2.0.5 $ /usr/local/zend/bin/phpize I get Configuring for: PHP Api Version: 20041225 Zend Module Api No: 20060613 Zend Extension Api No: 220060519 The PHP API Version, 20041225, seems to be off from the documentation (aka wrong). When I continue installation with $ ./configure ---with-php-config=/usr/local/zend/bin/php-config $ make $ sudo make install The installed xdebug.so seems to be the wrong one. Which version of xdebug do I need for this PHP API version? The Zend API numbers are ok. I'm just confused at why the PHP API Version doesn't match. PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/xdebug.so' - (null) in Unknown on line 0 PHP 5.2.12 (cli) (built: Feb 17 2010 13:39:36)

    Read the article

  • Apache2 enable .ini mod in /etc/php5/mods-available

    - by GuiTeK
    One can use the a2enmod [module] command to enable mods located in /etc/apache2/mods-available. But what about mods in /etc/php5/mods-available? When I try to enable a mod in this directory (eg. xdebug), I get the following error: ERROR: Module xdebug does not exist! Yet, /etc/php5/mods-available/xdebug.ini exists. I understand a2enmod may work only with *.load files (it makes sense since *.ini files are just configuration files) but then what's the correct way of enabling modules located in /etc/php5/mods-available?

    Read the article

  • installing php gd on ubuntu on a vps server

    - by user235196
    I was working on localhost with resizing images and everything was great. Than I uploaded to my server and things got interesting. After searching around, looks like I have to enable php-gd on my server. I tried running the line sudo apt-get install php5-gd using putty, and it didn't work. Any ideas why? Also, after the install, I assume I will need to run the function sudo reboot right? clearly I'm not an expert in this area :p

    Read the article

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