Search Results

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

Page 66/1708 | < Previous Page | 62 63 64 65 66 67 68 69 70 71 72 73  | Next Page >

  • wamp - Changing PHP version stops server running

    - by James Connor
    I downloaded wamp which works (green icon). However I need to test a site locally in Joomla 1.5 which caused errors when using php 5.3 I believe I need a PHP version lower then this i.e 5.2.x To do this I have gone through PHP - Version - Get More.. and installed a older PHP version. However when I start this PHP version the icon stays on an orange colour and going in localhost doesn't work. I haven't used wamp before so my knowledge of it is limited. If anyone could point me in the right direction it would be greatly appreciated, Regards.

    Read the article

  • constructing a recursive function returning an array

    - by Admiral Kunkka
    I'm developing a function that has a random chance to loop through itself and put it's results in one array for me to use later in my PHP class. Is there a better way to do this more organized, specifically case 5. The array becomes sloppy if it rolls 5, after 5, after 5 looking unpleasant. private function dice($sides) { return mt_rand(1, $sides); } private function randomLoot($dice) { switch($dice) { case 1: $array[] = "A fancy mug."; break; case 2: $array[] = "A buckler."; break; case 3: $array[] = "A sword."; break; case 4: $array[] = "A jewel."; break; case 5: $array[] = "A treasure chest with contents:"; $count = $this->dice(3); $i = 1; while($i <= $count) { $array[] = $this->randomLoot($this->dice(5)); $i++; } break; } return $array; }

    Read the article

  • I cant browse php pages in my local server

    - by tibin mathew
    Hi, I cant browse php pages in my local server.Before it was working fine. But now i cant browse php pages, i can browse html pages and asp pages , no problems with that. But when i try to browse a php page its not loading. What will be the problem?? I am using windows 2000 advanced server and my web server is Tomcat please someone help me Guys i'm not getting anything in my browser, its just continue to loading Nothing showing in that page i'm not getting any 404 error or anything like that. its just continue to be loading for example consider my file is located under insider a folder named as myproject i can reach upto this http://localhost/projects/myproject but after that i cant browse php pages inside that... http://localhost/projects/myproject/index.php this will continue to be loading, and nothing shows in that page

    Read the article

  • PHP + IIS7 + X64 OS (Windows 7 or Server 2008)

    - by Eric
    I'm going to answer my own question here, but I thought this might be important enough to post so that it would be indexed for the next person who runs into my situation. Problem: I can not seem to get PHP code to execute on a x64 bit version ofIIS7, whether it be in my desktop, Windows 7, or the application's final destination on Windows Server 2008. Every time I try and look at a test php document to confirm installation, I only see the source code. I've followed the documentation from PHP, from iis.net, blogs, howtos, just about anywhere I can find that Google would send me. I tried the web installer, tried manual installations instead of the MSI, tried version 5.3.5, tried version 5.2.17, but no matter what, the code would never execute. I even tried registering .eric files with PHP FastCGI Module, but same result, php source code only.

    Read the article

  • Sending mail from PHP with exim4

    - by jfoucher
    Hello, A web server I manage is having problems sending mail from PHP. This server uses exim4 for MTA, and it is configured correctly. I can send emails from PHP's CLI, but not from the web. i.e. if I do "php mailtest.php" on the command line, the email gets sent correctly, but if I browse to server.com/mailtest.php, mail() returns false and the email never gets sent. Nothing appears in the exim mainlog. Any advice, or things I should look for ? Thanks!

    Read the article

  • Problem with php and apache

    - by user47587
    I am having trouble using the php module with apache2. At the moment, testing with a phpinfo script, only php code is displayed as though it were text, no output at all. I have the line LoadModule php5_module libphp5.so, with an absolute path. Yet, when I do apache2 -t -D DUMP_MODULES |grep php, nothing is reported I have my error level set to warn, and the last entry in my logfile after apache starts is [notice] Apache/2.2.15 (Unix) PHP/5.2.12 mod_ssl/2.2.15 OpenSSL/0.9.8g configured -- resuming normal operations Which implies there is php support?

    Read the article

  • PHP script unable to email on OpenBSD Apache

    - by MattC
    I have a webserver running OpenBSD 4.7 and PHP 5.2.12 out of the ports tree. There is a small contact page that is supposed to send an email to a specific address. When I fill in the form using a web browser, it sends the AJAX request to the PHP page which claims it worked successfully but there is no email. The maillog is empty as well. I created a small php script that replicates this functionality and when I run it by hand using the "php -f" command, it sends an email without a problem. I think this has to do with being chrooted but I can't seem to get it to work. Furthermore, I can't seem to get PHP to log. I told it to log to /var/www/logs/php_errors.log and restarted but can't get it to send anything to the file. Does anyone have any tips for debugging these sort of things in OpenBSD?

    Read the article

  • Crontab + .sh + php

    - by Kristaps Karlsons
    Hi. I'm trying to call a shell script every 5 minutes, witch executes php file under root. # crontab -l */5 * * * * /home/regularuser/call.sh permissions: -rw-rw-rw- 1 root root 162 Jun 6 23:40 call.php -rwxr-xr-x 1 root root 66 Jun 7 01:20 call.sh call.sh contents: #!/bin/bash php -q /home/regularuser/call.php echo "request processed" My problem is that my php file doesn't get executed via crontab. However, if I call call.sh - everything works perfectly. I'm new to crontab and shell scripting, so any advice/resources are welcome.

    Read the article

  • How to install a new PHP extension on IIS 7.5

    - by Razor
    I have installed PHP 5.2.13 through Web Platform Installer on IIS 7.5/windows 2008 R2 Now I'm trying to install additional PHP extensions, such as mcrypt, so I downloaded the compiled .zip file from the php windows binaries site. I put the relevant dlls in the extensions folder, and added the lines in the php.ini: [PHP_MCRYPT] extension=php_mcrypt.dll After restarting IIS, no application was working. This was with VC6 compiled/non thread-safe compiled version of PHP 5.2.13 .zip package. I also tried with the thread-safe version, which prevented IIS to restart and forced me to reboot the server. What am I doing wrong here?

    Read the article

  • PHP processes run one at a time, always taking 100% of one core

    - by Derek Kurth
    We have seven websites written in PHP running on a Windows 2008 server with IIS 7.5. They are all very slow right now. When I look in Task Manager, I see around 10 php-cgi.exe processes, and they are all taking 0% of the CPU, except one, which is taking 25%. It's a quad-core server, so it's taking 100% of one core. If I watch for a few seconds, the process taking 25% will go to 0%, and a different php-cgi.exe process will jump to 25%. So all the php-cgi.exe processes are just lined up, waiting on a single core, and each process uses 100% of the processor when it can. Each of the 7 sites is in its own application pool in IIS, and we're using FastCGI. The PHP version is 5.3. Any ideas? Thanks!

    Read the article

  • nginx php-fpm keeps downloading files

    - by Sam Williams
    vhost: server { listen *:8080; location / { root /var/www/default/pub; index index.php; # if file exists return it right away if (-f $request_filename) { break; } if (!-e $request_filename) { rewrite ^(.+)$ /index.php$1 last; break; } } # serve static files directly location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ { access_log off; expires max; } location ~* \.php$ { # By all means use a different server for the fcgi processes if you need to fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_script_name; include /usr/local/nginx/conf/fastcgi_params; } location ~ /\.ht { deny all; } } http://192.168.135.128/index.php loads just fine... http://192.168.135.128/public_/html/index.php downloads...

    Read the article

  • Apache 2.0 is showing only text and not php files

    - by denonth
    I have a web application written with PHP, html and JavaScript. On my pc I have installed a EasyPHP program which has Apache and everything installed. But I wanted to put this web app to my server and I have installed a Apache 2.0 but my php files are displayed as text or it starts to download them automatically. I have tried several things one of them is to add this to my conf file: AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps But it's still not working. What else can I do? Thank you

    Read the article

  • PHP Multiple navigation highlights

    - by Blackbird
    I'm using this piece of code below to highlight the "active" menu item on my global navigation. <?php $path = $_SERVER['PHP_SELF']; $page = basename($path); $page = basename($path, '.php'); ?> <ul id="nav"> <li class="home"><a href="index.php">Home</a></li> <li <?php if ($page == 'search') { ?>class="active"<?php } ?>><a href="#">Search</a></li> <li <?php if ($page == 'help') { ?>class="active"<?php } ?>><a href="help.php">Help</a></li> </ul> All works great but, on a couple of pages, I have a second sub menu (sidebar menu) within a global page. I basically need to add a OR type statement into the php somehow, but I haven't a clue a how. Example of what i mean: <li <?php if ($page == 'help') OR ($page == 'help-overview') OR ($page == 'help-cat-1') { ?>class="active"<?php } ?>><a href="#">Search</a></li> Thanks!

    Read the article

  • PHP Arrays: Pop an array of single-element arrays into one array.

    - by Rob Drimmie
    Using a proprietary framework, I am frequently finding myself in the situation where I get a resultset from the database in the following format: array(5) { [0] => array(1) { ["id"] => int(241) } [1] => array(1) { ["id"] => int(2) } [2] => array(1) { ["id"] => int(81) } [3] => array(1) { ["id"] => int(560) } [4] => array(1) { ["id"] => int(10) } } I'd much rather have a single array of ids, such as: array(5) { [0] => int(241) [1] => int(2) [2] => int(81) [3] => int(560) [4] => int(10) } To get there, I frequently find myself writing: $justIds = array(); foreach( $allIds as $id ) { $justIds[] = $id["id"]; } Is there a more efficient way to do this?

    Read the article

  • Trouble with mod_rewrite and PHP Extensions - Help Making the Correct .htaccess File

    - by nicorellius
    I'm looking for a set of simple rules and redirects for my site. I've tried so many combinations that I'm starting to get confused. I'm not sure how to set this up. Generally, without mod-rewrite, I would use relative paths to link to files: <a href="link.php">Link</a> if it's in the same directory. Now I'd like to use this: <a href="link">Link</a> And so if you go to this page: localhost/mysite/link it will take you to the correct place, which would be: localhost/mysite/link.php But also, many directory levels deep I would like it to work as well: localhost/mysite/group/link2 would go to: localhost/mysite/group/link2.php and: localhost/mysite/group/section/link3 would go to: localhost/mysite/group/section/link3.php But then in all these cases, if someone were to type in this: localhost/mysite/group/section/link3.php in the URL bar, it would show this: localhost/mysite/group/section/link3 Thanks

    Read the article

  • PHP loop through multidimensional array and change values

    - by stevenpepe
    I have a multidimensional array below and I want to loop through it and change the value of [menu_cats] from a number to a string, which is being pulled from a database selection. Is this possible? The name of the array is 'result'. Array ( [0] => Array ( [0] => Array ( [menu_cats] => 1 [item] => Introduction [link] => needs ) [1] => Array ( [menu_cats] => 1 [item] => Needs Assessment [link] => needs/needs.php ) ) [1] => Array ( [0] => Array ( [menu_cats] => 2 [item] => Introduction [link] => knowledge ) [1] => Array ( [menu_cats] => 2 [item] => Administer Knowledge Pre-Test [link] => knowledge/pre_test.php ) ) )

    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

  • php:: apply backticks to first word in sentence

    - by Hailwood
    Hi guys, basically what I am trying to do is, I have an array that looks something like this: array( array( 'select' =>'first string', 'escape' => true ), array( 'select' =>'second', 'escape' => true ), array( 'select' =>'the third string', 'escape' => true ), array( 'select' =>'fourth string', 'escape' => false ), ) I am looping over it and I want to end up with this output array( array( 'select' =>'`first` string', 'escape' => true ), array( 'select' =>'`second`', 'escape' => true ), array( 'select' =>'`the` third string', 'escape' => true ), array( 'select' =>'fourth string', 'escape' => false ), ) so basic rules are backticks are only applied if escape is true backticks are only applied to the first word in a sentence if there is only one word backticks are applied to the word My plan was to use if($item['escape']) { $pos = (strpos($item['select'], ' ') === false ? strlen($item['select']) : strpos($item['select'], ' ')); $item['select'] = '`' . substr($item['select'], 0, $pos) . '`' . substr($item['select'], $pos, strlen($item['select'])); } but the $item['select'] = line seems rather long winded, is there a better way to write it?

    Read the article

  • Adding an element to a multidimensional array

    - by stef
    How can I loop through the array below and an element per array, with key "url_slug" and value "foo"? I tried with array_push but that gets rid of the key names (it seems?) Doing a foreach($array as $k = $v) doesn't do it either, I think. The new array should be exactly the same only having 4 elements per array instead of 3, with the key / values above. Array ( [0] => Array ( [name_en] => Test 5 [url_name_nl] => test-5 [cat_name] => mobile ) [1] => Array ( [name_en] => Test 10 [url_name_nl] => test-10 [cat_name] => mobile ) [2] => Array ( [name_en] => Test 25 [url_name_nl] => test-25 [cat_name] => mobile ) ) EDIT: full working solution. A little more complex than originally described foreach ($prods as $key => &$value) { if($key == "cat_name") $slug = $value['cat_name']; $url_slug = $this->lang->line($slug); $value['url_slug'] = $url_slug; }

    Read the article

  • [SOLVED]Can't enable mysql and mysqli extension in PHP [closed]

    - by Sydcul
    I used to had my website hosted at a hosting company. But i decided to start my own webserver and in order to get phpBB, MediaWiki, etc. working i need PHP and MySQL. So after a bit of screwing around i could get those working but the MySQL and MySQLi extensions do not seem to work. When i use phpMyAdmin, phpBB, whatever it would say it is not installed correctly. I uncommented it in php.ini, i put my PHP folder in path, still not working. Please note i am not a PHP developer at all. Using: Windows Server 2003 Small Buisiness (too lazy to install Linux) Apache2 (not sure what version) PHP 5.2 (threaded, manually installed) MySQL 5.5.28 Thanks in advance, -Sydcul EDIT: Solved. Don't know how, just used the installer and it worked.

    Read the article

  • Upgrading php from php 5.3 to 5.4 .7

    - by Takingsides
    So, quickly so to speak I have noticed this topic around, I have searched and there are plenty of solutions. However these solutions do not work for me, not only that but I'm intending to learn more about the Debian based OS. Questions I would like to know how to upgrade php5.3 to php 5.4.7 compiling it from source, myself without using a third-party ppa. Is the way (explained below) the correct way of configuring php5.4? I'm new to compiling from source. Set-up I run Ubuntu Server 12.04 64bit. I've currently got: PHP 5.3 MySQL-Server Apache2 Memcached The Problem So I initially installed php5.3 using apt-get. I now wish to upgrade the php 5.4 due to the advantage of traits in OOP and the struct with Arrays and all the other recent patches and such. Possible Solutions I've seen this ondrej/ppa repository, which I refuse to use, given the fact that it may work, but it's an unknown/untrusted source. ALso, i'm not learning how to administer from source, using configure, make and install accordingly. I've seen a solution compiling from source, which is essentially how I was hoping to go about it with some guidance. Conclusion So I didn't just expect to be spoon-fed, and I went out and did some manual reading and atleast started the ball rolling myself; this how far i've got. The first thing I did was su into root (to save the typing sudo all the darn time). $ sudo su The next thing I did was download the latest version of php (5.4.7) and extracted it's contents ready to configure before installing it. $ mkdir php5-new && cd !$ $ wget -O php-5.4.7.tar.bz2 http://php.net/get/php-5.4.7.tar.bz2/from/uk3.php.net/mirror $ bzip2 -d php-5.4.7.tar.bz2 $ tar xvf php-5.4.7.tar.gz $ cd php-5.4.7 $ ./configure --help Finally I decided to have a bash, I looked through the list of options and decided I needed to list ALL of the things I wanted to include in the configuration. $ ./configure --with-mysql --with-apache2 --with-libxml --with-openssl --with-zlib --with-bz2 --with-curl --with-dom --with-gd --with-imap --with-imap-ssl --with-mcrypt --with-mysqli --with-pdo-mysql --with-libxml --enable-ftp --enable-mbstring --enable-soap Finally, the results... When the configuration process had finished, it threw an error: configure: error: xml2-config not found. Please check your libxml2 installation.

    Read the article

  • How does one track down an error using the YII Framework?

    - by ian
    I am learning the Yii Framework and I got this error wich does not really point to the specific pages I am working on or as far as i can tell show me where I should start looking for my problem. How do I make sense of this? As far as I can see all my 'type_id' references are typed in correctly. CException Description Property "Project.type_id" is not defined. Source File /Users/user/Dropbox/localhost/yii/framework/db/ar/CActiveRecord.php(107) 00095: */ 00096: public function __get($name) 00097: { 00098: if(isset($this->_attributes[$name])) 00099: return $this->_attributes[$name]; 00100: else if(isset($this->getMetaData()->columns[$name])) 00101: return null; 00102: else if(isset($this->_related[$name])) 00103: return $this->_related[$name]; 00104: else if(isset($this->getMetaData()->relations[$name])) 00105: return $this->getRelated($name); 00106: else 00107: return parent::__get($name); 00108: } 00109: 00110: /** 00111: * PHP setter magic method. 00112: * This method is overridden so that AR attributes can be accessed like properties. 00113: * @param string property name 00114: * @param mixed property value 00115: */ 00116: public function __set($name,$value) 00117: { 00118: if($this->setAttribute($name,$value)===false) 00119: { Stack Trace #0 /Users/user/Dropbox/localhost/yii/framework/db/ar/CActiveRecord.php(107): CComponent->__get('type_id') #1 /Users/user/Dropbox/localhost/trackstar/protected/views/project/_view.php(15): CActiveRecord->__get('type_id') #2 /Users/user/Dropbox/localhost/yii/framework/web/CBaseController.php(119): require('/Users/user/Dro...') #3 /Users/user/Dropbox/localhost/yii/framework/web/CBaseController.php(88): CBaseController->renderInternal('/Users/user/Dro...', Array, true) #4 /Users/user/Dropbox/localhost/yii/framework/web/CController.php(748): CBaseController->renderFile('/Users/user/Dro...', Array, true) #5 /Users/user/Dropbox/localhost/yii/framework/zii/widgets/CListView.php(215): CController->renderPartial('_view', Array) #6 /Users/user/Dropbox/localhost/yii/framework/zii/widgets/CBaseListView.php(152): CListView->renderItems() #7 [internal function]: CBaseListView->renderSection(Array) #8 /Users/user/Dropbox/localhost/yii/framework/zii/widgets/CBaseListView.php(135): preg_replace_callback('/{(\w+)}/', Array, '{summary}?{sort...') #9 /Users/user/Dropbox/localhost/yii/framework/zii/widgets/CBaseListView.php(121): CBaseListView->renderContent() #10 /Users/user/Dropbox/localhost/yii/framework/web/CBaseController.php(174): CBaseListView->run() #11 /Users/user/Dropbox/localhost/trackstar/protected/views/project/index.php(17): CBaseController->widget('zii.widgets.CLi...', Array) #12 /Users/user/Dropbox/localhost/yii/framework/web/CBaseController.php(119): require('/Users/user/Dro...') #13 /Users/user/Dropbox/localhost/yii/framework/web/CBaseController.php(88): CBaseController->renderInternal('/Users/user/Dro...', Array, true) #14 /Users/user/Dropbox/localhost/yii/framework/web/CController.php(748): CBaseController->renderFile('/Users/user/Dro...', Array, true) #15 /Users/user/Dropbox/localhost/yii/framework/web/CController.php(687): CController->renderPartial('index', Array, true) #16 /Users/user/Dropbox/localhost/trackstar/protected/controllers/ProjectController.php(148): CController->render('index', Array) #17 /Users/user/Dropbox/localhost/yii/framework/web/actions/CInlineAction.php(32): ProjectController->actionIndex() #18 /Users/user/Dropbox/localhost/yii/framework/web/CController.php(300): CInlineAction->run() #19 /Users/user/Dropbox/localhost/yii/framework/web/filters/CFilterChain.php(129): CController->runAction(Object(CInlineAction)) #20 /Users/user/Dropbox/localhost/yii/framework/web/filters/CFilter.php(41): CFilterChain->run() #21 /Users/user/Dropbox/localhost/yii/framework/web/CController.php(999): CFilter->filter(Object(CFilterChain)) #22 /Users/user/Dropbox/localhost/yii/framework/web/filters/CInlineFilter.php(59): CController->filterAccessControl(Object(CFilterChain)) #23 /Users/user/Dropbox/localhost/yii/framework/web/filters/CFilterChain.php(126): CInlineFilter->filter(Object(CFilterChain)) #24 /Users/user/Dropbox/localhost/yii/framework/web/CController.php(283): CFilterChain->run() #25 /Users/user/Dropbox/localhost/yii/framework/web/CController.php(257): CController->runActionWithFilters(Object(CInlineAction), Array) #26 /Users/user/Dropbox/localhost/yii/framework/web/CWebApplication.php(320): CController->run('') #27 /Users/user/Dropbox/localhost/yii/framework/web/CWebApplication.php(120): CWebApplication->runController('project') #28 /Users/user/Dropbox/localhost/yii/framework/base/CApplication.php(135): CWebApplication->processRequest() #29 /Users/user/Dropbox/localhost/trackstar/index.php(12): CApplication->run() #30 {main} 2011-10-17 18:17:18 Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8r DAV/2 PHP/5.3.6 Yii Framework/1.1.2

    Read the article

  • how to upload a file from php to amqp

    - by user2462648
    i want to know... how can i send a file to a rabbitmq queue from php. i have gone through many examples most of them didnt work. below is a consumer producer example which is near to working. Below is a the publisher.php <?php require_once('../php-amqplib/amqp.inc'); include('../config.php'); $conn = new AMQPConnection(HOST, PORT, USER, PASS, VHOST); $channel = $conn->channel(); $channel->exchange_declare('upload-pictures','direct', false, true, false); $metadata = json_encode(array( 'image_id' => $argv[1], 'user_id' => $argv[2], 'image_path' => $argv[3] )); $msg = new AMQPMessage($metadata, array('content_type' => 'text/plain','delivery_mode' => 2)); $channel->basic_publish($msg, 'upload-pictures'); $channel->close(); $conn->close(); ?> consumer.php <?php require_once('../php-amqplib/amqp.inc'); include('../config.php'); $conn = new AMQPConnection(HOST, PORT, USER, PASS,VHOST); $channel = $conn->channel(); $queue = 'add-points'; $consumer_tag = 'consumer'; $channel->exchange_declare('upload-pictures','direct', false, true, false); $channel->queue_declare('add-points',false, true, false, false); $channel->queue_bind('add-points', 'upload-pictures'); $consumer = function($msg){}; $channel->basic_consume($queue,$consumer_tag,false,false,false,false,$consumer); ?> according to the example provided in the rabbitmq manual, i need to run consumer(php consumer.php) first in one terminal and the publisher (php publisher.php 1 2 file/path.png) in another terminal, i will get a "Adding points to user: 2" message in the consumer terminal. iam not getting this message at all. can you suggest where iam going wrong

    Read the article

< Previous Page | 62 63 64 65 66 67 68 69 70 71 72 73  | Next Page >