Search Results

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

Page 120/1273 | < Previous Page | 116 117 118 119 120 121 122 123 124 125 126 127  | Next Page >

  • Problems with creating XML with DOMDocument in PHP

    - by maralbjo
    The below code is fetched from php.net (http://docs.php.net/manual/en/domdocument.savexml.php). My problem is - it doesn't work. My only output from this is: "Saving all the document: Saving only the title part:". What am I missing here? $doc = new DOMDocument('1.0'); // we want a nice output $doc-formatOutput = true; $root = $doc-createElement('book'); $root = $doc-appendChild($root); $title = $doc-createElement('title'); $title = $root-appendChild($title); $text = $doc-createTextNode('This is the title'); $text = $title-appendChild($text); echo "Saving all the document:\n"; echo $doc-saveXML() . "\n"; echo "Saving only the title part:\n"; echo $doc-saveXML($title);

    Read the article

  • PHP Segmentation fault when started from crond

    - by Jeroen Moors
    Hello, I've a php script that's started each minute from cron. It almost always runs without any problem, except for about 10 times within 24h. The times it fails I get a segmentation fault like: bin/sh: line 1: 21815 Segmentation fault /usr/bin/myscript The number after "line 1:" is always different. I'm running: PHP 5.2.6-1+lenny8 with Suhosin-Patch 0.9.6.2 (cli) (built: Mar 14 2010 08:14:04) Is this a problem with my version of PHP? Is there a way to debug this? I have the feeling it crashes when the server load is high, but there's absolutely no prove for this. Any feedback is welcome!

    Read the article

  • spl_object_hash for PHP < 5.2 (unique ID for object instances)

    - by Rowan
    I'm trying to get unique IDs for object instances in PHP 5+. The function, spl_object_hash() is available from PHP 5.2 but I'm wondering if there's a workaround for older versions. There are a couple of functions in the comments on php.net but they're not working for me. The first (simplified): function spl_object_hash($object){ if (is_object($object)){ return md5((string)$object); } return null; } does not work with native objects (such as DOMDocument), and the second: function spl_object_hash($object){ if (is_object($object)){ ob_start(); var_dump($object); $dump = ob_get_contents(); ob_end_clean(); if (preg_match('/^object\(([a-z0-9_]+)\)\#(\d)+/i', $dump, $match)) { return md5($match[1] . $match[2]); } } return null; } looks like it could be a major performance buster! Does anybody have anything up their sleeve?

    Read the article

  • PHP javascript link id

    - by Jordan Pagaduan
    <?php //connect to database .... //select query .... if(isset($_GET["link"])==false){ echo "sample 1"; }else{ echo "sample 2" ; } ?> <script type="javascript"> function Link(id) { location.href='linktest.php&link='+id; } </script> <html> <input type="button" value="link test" onclick="javascript: Link<?php $row['id']; ?>"> </html> (assumed question) How do I force the onclick event to contain the value of $row['id']?

    Read the article

  • parsing raw email in php

    - by Uberfuzzy
    i'm looking for good/working/simple to use php code for parsing raw email into parts. i've written a couple of brute force solutions, but everytime, one small change/header/space/something comes along and my whole parser fails and the project falls apart. and before i get pointed at PEAR/PECL, i need actual code. my host has some screwy config or something, i can never seem to get the .so's to build right. if i do get the .so made, some difference in path/environment/php.ini doesnt always make it available (apache vs cron vs cli) oh, and one last thing, i'm parsing the raw email text, NOT pop3, and NOT imap. its being piped into the php script via a .qmail email redirect. i'm not expecting SOF to write it for me, i'm looking for some tips/starting points on doing it "right". this is one of those "wheel" problems that i know has already been solved.

    Read the article

  • Apache or Nginx for php behind Varnish

    - by Macindy
    We are managing a heavy traffic php site (driven with vbulletin). To get less load I use the cache-proxy varnish. Works very well - with varnish the load was reduced by 50%. But now I am thinking about which webserver to use behind varnish. 90% requests getting to the webserver are php-requests. So is there a difference between apache/mpm-prefork with mod_php and nginx/php-fpm? Is apache perhaps better, because it doesn't have the tcp overhead? Thanks for reply - benchmarks would be great! macindy

    Read the article

  • Passing var from php to javascript

    - by marc-andre menard
    I try to do something pretty strait... getting php value to javascript here is the page here is the code.. <script language="javascript"> <?php $imagepath = $_REQUEST["path"]; ?> var whatisthepath = <?php $imagepath; ?> alert (whatisthepath); </script> ALWAYS getting UNDEFINE.... why ?

    Read the article

  • Some unclear PHP syntax

    - by serhio
    I am a PHP beginner and saw on the forum this PHP expression: $regex = <<<'END' / ( [\x00-\x7F] # single-byte sequences 0xxxxxxx | [\xC0-\xDF][\x80-\xBF] # double-byte sequences 110xxxxx 10xxxxxx | [\xE0-\xEF][\x80-\xBF]{2} # triple-byte sequences 1110xxxx 10xxxxxx * 2 | [\xF0-\xF7][\x80-\xBF]{3} # quadruple-byte sequence 11110xxx 10xxxxxx * 3 ) | ( [\x80-\xBF] ) # invalid byte in range 10000000 - 10111111 | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 /x END; Is this code correct? What do these strange (for me) constructions like <<<, 'END', /, /x, and END; mean? I recieve: Parse error: syntax error, unexpected T_SL in /home/vhosts/mysite.com/public_html/mypage.php on line X Thanks

    Read the article

  • radio button value in php

    - by Crash893
    Im trying to make a simple survey in php I have a set of radio buttons on a page called sja.php that sends its to sjamail.php page the problem is that when i go to get $answer = $_POST['ans']; I can't seen to do anything like echo "$answer"; but if i were to throw some logic at it like if ($answer == "ans1") { echo 'Correct'; } else { echo 'Incorrect'; } IT will display correct or incorrect so why is it i can't access the value of the radio button ans?

    Read the article

  • Kohana 3 and CRON always accessing index.php (not following the URI argument)

    - by alex
    OK, I hope this is my last question about CRON jobs and Kohana 3. Note: others are not duplicates, just other problems. Here is my CRON job (setup in cPanel) php /home/user/public_html/index.php --uri=properties/update As per this answer. I have set it up so it emails me the output. It is running every 5 mins. Unfortunately, it always emails me the source of the home page of my site (index.php or /). I can access that URL fine in my browser, i.e. http://www.example.com/properties/update and it works and does it's job correctly. I can tell the Cron is never hitting the script because I have a file logger in place. Would this have anything to do with .htaccess? Has this happened to anyone before, and how did they fix it? Many thanks.

    Read the article

  • php error not displayed

    - by devil eye
    I am new to php ; when ever ther is some error in my script ,the browser do not display error wirh line nymber but displays : Server error The website encountered an error while retrieving "http://localhost/gmailAPP/google-api-php-client/examples/calendar/simple.php". It may be down for maintenance or configured incorrectly. Here are some suggestions: Reload this webpage later. HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request. It is very difficult to debug the code with out error message and line number .Please help

    Read the article

  • Failed opening 'SiteTest: Firefox.php' when running Yii Functional Test

    - by Phelios
    Warning: include(): Failed opening 'SiteTest: Firefox.php' for inclusion ... \yii\framework\YiiBase.php on line 418 Yii v1.1.10 PHPUnit v3.6.10 PHPUnit_Selenium v 1.2.6 I get this error when trying to run the example on the book "Agile Web Development with Yii 1.1 and PHP5" I kind of feel that there is a problem with the phrase SiteTest:, it shouldn't be there. But, how do I fix this? UPDATE (SOLVED): Apparently, the problem is not the warning shown above, but there is another error down the road. It says that "curl_init()" is undefined. I already enabled the php_curl extension, but the PHP from CLI is not using the same .ini file as the apache one. So, after I enabled the php_curl in the CLI version of the ini, it works fine now (still giving the warning, but the test is running).

    Read the article

  • PHP getimagesize with ampersand in string creates errors

    - by RobHardgood
    I'm using the getimagesize function in PHP, and the path string contains an ampersand, which otherwise is fine. The page gives me errors where getimagesize() is called. Looking at the source code, though, I see the ampersand is being passed through as & rather than just & I presume this is causing errors because PHP doesn't need to convert it to the html tag in order to find the path, right? Here is the error: Warning: getimagesize(image.php?name=username&pic=picture) [function.getimagesize]: failed to open stream: No such file or directory

    Read the article

  • ICalendar parser in PHP that supports timezones

    - by Vincent Robert
    I am looking for a PHP class that can parse an ICalendar (ICS) file and correctly handle timezones. I already created an ICS parser myself but it can only handle timezones known to PHP (like 'Europe/Paris'). Unfortunately, ICS file generated by Evolution (default calendar software of Ubuntu) does not use default timezone IDs. It exports events with its a specific timezone ID exporting also the full definition of the timezone: daylight saving dates, recurrence rule and all the hard stuff to understand about timezones. This is too much for me. Since it was only a small utility for my girlfriend, I won't have time to investigate further the ICalendar specification and create a full blown ICalendar parser myself. So is there any known implementation in PHP of ICalendar file format that can parse timezones definitions?

    Read the article

  • jwysiwyg to php

    - by perses
    I am using this jQuery based jWysiwyg. http://code.google.com/p/jwysiwyg How do I pass the value of $('#wysiwyg').val() to php script. For example to show the value of jwysiwyg in an alert box, I am using <form name="form1" method="post" action="sendmail.php"> <textarea name="wysiwyg" id="wysiwyg" rows="5" cols="103"></textarea> <input type="submit" name="Submit" value="Login"></input> <input type="button" value="Alert HTML" onclick="alert($('#wysiwyg').val());" /> </form> What I need is how to pass value of jwysiwyg's value in submit control and how do I call "logout.php" on pressing of a button?

    Read the article

  • PHP MYSQL Endless Loop

    - by Neb
    Hi, I have a problem with my php/mysql script. It should only output the while loop once but I am getting unlimited loops and an endless page. $query = mysql_query("SELECT * FROM users WHERE username ='".base64_encode($_SESSION['username'])."' LIMIT 1"); $result = mysql_fetch_array($query); if(empty($result)){ echo "No user... Error"; }else{ while($row = $result){ ?> <a href="index.php?user=<?=$row['id']?>"><?=base64_decode($row['username'])?></a> | <a href="javascript:void(0);" id="logout">Logout</a> <?php } } I have tried a similar script with these same lines and it works perfectly $result = mysql_fetch_array($query); if(empty($result)){ echo "No user... Error"; }else{ while($row = $result){ //Something } }

    Read the article

  • PHP File Serving Script: Unreliable Downloads?

    - by JGB146
    This post started as a question on ServerFault ( http://serverfault.com/questions/131156/user-receiving-partial-downloads ) but I determined that our php script was the culprit. So I'm issuing an updated question here about what I believe is the actual issue. I am using a php script to verify permissions and then serve up a file for users of my website to download. Most of the time, this works, but recently one user has been seeing problems with larger downloads. He is only getting ~80% of downloads for files that are 100MB in size. Also, all downloads from this script fail to report a filesize. Further, tests revealed that the same user COULD reliably download each of the failed files if given a direct link (at which point the filesize is reported). Here's the relevant snippet of code that we are using to serve the file: header("Content-type:$contenttype"); $len = filesize($filename); header("Content-Length: $len"); header("Content-Disposition: attachment; filename=".$title.".".$ext); readfile($filename); Note that $contenttype, $filename, $title, and $ext are all set correctly before we get here. These have been triple-checked. None of them are the problem. Also, $len does provide the correct filesize. While researching this issue, I came across this post: http://stackoverflow.com/questions/1334471/content-length-header-always-zero It seems that I am encountering the same issue. When I use the script, I get chunked encoding on the file and no size is set for content-length. I'm hypothesizing that something is going wrong on the large downloads, leading him to get a zero-length chunk before the end of the file. Here's what the headers look like for a direct request: http://www.grinderschool.com/videos/zfff5061b65ae00e8b21/KillsAids021.wmv GET /videos/zfff5061b65ae00e8b21/KillsAids021.wmv HTTP/1.1 Host: www.grinderschool.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729) Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Referer: http://www.grinderschool.com/phpBB3/viewtopic.php?f=14&p=29468 Cookie: style_cookie=printonly; phpbb3_7c544_u=2; phpbb3_7c544_k=44b832912e5f887d; phpbb3_7c544_sid=e8852df42e08cc1b2250300c2897f78f; __utma=174624884.2719561324781918700.1251850714.1270986325.1270989003.575; __utmz=174624884.1264524375.411.12.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=low%20stakes%20poker%20videos; phpbb3_cmviy_k=; phpbb3_cmviy_u=2; phpbb3_cmviy_sid=d8df5c0943863004ca40ef9c392d371d; __utmb=174624884.4.10.1270989003; __utmc=174624884 Pragma: no-cache Cache-Control: no-cache HTTP/1.1 200 OK Date: Sun, 11 Apr 2010 12:57:41 GMT Server: Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8l DAV/2 mod_auth_passthrough/2.1 FrontPage/5.0.2.2635 Last-Modified: Sun, 04 Apr 2010 12:51:06 GMT Etag: "eb42d6-7d9b843-48368aa6dc280" Accept-Ranges: bytes Content-Length: 131708995 Keep-Alive: timeout=10, max=30 Connection: Keep-Alive Content-Type: video/x-ms-wmv And here's what they look like for the request answered by my script: http://www.grinderschool.com/download_video_test.php?t=KillsAids021&format=wmv GET /download_video_test.php?t=KillsAids021&format=wmv HTTP/1.1 Host: www.grinderschool.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729) Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Cookie: style_cookie=printonly; phpbb3_7c544_u=2; phpbb3_7c544_k=44b832912e5f887d; phpbb3_7c544_sid=e8852df42e08cc1b2250300c2897f78f; __utma=174624884.2719561324781918700.1251850714.1270986325.1270989003.575; __utmz=174624884.1264524375.411.12.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=low%20stakes%20poker%20videos; phpbb3_cmviy_k=; phpbb3_cmviy_u=2; phpbb3_cmviy_sid=d8df5c0943863004ca40ef9c392d371d; __utmb=174624884.4.10.1270989003; __utmc=174624884 HTTP/1.1 200 OK Date: Sun, 11 Apr 2010 12:58:02 GMT Server: Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8l DAV/2 mod_auth_passthrough/2.1 FrontPage/5.0.2.2635 X-Powered-By: PHP/5.2.11 Content-Disposition: attachment; filename=KillsAids021.wmv Vary: Accept-Encoding Content-Encoding: gzip Keep-Alive: timeout=10, max=30 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: video/x-ms-wmv So the question is...what can I do to make downloads from the script work properly? Again, for 99% of users, it works as is (though I find it annoying now that no filesize is reported and thus that no time estimate can be computed about the download).

    Read the article

  • Command Line arguments - PHP

    - by Chaitanya
    Am trying the following php script which finds out the maximum between 2 numbers, it accepts the arguments through command line. I check whether the input is provided right, based on the number of command line arguments. <?php function larger($arg1,$arg2) { return max($arg1,$arg2); } if($argc > 3 || $argc < 3) print 'Invalid Arguments'; exit(1); if($argc==3) { print larger($argv[1],$argv[2]); } ?> Am executing the program in a windows system, and the file resides in xampp/php directory. While executing I don't get any output neither any error report. How do i check whether am right or wrong?

    Read the article

  • Facebook Restful PHP Client - get Events of a User

    - by choise
    Hi, im using the Facebook PHP Client library and want to get the Events of a user without first logging in as a user. Is that possible? I got the User ID and the events.get method has a parameter UID. <?php // Configure $apiKey = 'xxx'; $secretKey = 'xxx'; // Include Lib require_once('facebook.php'); // init main object $facebook = new Facebook($apiKey,$secretKey); $events = $facebook->api_client->events_get(123456); ?> so this piece of code does not work. if i first require a login of a certain user, i get my results. isnt it possible to get events of a user without logging in?

    Read the article

  • cURL: from PHP to BASH

    - by flienteen
    Hi.. I've never done any curl before so am in need of some help. php: <?php $ch = curl_init(); $data = array( 'uptype'=>'file', 'file'=>'@'.$argv[1], ); curl_setopt($ch, CURLOPT_URL, 'http://my_site_ex/up.php'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_exec($ch); curl_close($ch); ?> how to make the same script in BASH?

    Read the article

  • Historical security flaws of popular PHP CMS's?

    - by VirtuosiMedia
    I'm creating a PHP CMS, one that I hope will be used by the public. Security is a major concern and I'd like to learn from some of the popular PHP CMS's like Wordpress, Joomla, Drupal, etc. What are some security flaws or vulnerabilities that they have they had in the past that I can avoid in my application and what strategies can I use to avoid them? What are other issues that I need to be concerned with that they perhaps didn't face as a vulnerability because they handled it correctly from the start? What additional security features or measures would you include? Please be as specific as possible. I'm generally aware of most of the usual attack vectors, but I want to make sure that all the bases are covered, so don't be afraid to mention the obvious as well. Assume PHP 5.2+.

    Read the article

  • Escaping CURL @ symbol with PHP

    - by bkildow
    I'm writing a php application that submits via curl data to sign up for an iContact email list. However I keep getting an invalid email address error. I think this may be due to the fact that I'm escaping the @ symbol so it looks like %40 instead of @. Also, according to the php documentation for curl_setopt with CURLOPT_POSTFIELDS: The full data to post in a HTTP "POST" operation. To post a file, prepend a filename with @ and use the full path. So, is there anyway to pass the @ symbol as post data through curl in php without running it through urlencode first?

    Read the article

  • PHP: Infinity loop and Time Limit!

    - by Jonathan
    Hi, I have a piece of code that fetches data by giving it an ID. If I give it an ID of 1230 for example, the code fetches an article data with an ID of 1230 from a web site (external) and insert it into a DB. Now, the problem is that I need to fetch all the articles, lets say from ID 00001 to 99999. If a do a 'for' loop, after 60 seconds the PHP internal time limit stops the loop. If a use some kind of header("Location: code.php?id=00001") or header("Location: code.php?id=".$ID) and increase $ID++ and then redirect to the same page the browser stops me because of the infinite loop or redirection problem. Please HELP!

    Read the article

  • Telling between a "natural" HTTP 404 and a PHP Generated one

    - by JCOC611
    So I have a file that should never be accessed by a user directly, but included in another PHP file. If the file is called directly, it generates a HTTP Status 404 Not Found to trick a possible attacker that such file doesn't exist. However, if the hacker could tell that the 404 was generated by PHP or is not "natural" then the whole point of the header would be lost. So is it possible to tell whether the 404 was generated by the server naturally (because the file really doesn't exist) or by a PHP code? PS: I know this question might seem pretty weird lol

    Read the article

  • Suggested php framework to learn - for a beginner

    - by SpikETidE
    Hello Everyone... I've been coding in php for quite sometime now... And i have some very basic knowledge in PHP's OOP constructs.... Now, i am thinking of learning a framework in PHP.... Considering my limited knowledge in OOP, What would be the best to learn initially.. it should be also good enough to use in a major project.... Thanks for your suggestions...! Edit : I just now saw that this question has been beaten to death again and again on SO...!! Anyway, plz suggest a easy to learn framework for a OOP n00b...!

    Read the article

< Previous Page | 116 117 118 119 120 121 122 123 124 125 126 127  | Next Page >