Search Results

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

Page 12/1708 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Handling array passed to object at creation

    - by cecilli0n
    When creating my object I pass it an array of a row from my database. (everything in the array we will need, disregarding unnecessary elements at sql query level) When I need to access certain array elements from within my class, I do so like $this->row['element'] However, As I continue development, I sometimes forget what exactly is in this passed array.(this itself doesn't seem good) I am wondering if their is a professional approach to dealing with this, Or am I the only one who has these "I wonder whats in the array" thoughts. One approach to tackling this could be that when we originally pass the array, in the constructor, we assign each element of the array to its own variable, but is this considered professional practice? Additionally by doing this, we could make those variables constants, in a attempt at immutability. Overall I am trying to adhere to good software craftsmanship. Regards.

    Read the article

  • monit configuration for php-fpm

    - by Adam Jimenez
    I'm struggling to find a monit config for php-fpm that works. This is what I've tried: ### Monitoring php-fpm: the parent process. check process php-fpm with pidfile /var/run/php-fpm/php-fpm.pid group phpcgi # phpcgi group start program = "/etc/init.d/php-fpm start" stop program = "/etc/init.d/php-fpm stop" ## Test the UNIX socket. Restart if down. if failed unixsocket /var/run/php-fpm.sock then restart ## If the restarts attempts fail then alert. if 3 restarts within 5 cycles then timeout depends on php-fpm_bin depends on php-fpm_init ## Test the php-fpm binary. check file php-fpm_bin with path /usr/sbin/php-fpm group phpcgi if failed checksum then unmonitor if failed permission 755 then unmonitor if failed uid root then unmonitor if failed gid root then unmonitor ## Test the init scripts. check file php-fpm_init with path /etc/init.d/php-fpm group phpcgi if failed checksum then unmonitor if failed permission 755 then unmonitor if failed uid root then unmonitor if failed gid root then unmonitor But it fails because there is no php-fpm.sock (Centos 6)

    Read the article

  • Installing PHP 5.2.17 Dependencies on Centos 5

    - by user1114330
    I have followed the wget method here hoping it was my solution: Howto install php 5.2.17 on centos 6 x86_64 However I get the following error when trying to install: # rpm -ivh php-5.2.17-1.x86_64.rpm error: Failed dependencies: libaspell.so.15()(64bit) is needed by php-5.2.17-1.x86_64 libcrypto.so.6()(64bit) is needed by php-5.2.17-1.x86_64 libcurl.so.3()(64bit) is needed by php-5.2.17-1.x86_64 libpspell.so.15()(64bit) is needed by php-5.2.17-1.x86_64 libssl.so.6()(64bit) is needed by php-5.2.17-1.x86_64 php-cli = 5.2.17-1 is needed by php-5.2.17-1.x86_64 Would be awesome if someone could help. UPDATE: I have now installed an instance of CentOS 5 and am attempting to install php 5.2.17 yet again...anyone know the best way to deal with the following dependencies: libaspell.so.15()(64bit) is needed by php-5.2.17-1.x86_64 libgmp.so.3()(64bit) is needed by php-5.2.17-1.x86_64 libpspell.so.15()(64bit) is needed by php-5.2.17-1.x86_64 php-cli = 5.2.17-1 is needed by php-5.2.17-1.x86_64 php-common = 5.2.17-1 is needed by php-5.2.17-1.x86_64 Wondering what libgmp, libaspell, php-cli and php-common are and where to get the proper versions for php 5.2.17. Any help is most appreciated. Thank you!

    Read the article

  • PHP unable to start if "apc.shm_size" has "M" or "G" unit

    - by apasajja
    Using: Ubuntu 10.04, PHP 5.3.10, apc 3.1.3 PHP and APC installed using below repo: deb http://ppa.launchpad.net/brianmercer/php5/ubuntu lucid main deb-src http://ppa.launchpad.net/brianmercer/php5/ubuntu lucid main If I put apc.shm_size=3G or apc.shm_size=3000M in /etc/php5/fpm/conf.d/apc.ini, PHP unable to start. However, if I put only number without M or G unit, it will start and run. By default, if put only number, what unit is it means? It I put 3000 does it means 3000 MB?

    Read the article

  • Multiple PHP SAPI configuration

    - by DTest
    I'm trying to build PHP for use as an apache shared module --with-apxs2 but also with the 'php-cgi' binary (fastcgi) on Mac OSX 10.6. I'm using this ./configure : /configure --prefix=/usr/local/PHP \ --with-apxs2=/usr/local/apache/bin/apxs \ --disable-ipv6 \ --enable-cgi \ --with-curl \ --with-mysqli=/usr/local/mysql/bin/mysql_config \ --with-openssl=/usr \ --enable-ftp \ --enable-shared \ --enable-soap \ --enable-sockets \ --enable-zip \ --with-zlib-dir It builds the apache php5.so module just fine, but in /usr/local/PHP/bin, there is no php-cgi file. If I build it without the --with-apxs2 option (and indeed, I don't even need the --enable-cgi option) the php-cgi file gets built with no problems. Background on my setup: PHP 5.3.4, Apache 2.2.14, Mac OSX 10.6, Tomcat with JavaBridge (which is why I need the php-cgi file) Without the apxs2 option, /usr/local/php/bin/php -v produces: PHP 5.3.4 (cli) (built: Dec 21 2010 21:35:14) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies and /usr/local/php/bin/php-cgi -v produces: PHP 5.3.4 (cgi-fcgi) (built: Dec 21 2010 21:35:12) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies My question is, what am I not understanding with php SAPIs that won't allow the building of the two modules at the same time? Also, can I build it --with-apxs2 the first time, then make clean and rebuild in the same PHP directory /usr/local/php for the php files without issue?

    Read the article

  • How do I make Nginx redirect all requests for files which do not exist to a single php file?

    - by Richard
    I have the following nginx vhost config: server { listen 80 default_server; access_log /path/to/site/dir/logs/access.log; error_log /path/to/site/dir/logs/error.log; root /path/to/site/dir/webroot; index index.php index.html; try_files $uri /index.php; location ~ \.php$ { if (!-f $request_filename) { return 404; } fastcgi_pass localhost:9000; fastcgi_param SCRIPT_FILENAME /path/to/site/dir/webroot$fastcgi_script_name; include /path/to/nginx/conf/fastcgi_params; } } I want to redirect all requests that don't match files which exist to index.php. This works fine for most URIs at the moment, for example: example.com/asd example.com/asd/123/1.txt Neither of asd or asd/123/1.txt exist so they get redirected to index.php and that works fine. However, if I put in the url example.com/asd.php, it tries to look for asd.php and when it can't find it, it returns 404 instead of sending the request to index.php. Is there a way to get asd.php to be also sent to index.php if asd.php doesn't exist?

    Read the article

  • LIVE Video Streaming with Nginx + PHP-FPM / Process Timeout

    - by user3393046
    I have a live video streaming in my server using nginx + php. the php file reas a live streaming and it directly sends it to the client. I have only one problem. The problem is that i want each request to be in a new process of php-fpm. In a few words i don't want to have idle timeout for a process but instead i want them to close instant when a request is being closed. With idle timeout i have huge problems which are hard to explain at the moment but i'm really sure that if i disable the idle timeout everything will be perfect. Is there any way to do this? I'm using on demand php-fpm

    Read the article

  • Executed PHP files are stale unitl "touched" (Symlinked NFS mount as web root)

    - by mmattax
    We have a PHP application that has 3 web servers (running Nginx and Apache). The web server's directory root are symlinked directories that point to an NFS mount. For example: web01 has an NFS mount at /data/webapp, which is symlinked to /home/webapp. Apache serves content from /home/webapp/www. We also use ACP for our PHP opcode cache. When we deploy code, we SCP an archive file to the NFS server and extract it. Since upgrading RedHat 6, when we deploy our code the webserver execute "stale" PHP files until touch is run on the PHP files. We thought that APC might be causing a problem, but the issue exists, even after clearing the opcode cache. Any ideas on how to diagnose why the stale PHP code is being executed?

    Read the article

  • Apache 2.4 and PHP 5.4 getting connection reset errors in the browser

    - by zuallauz
    In the weekend I upgraded my development web server to Apache 2.4 and PHP 5.4. In my web application which was previously working great on Apache 2.2 and PHP 5.3 it now starts getting these messages saying the "connection was reset" in Firefox. See screenshot. I am connecting to the linux machine via local LAN. I'm assuming it might be something to do with the new version of Apache or PHP, or the new LAMP stack which I downloaded from BitNami? It would seem to happen every 5-10 requests and throw this error, perhaps more likely to trigger it is if I send a POST request from a page. Is it timing out the script or something? These are just basic dynamic pages I'm loading and they worked perfectly in Apache 2.2 and PHP5.3. Here are my httpd.conf and PHP.ini if that has any clues. Any ideas? Any help much appreciated.

    Read the article

  • PHP include_path doesn't work

    - by 50ndr33
    I have the documents at http://www.example.com/ in /home/www/example.com/www running on Debian Squeeze. /home/www/example.com/ www/ index.php php/ include_me.php In the php.ini I've uncommented and changed to: include_path =".:/home/www/example.com" In a script index.php in www, I have require_once("/php/include_me.php"). The output I am getting from PHP is: Warning: require_once(/php/include_me.php) [function.require-once]: failed to open stream: No such file or directory in /home/www/example.com/www/index.php on line 2 Fatal error: require_once() [function.require]: Failed opening required '/php/include_me.php' (include_path='.:/home/www/example.com') in /home/www/example.com/www/index.php on line 2 As you can see, the include-path is set correctly according to the error. But if I do require_once("../php/include_me.php");, it works. Therefore, something has to be wrong with the include-path. Does anyone know what I can do to fix it?

    Read the article

  • "Installing" GD for PHP

    - by gbuckingham89
    I'm new to server admin & Linux and have just got a VPS running CentOS 6. Apache, MySQL and PHP all came installed (along with cPanel and WHM), however I'm now also trying to install the GD library. I've run "yum install php-gd" and it installed ok. If I run it again I get "Package php-gd-5.3.2-6.el6_0.1.x86_64 already installed and latest version". However, when I do a phpinfo() or from the command line "php -m" there is no mention of GD. Is there anything else I need to do?

    Read the article

  • PHP Sessions suddenly not working

    - by styrken
    Out of no where my php sessions does not work anymore. The server have been running fine for several months. I'am running Ubuntu 11.10 (GNU/Linux 3.0.0-14-server x86_64) with nginx/1.0.11 and php 5.3.19-1~dotdeb.0 Session info copied from phpinfo() Session Support enabled Registered save handlers files user memcached Registered serializer handlers php php_binary wddx Directive Local Value Master Value session.auto_start Off Off session.bug_compat_42 Off Off session.bug_compat_warn Off Off session.cache_expire 180 180 session.cache_limiter nocache nocache session.cookie_domain no value no value session.cookie_httponly Off Off session.cookie_lifetime 0 0 session.cookie_path / / session.cookie_secure Off Off session.entropy_file no value no value session.entropy_length 0 0 session.gc_divisor 1000 1000 session.gc_maxlifetime 1440 1440 session.gc_probability 0 0 session.hash_bits_per_character 5 5 session.hash_function 0 0 session.name PHPSESSID PHPSESSID session.referer_check no value no value session.save_handler files files session.save_path /tmp /tmp session.serialize_handler php php session.use_cookies On On session.use_only_cookies On On session.use_trans_sid 0 0 I have setup the following php script to test with: error_reporting(E_ALL); ini_set('display_errors', true); error_log($_SERVER['REMOTE_ADDR'] . ' visited test page'); if(session_start()) echo "Session started <br />"; else echo "Session failed <br />"; echo '<a href="?', time(), '">refresh</a>', "\n"; echo '<pre>'; echo 'session id: ', session_id(), "\n"; $sessionfile = ini_get('session.save_path') . '/' . 'sess_'.session_id(); echo 'session file: ', $sessionfile, ' '; if ( file_exists($sessionfile) ) { echo 'size: ', filesize($sessionfile), "\n"; echo '# ', file_get_contents($sessionfile), ' #'; } else { echo ' does not exist'; } echo PHP_EOL; $_SESSION['number'] = (int) @$_SESSION['number'] + 1; var_dump($_SESSION); echo "</pre>\n"; session_write_close(); echo 'done.'; It tells me that the session file exists, but my session id changes on each refresh.. What is going wrong? There is no output to any error logs at all.. :/ Please help!

    Read the article

  • Dynamically writing page titles and active classes with php

    - by toomanyairmiles
    For some time now I've been using the following code to dynamically write in html page titles and add an active class to menu items. Is this still a good why to achieve this or are there better/smarter/optimal ways of achieving the same thing? <?php echo (basename($_SERVER['SCRIPT_FILENAME'])=='contact.php'? 'class="active"' : '');?> Menu example <ul id="nav"> <li><a href="index.php" target="_parent" <?php echo (basename($_SERVER['SCRIPT_FILENAME'])=='index.php'? 'class="active"' : '');?>><span>Home</span></a></li> <li><a href="services.php" target="_parent" <?php echo (basename($_SERVER['SCRIPT_FILENAME'])=='services.php'? 'class="active"' : '');?><?php echo (basename($_SERVER['SCRIPT_FILENAME'])=='services-landlords.php'? 'class="active"' : '');?><?php echo (basename($_SERVER['SCRIPT_FILENAME'])=='services-sellers.php'? 'class="active"' : '');?><?php echo (basename($_SERVER['SCRIPT_FILENAME'])=='services-tennants.php'? 'class="active"' : '');?>><span>Our Services</span></a></li> <li><a href="for-sale.php" target="_parent" <?php echo (basename($_SERVER['SCRIPT_FILENAME'])=='sales.php'? 'class="active"' : '');?>><span>Sales</span></a></li> <li><a href="to-let.php" target="_parent" <?php echo (basename($_SERVER['SCRIPT_FILENAME'])=='lettings.php'? 'class="active"' : '');?>><span>Lettings</span></a></li> <li><a href="register.php" target="_parent" <?php echo (basename($_SERVER['SCRIPT_FILENAME'])=='register.php'? 'class="active"' : '');?><?php echo (basename($_SERVER['SCRIPT_FILENAME'])=='register-thanks.php'? 'class="active"' : '');?>><span>Register</span></a></li> <li><a href="contact.php" target="_parent" <?php echo (basename($_SERVER['SCRIPT_FILENAME'])=='contact.php'? 'class="active"' : '');?>><span>Contact Us</span></a></li> </ul> Page title Example <?php echo (basename($_SERVER['SCRIPT_FILENAME'])=='services.php'? 'Services' : '');?> <?php echo (basename($_SERVER['SCRIPT_FILENAME'])=='services-landlords.php'? 'Services for Landlords' : '');?>

    Read the article

  • php split array into smaller even arrays

    - by SoulieBaby
    I have a function that is supposed to split my array into smaller, evenly distributed arrays, however it seems to be duplicating my data along the way. If anyone can help me out that'd be great. Here's the original array: Array ( [0] => stdClass Object ( [bid] => 42 [name] => Ray White Mordialloc [imageurl] => sp_raywhite.gif [clickurl] => http://www.raywhite.com/ ) [1] => stdClass Object ( [bid] => 48 [name] => Beachside Osteo [imageurl] => sp_beachside.gif [clickurl] => http://www.beachsideosteo.com.au/ ) [2] => stdClass Object ( [bid] => 53 [name] => Carmotive [imageurl] => sp_carmotive.jpg [clickurl] => http://www.carmotive.com.au/ ) [3] => stdClass Object ( [bid] => 51 [name] => Richmond and Bennison [imageurl] => sp_richmond.jpg [clickurl] => http://www.richbenn.com.au/ ) [4] => stdClass Object ( [bid] => 50 [name] => Letec [imageurl] => sp_letec.jpg [clickurl] => www.letec.biz ) [5] => stdClass Object ( [bid] => 39 [name] => Main Street Mordialloc [imageurl] => main street cafe.jpg [clickurl] => ) [6] => stdClass Object ( [bid] => 40 [name] => Ripponlea Mitsubishi [imageurl] => sp_mitsubishi.gif [clickurl] => ) [7] => stdClass Object ( [bid] => 34 [name] => Adrianos Pizza & Pasta [imageurl] => sp_adrian.gif [clickurl] => ) [8] => stdClass Object ( [bid] => 59 [name] => Pure Sport [imageurl] => sp_psport.jpg [clickurl] => http://www.puresport.com.au/ ) [9] => stdClass Object ( [bid] => 33 [name] => Two Brothers [imageurl] => sp_2brothers.gif [clickurl] => http://www.2brothers.com.au/ ) [10] => stdClass Object ( [bid] => 52 [name] => Mordialloc Travel and Cruise [imageurl] => sp_morditravel.jpg [clickurl] => http://www.yellowpages.com.au/vic/mordialloc/mordialloc-travel-cruise-13492525-listing.html ) [11] => stdClass Object ( [bid] => 57 [name] => Southern Suburbs Physiotherapy Centre [imageurl] => sp_sspc.jpg [clickurl] => http://www.sspc.com.au ) [12] => stdClass Object ( [bid] => 54 [name] => PPM Builders [imageurl] => sp_ppm.jpg [clickurl] => http://www.hotfrog.com.au/Companies/P-P-M-Builders ) [13] => stdClass Object ( [bid] => 36 [name] => Big River [imageurl] => sp_bigriver.gif [clickurl] => ) [14] => stdClass Object ( [bid] => 35 [name] => Bendigo Bank Parkdale / Mentone East [imageurl] => sp_bendigo.gif [clickurl] => http://www.bendigobank.com.au ) [15] => stdClass Object ( [bid] => 56 [name] => Logical Services [imageurl] => sp_logical.jpg [clickurl] => ) [16] => stdClass Object ( [bid] => 58 [name] => Dicount Lollie Shop [imageurl] => new dls logo.jpg [clickurl] => ) [17] => stdClass Object ( [bid] => 46 [name] => Patterson Securities [imageurl] => cmyk patersons_withtag.jpg [clickurl] => ) [18] => stdClass Object ( [bid] => 44 [name] => Mordialloc Personal Trainers [imageurl] => sp_mordipt.gif [clickurl] => # ) [19] => stdClass Object ( [bid] => 37 [name] => Mordialloc Cellar Door [imageurl] => sp_cellardoor.gif [clickurl] => ) [20] => stdClass Object ( [bid] => 41 [name] => Print House Graphics [imageurl] => sp_printhouse.gif [clickurl] => ) [21] => stdClass Object ( [bid] => 55 [name] => 360South [imageurl] => sp_360.jpg [clickurl] => ) [22] => stdClass Object ( [bid] => 43 [name] => Systema [imageurl] => sp_systema.gif [clickurl] => ) [23] => stdClass Object ( [bid] => 38 [name] => Lowe Financial Group [imageurl] => sp_lowe.gif [clickurl] => http://lowefinancial.com/ ) [24] => stdClass Object ( [bid] => 49 [name] => Kim Reed Conveyancing [imageurl] => sp_kimreed.jpg [clickurl] => ) [25] => stdClass Object ( [bid] => 45 [name] => Mordialloc Sporting Club [imageurl] => msc logo.jpg [clickurl] => ) ) Here's the php function which is meant to split the array: function split_array($array, $slices) { $perGroup = floor(count($array) / $slices); $Remainder = count($array) % $slices ; $slicesArray = array(); $i = 0; while( $i < $slices ) { $slicesArray[$i] = array_slice($array, $i * $perGroup, $perGroup); $i++; } if ( $i == $slices ) { if ($Remainder > 0 && $Remainder < $slices) { $z = $i * $perGroup +1; $x = 0; while ($x < $Remainder) { $slicesRemainderArray = array_slice($array, $z, $Remainder+$x); $remainderItems = array_merge($slicesArray[$x],$slicesRemainderArray); $slicesArray[$x] = $remainderItems; $x++; $z++; } } }; return $slicesArray; } Here's the result of the split (it somehow duplicates items from the original array into the smaller arrays): Array ( [0] => Array ( [0] => stdClass Object ( [bid] => 57 [name] => Southern Suburbs Physiotherapy Centre [imageurl] => sp_sspc.jpg [clickurl] => http://www.sspc.com.au ) [1] => stdClass Object ( [bid] => 35 [name] => Bendigo Bank Parkdale / Mentone East [imageurl] => sp_bendigo.gif [clickurl] => http://www.bendigobank.com.au ) [2] => stdClass Object ( [bid] => 38 [name] => Lowe Financial Group [imageurl] => sp_lowe.gif [clickurl] => http://lowefinancial.com/ ) [3] => stdClass Object ( [bid] => 39 [name] => Main Street Mordialloc [imageurl] => main street cafe.jpg [clickurl] => ) [4] => stdClass Object ( [bid] => 48 [name] => Beachside Osteo [imageurl] => sp_beachside.gif [clickurl] => http://www.beachsideosteo.com.au/ ) [5] => stdClass Object ( [bid] => 33 [name] => Two Brothers [imageurl] => sp_2brothers.gif [clickurl] => http://www.2brothers.com.au/ ) [6] => stdClass Object ( [bid] => 40 [name] => Ripponlea Mitsubishi [imageurl] => sp_mitsubishi.gif [clickurl] => ) ) [1] => Array ( [0] => stdClass Object ( [bid] => 44 [name] => Mordialloc Personal Trainers [imageurl] => sp_mordipt.gif [clickurl] => # ) [1] => stdClass Object ( [bid] => 41 [name] => Print House Graphics [imageurl] => sp_printhouse.gif [clickurl] => ) [2] => stdClass Object ( [bid] => 39 [name] => Main Street Mordialloc [imageurl] => main street cafe.jpg [clickurl] => ) [3] => stdClass Object ( [bid] => 48 [name] => Beachside Osteo [imageurl] => sp_beachside.gif [clickurl] => http://www.beachsideosteo.com.au/ ) [4] => stdClass Object ( [bid] => 33 [name] => Two Brothers [imageurl] => sp_2brothers.gif [clickurl] => http://www.2brothers.com.au/ ) [5] => stdClass Object ( [bid] => 40 [name] => Ripponlea Mitsubishi [imageurl] => sp_mitsubishi.gif [clickurl] => ) ) [2] => Array ( [0] => stdClass Object ( [bid] => 56 [name] => Logical Services [imageurl] => sp_logical.jpg [clickurl] => ) [1] => stdClass Object ( [bid] => 43 [name] => Systema [imageurl] => sp_systema.gif [clickurl] => ) [2] => stdClass Object ( [bid] => 48 [name] => Beachside Osteo [imageurl] => sp_beachside.gif [clickurl] => http://www.beachsideosteo.com.au/ ) [3] => stdClass Object ( [bid] => 33 [name] => Two Brothers [imageurl] => sp_2brothers.gif [clickurl] => http://www.2brothers.com.au/ ) [4] => stdClass Object ( [bid] => 40 [name] => Ripponlea Mitsubishi [imageurl] => sp_mitsubishi.gif [clickurl] => ) ) [3] => Array ( [0] => stdClass Object ( [bid] => 53 [name] => Carmotive [imageurl] => sp_carmotive.jpg [clickurl] => http://www.carmotive.com.au/ ) [1] => stdClass Object ( [bid] => 45 [name] => Mordialloc Sporting Club [imageurl] => msc logo.jpg [clickurl] => ) [2] => stdClass Object ( [bid] => 33 [name] => Two Brothers [imageurl] => sp_2brothers.gif [clickurl] => http://www.2brothers.com.au/ ) [3] => stdClass Object ( [bid] => 40 [name] => Ripponlea Mitsubishi [imageurl] => sp_mitsubishi.gif [clickurl] => ) ) [4] => Array ( [0] => stdClass Object ( [bid] => 59 [name] => Pure Sport [imageurl] => sp_psport.jpg [clickurl] => http://www.puresport.com.au/ ) [1] => stdClass Object ( [bid] => 54 [name] => PPM Builders [imageurl] => sp_ppm.jpg [clickurl] => http://www.hotfrog.com.au/Companies/P-P-M-Builders ) [2] => stdClass Object ( [bid] => 40 [name] => Ripponlea Mitsubishi [imageurl] => sp_mitsubishi.gif [clickurl] => ) ) [5] => Array ( [0] => stdClass Object ( [bid] => 46 [name] => Patterson Securities [imageurl] => cmyk patersons_withtag.jpg [clickurl] => ) [1] => stdClass Object ( [bid] => 34 [name] => Adriano's Pizza & Pasta [imageurl] => sp_adrian.gif [clickurl] => # ) ) [6] => Array ( [0] => stdClass Object ( [bid] => 55 [name] => 360South [imageurl] => sp_360.jpg [clickurl] => ) [1] => stdClass Object ( [bid] => 37 [name] => Mordialloc Cellar Door [imageurl] => sp_cellardoor.gif [clickurl] => ) ) [7] => Array ( [0] => stdClass Object ( [bid] => 49 [name] => Kim Reed Conveyancing [imageurl] => sp_kimreed.jpg [clickurl] => ) [1] => stdClass Object ( [bid] => 58 [name] => Dicount Lollie Shop [imageurl] => new dls logo.jpg [clickurl] => ) ) [8] => Array ( [0] => stdClass Object ( [bid] => 51 [name] => Richmond and Bennison [imageurl] => sp_richmond.jpg [clickurl] => http://www.richbenn.com.au/ ) [1] => stdClass Object ( [bid] => 52 [name] => Mordialloc Travel and Cruise [imageurl] => sp_morditravel.jpg [clickurl] => http://www.yellowpages.com.au/vic/mordialloc/mordialloc-travel-cruise-13492525-listing.html ) ) [9] => Array ( [0] => stdClass Object ( [bid] => 50 [name] => Letec [imageurl] => sp_letec.jpg [clickurl] => www.letec.biz ) [1] => stdClass Object ( [bid] => 36 [name] => Big River [imageurl] => sp_bigriver.gif [clickurl] => ) ) ) ^^ As you can see there are duplicates from the original array in the newly created smaller arrays. I thought I could remove the duplicates using a multi-dimensional remove duplicate function but that didn't work. I'm guessing my problem is in the array_split function. Any suggestions? :)

    Read the article

  • PHP Warning: PHP Startup: Unable to load dynamic library php_mysql.dll, Mac 10.6, Apache 2.2, php 5

    - by munchybunch
    I'm trying to use the PHP CLI, and when I enter something like php test.php in the command line it returns: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20090626/php_mysql.dll' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20090626/php_mysql.dll, 9): image not found in Unknown on line 0 something test.php contains: <?php echo 'something'; ?> I checked /usr/lib/php/extensions/no-debug-non-zts-20090626/, and as expected the .dll file isn't there. I'm a complete beginner when it comes to this - what is happening, and how can I fix it? A search of my system for "php_msyql.dll" reveals nothing. Does it have to do with how I compiled it? I don't have the original version of php that came with the mac, I think - I may have reinstalled it somewhere along the way. Any help would be appreciated!

    Read the article

  • PHP - a different open_basedir per each virtual host

    - by Lopoc
    Hi I've came across on this problem, I have a sever running apache and php. We have many virtual hosts but we've noticed that a potentially malicious user could use his web space to browse other user's files(via a simple php script) and even system files, this could happens due to the php permissions. A way to avoid it is to set the open_basedir var in php.ini, yhis is very simple in a single host system, but in case of virtual hosts there would be a basebir per each host. Ho can I set dis basedir per each user/host? is there a way to let apache hereditate php privileges of the php file that has been requested E.G. /home/X_USER/index.php has as owner X_USER, when apache read the file index.php it checks its path and owner, simply I'm looking for a system set php basedir variable to that path. Thank in advance Lopoc

    Read the article

  • need to query MongoDB using php

    - by Mario Villarroel
    I need to query mongodb with something like this: ("something" < X OR "something" = "nll") AND ("someother"X OR "someother"= "nll") AND z=$z AND s=1 I've tried a few things, but can't get it to work, this is what I've tried: find( array( '$or'=array(array("something"=array("$le",$X)),array("something"="nll")), '$or'=array(array("someother"=array("$ge",$X)),array("someother"="nll")) )) But that's getting me the OR overwritten, so I'm lost on that... After diggin a bit more, I assembled this code that seems to be what I need, but doesn't work either: find( array('$and'=array( array( '$or' = array( array("something"=array('$gte'=$X)),array("something"="nll"))), array('$or' = array( array("someother"=array('$lte'=$X)),array("someother"="nll")))),"Z"=$z, "s"="1"); But this doesn't work as it returns zero results and I know for sure that there are more than 2 items that match on the db. (100% certain)

    Read the article

  • Recommendation for PHP-FPM pm.max_children, PHP-FPM pm.start_servers and others

    - by jaypabs
    I have the following server: Intel® Xeon® E3-1270 v2 Single Processor - Quad Core Dedicated Server CPU Speed: 4 x 3.5 Ghz w/ 8MB Smart Cache Motherboard: SuperMicro X9SCM-F Total Cores: 4 Cores + 8 Threads RAM: 32 GB DDR3 1333 ECC Hard Drive: 120GB Smart Cache: 8MB I am using ubuntu 12.04 - nginx, php, mysql with ISPConfig 3. Under ISPConfig 3 website settings: I have this default value: PHP-FPM pm.max_children = 10 PHP-FPM pm.start_servers = 2 PHP-FPM pm.min_spare_servers = 1 PHP-FPM pm.max_spare_servers = 5 PHP-FPM pm.max_requests = 0 My question is what is the recommended settings for the above variable? Because I found some using a different settings.

    Read the article

  • Install php-fpm + php-mysql + MariaDB on Centos from repos

    - by Alexander
    I try to take CentOS 6.4 x64 and install nginx w/ php-fpm on it (and that's easy part, no problem at all), then add php-mysql package and MariaDB as a mysql drop-in replacement. And here I face the hang... I've added epel, nginx and remi repos, add priority=10 line to its .repo files, and now as I install MariaDB-server the dependency also brings me MariaDB's "common" package. Then, as I try to install php-mysql, I see file /usr/share/mysql/french/errmsg.sys from install of MariaDB-server-5.5.27-1.x86_64 conflicts with file from package mysql-libs-5.5.28-1.el6.remi.x86_64 warnings. If I deinstall MariaDB server, I'm able to install mysql-libs and php-mysql, but it won't allow me to install MariaDB later. Is there any way to escape that (infinite) loop? I believe the solution is simple but still can't see it. Please help to install php-fpm + php-mysql and MariaDB as DB server!

    Read the article

  • php.ini file creation in server

    - by tibin mathew
    Hi, I am developing a php website. I cant see php.ini file in my server. my host will not provide it. So i'm now going to create a copy of that php.ini file. so i have tried system() i searched in google and i got this link. http://drupal.org/node/290592 Here they are using like this system("cp /usr/local/php5/lib/php.ini /home/YOURUSERNAME/php.ini"); in my server when i looked the phpinfo my php.ini location is /ms/svc/php5/conf/php.ini and when i looked for the current directory of my server using this $dir_path = str_replace( $_SERVER['DOCUMENT_ROOT'], "", dirname(realpath(FILE)) ) . DIRECTORY_SEPARATOR; i got my current directory as /netapp/whnas-swamp/s11/s11/01712/www.sample.com/webdocs/ so my system command will now look lke this system("/ms/svc/php5/conf/php.ini /netapp/whnas-swamp/s11/s11/01712/www.sample.com/webdocs/php.ini"); i have named this page as getthephpini.php and when i b rowse this page i got a blank page but no new php.ini file created in my server. Is any mistake in that code??? Can any one show me the correct way Please help me Thanks

    Read the article

  • PHP - Find parent key of array

    - by Jordan Rynard
    I'm trying to find a way to return the value of an array's parent key. For example, from the array below I'd like to find out the parent's key where $array['id'] == "0002". The parent key is obvious because it's defined here (it would be 'products'), but normally it'd be dynamic, hence the problem. The 'id' and value of 'id' is known though. [0] => Array ( [data] => [id] => 0000 [name] => Swirl [categories] => Array ( [0] => Array ( [id] => 0001 [name] => Whirl [products] => Array ( [0] => Array ( [id] => 0002 [filename] => 1.jpg ) [1] => Array ( [id] => 0003 [filename] => 2.jpg ) ) ) ) )

    Read the article

  • useful customize/enhanced php functions that make thing easy and better

    - by I Like PHP
    Hello All, i like to work in php bcoz it's just amazing language. please share basic, useful, enhanced and customize function that make things better and easy in php and must be used in our all PHP project, i m sharing some of them please share your customize function that may be useful for everyone alternative/ enhanced print_r() and var_dump() function watch( $what ) { echo '<pre>'; if ( is_array( $what ) ) { print_r ( $what ); } else { var_dump ( $what ); } echo '</pre>'; } usage: 1. watch($_POST); // to see all post variable 2. watch($array); // to see any variable may b array, string or a variable enhanced mysql_escape_string() for multidimensional array to prevent sql injection function recursive_escape(&$value) { if (is_array($value)) array_map('recursive_escape', $value); else $value = mysql_escape_string($value); } usage array_map('recursive_escape', $_POST); ---------------------For encoding Get variables-------------------------------------- function nkode($k) { if ( is_array( $k ) ) return array_map("base64_encode",$k); else return base64_encode($k); } ---------------------for decoding varaibles from GET--------------------------------- function dkode($k) { if ( is_array( $k ) ) return array_map("base64_decode",$k); else return base64_decode($k); } Usage <a href="somelink.php?pid=<?php echo nkode($someid)?>"> and on next page(somelink.php) $findID=dkode($_GET[pid]); date convert to mm/dd/yyyy to yyyy-mm-dd( if we use date datatype in mysql) and also change into mm/dd/yyyy to disply on page function dateconvert($date,$func) { if ($func == 1){ //insert conversion list($month, $day, $year) = split('[/.-]', $date); $date = "$year-$month-$day"; return $date; } if ($func == 2){ //output conversion list($year, $month, $day) = split('[-.]', $date); $date = "$month/$day/$year"; return $date; } } usage $firstDate=dateconvert($_POST['firstdate'],1); // for insertion in database $showDate=dateconvert($fetch->date_field,2) // to display on browser to clean(sql injection proof) data before doing some action with that variable function cleandata($data) { $success=0; $data=trim($data); $data=strtolower($data); $data=strip_tags($data); return $data; } usage cleandata($_POST[username]); cleandata($_GET[pid]); please share any basic function that must be used , Thanks

    Read the article

  • About conversion of simplexmlobject to array.

    - by Rishi2686
    Hi guys, I tried the way you told but really messing up on some points. I am getting array fields but when it comes to children nodes, i go off the track. here giving single user's simplexml object only : SimpleXMLElement Object ( [users] = SimpleXMLElement Object ( [@attributes] = Array ( [type] = array ) [user] = Array ( [0] = SimpleXMLElement Object ( [id] = 1011 [name] = saroj [location] = SimpleXMLElement Object ( ) [description] = SimpleXMLElement Object ( ) [profile_image_url] = http://a5.example.com/profile_images/img_normal.jpg [url] = SimpleXMLElement Object ( ) [created_at] = Fri Apr 16 17:04:13 +0000 2010 [status] = SimpleXMLElement Object ( [created_at] = Wed May 26 02:56:03 +0000 2008 [id] = 1473 [text] = hi enjoying here! [in_reply_to_user_id] = SimpleXMLElement Object ( ) ) ) To get this into array I am writing code as below : $users = simplexml_load_string($xml); $arr2 = array(); foreach($users->users->user as $user) { $arr1 = array(); foreach($user as $k=>$v) { $arr1[$k] = (string) $v; } $arr2[] = $arr1; } I am getting all the fields as expected from arr2() instead of the status field which contains an array (imp: id & created_at fields repeated), it gives just key as status. While trying differently i get some of the fields of status array too. Please help me on this, i am really trying it from last two days. Help will be greatly appreciated.

    Read the article

  • Array data to display in table cells where col and row are given in array

    - by Saleem
    I have a array Array ( Array ( [id] => 1 , [schedule_id] => 4 , [subject] => Subject 1 , [classroom] => 1 , [time] => 08:00:00 , [col] => 1 , [row] => 1 ), Array ( [id] => 2 , [schedule_id] => 4 , [subject] => Subject 2 , [classroom] => 1 , [time] => 08:00:00 , [col] => 2 , [row] => 1 ), Array ( [id] => 3 , [schedule_id] => 4 , [subject] => Subject 3 , [classroom] => 2 , [time] => 09:00:00 , [col] => 1 , [row] => 2 ), Array ( [id] => 4 , [schedule_id] => 4 , [subject] => Subject 4 , [classroom] => 2 , [time] => 09:00:00 , [col] => 2 , [row] => 2 ) ) I want to display it in table format according to col and row value col 1 & row 1 col 2 $ row 1 1st array data 2nd array data Subject, room, time Subject, room, time 1, 1, 08:00 2, 1, 08:00 col 1 $ row 2 col 2 $ row 2 3rd array data 4th array data Subject, room, time Subject, room, time 3, 2, 09:00 4, 2, 08:00 I am new to arrays and need you support to sort this table. Thanks

    Read the article

  • How to add an array value to the middle of an associative array?

    - by Citizen
    Lets say I have this array: $array = array('a'=>1,'z'=>2,'d'=>4); Later in the script, I want to add the value 'c'=>3 before 'z'. How can I do this? EDIT: Yes, the order is important. When I run a foreach() through the array, I do NOT want this newly added value added to the end of the array. I am getting this array from a mysql_fetch_assoc() EDIT 2: The keys I used above are placeholders. Using ksort() will not achieve what I want. EDIT 3: http://www.php.net/manual/en/function.array-splice.php#88896 accomplishes what I'm looking for but I'm looking for something simpler. EDIT 4: Thanks for the downvotes. I gave feedback to your answers and you couldn't help, so you downvoted and requested to close the question because you didn't know the answer. Thanks. EDIT 5: Take a sample db table with about 30 columns. I get this data using mysql_fetch_assoc(). In this new array, after column 'pizza' and 'drink', I want to add a new column 'full_dinner' that combines the values of 'pizza' and 'drink' so that when I run a foreach() on the said array, 'full_dinner' comes directly after 'drink'

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >