Search Results

Search found 32464 results on 1299 pages for 'php cgi'.

Page 24/1299 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • when including a file using php function not work?

    - by John Smiith
    MY PHP FUNCTION IS function functionName() { include($_SERVER['DOCUMENT_ROOT']."/path/file.php"); } Content of File.php is $foo = 'bar'; Calling function (content of file test.php) functionName(); When call function and variable not work echo $foo; <- not works But when adding code below its works (content of file test.php) include($_SERVER['DOCUMENT_ROOT']."/path/file.php"); echo $foo; <- its works

    Read the article

  • Creating my own PHP framework

    - by onlineapplab.com
    Disclaimer: I don't want to start any flame war so there will not be no name of any framework mentioned. I've been using quite many from the existing PHP frameworks and my experience in each case was similar: everything is nice a the beginning but in the moment you require something non standard you get into lot of problems to fix otherwise simple issues. In case of frameworks following the MVC design pattern there are some issues with the implementation of each layer for example there is a lot of codding used for model and data access with using ORM and presentation is not much more than pure phtml. Some frameworks use their own wrappers for existing PHP functionality and in some cases severely limiting original functionality. Depending on framework you can have additional problems like lack of documentation, slow or non existent development cycle and last but not least speed. While ago I made my own framework which while doing it's job and being used for few different applications after couple of years more of experience with PHP doesn't seem to be perfect piece of codding. I could write my own framework and use additional experience I've gathered during these years to make it better on the other hand I'm aware that there is quite many better programmers working on creating/upgrading existing frameworks. So does it make at all nay sense to write my own PHP framework if there is so many possibilities to choose from?

    Read the article

  • Alternatives to PHP [closed]

    - by kaz
    We are starting a project, which goal is to create new frontend interface to our product. Old version was created in PHP, very poorly written. We are choosing the language and frameworks that we want to use in new version. Requirements: New interface will be communicating with API. Application will not have it's own database. We don't have a big team, 3 max programmers for entire project. The main programmers are PHP veterans and knows some other technologies (Rails, C, C++, some Java) but not in professional level. But overall they are good and experienced programmers. So: We want to find a good alternative to PHP. I like Rails very much, but whole ActiveRecord model will be useless, when using application API. Java needs a lot of configuration and someone who is expert in Java to properly run this project. Also, in Java there are a lot of big and complicated enterprise frameworks - not very good for 2-3 programmers team. Python - I don't know Python and don't know good and experienced programmers who knows PY - but it's not so complicated and big as Java and maybe in long period it's good alternative for PHP. What are your thoughts?

    Read the article

  • Can't view order in magento

    - by koko
    Hi, I've been setting up a fresh magento 1.4.0.1 install, working great so far. I did some test orders just to see. Everything works fine, but when I click on "view order" under "my orders", I get a bunch of error messages: There has been an error processing your request Notice: iconv_substr() [function.iconv-substr]: Unknown error (0) in /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Helper/String.php on line 98 Trace: #0 [internal function]: mageCoreErrorHandler(8, 'iconv_substr() ...', '/data/web/A1423...', 98, Array) #1 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Helper/String.php(98): iconv_substr('1', 0, 50, 'UTF-8') #2 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Helper/String.php(173): Mage_Core_Helper_String-substr('1', 0, 50) #3 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Helper/String.php(112): Mage_Core_Helper_String-str_split('1', 50) #4 /data/web/A14237/htdocs/magento/app/design/frontend/base/default/template/sales/order/items/renderer/default.phtml(58): Mage_Core_Helper_String-splitInjection('1') #5 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Block/Template.php(189): include('/data/web/A1423...') #6 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Block/Template.php(225): Mage_Core_Block_Template-fetchView('frontend/base/d...') #7 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Block/Template.php(242): Mage_Core_Block_Template-renderView() #8 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Block/Abstract.php(674): Mage_Core_Block_Template-_toHtml() #9 /data/web/A14237/htdocs/magento/app/code/core/Mage/Sales/Block/Items/Abstract.php(137): Mage_Core_Block_Abstract-toHtml() #10 /data/web/A14237/htdocs/magento/app/design/frontend/base/default/template/sales/order/items.phtml(52): Mage_Sales_Block_Items_Abstract-getItemHtml(Object(Mage_Sales_Model_Order_Item)) #11 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Block/Template.php(189): include('/data/web/A1423...') #12 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Block/Template.php(225): Mage_Core_Block_Template-fetchView('frontend/base/d...') #13 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Block/Template.php(242): Mage_Core_Block_Template-renderView() #14 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Block/Abstract.php(674): Mage_Core_Block_Template-_toHtml() #15 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Block/Abstract.php(516): Mage_Core_Block_Abstract-toHtml() #16 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Block/Abstract.php(467): Mage_Core_Block_Abstract-_getChildHtml('order_items', true) #17 /data/web/A14237/htdocs/magento/app/design/frontend/base/default/template/sales/order/view.phtml(64): Mage_Core_Block_Abstract-getChildHtml('order_items') #18 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Block/Template.php(189): include('/data/web/A1423...') #19 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Block/Template.php(225): Mage_Core_Block_Template-fetchView('frontend/base/d...') #20 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Block/Template.php(242): Mage_Core_Block_Template-renderView() #21 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Block/Abstract.php(674): Mage_Core_Block_Template-_toHtml() #22 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Block/Abstract.php(516): Mage_Core_Block_Abstract-toHtml() #23 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Block/Abstract.php(463): Mage_Core_Block_Abstract-_getChildHtml('sales.order.vie...', true) #24 /data/web/A14237/htdocs/magento/app/code/core/Mage/Page/Block/Html/Wrapper.php(52): Mage_Core_Block_Abstract-getChildHtml('', true, true) #25 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Block/Abstract.php(674): Mage_Page_Block_Html_Wrapper-_toHtml() #26 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract-toHtml() #27 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Block/Abstract.php(674): Mage_Core_Block_Text_List-_toHtml() #28 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Block/Abstract.php(516): Mage_Core_Block_Abstract-toHtml() #29 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Block/Abstract.php(467): Mage_Core_Block_Abstract-_getChildHtml('content', true) #30 /data/web/A14237/htdocs/magento/app/design/frontend/base/default/template/page/2columns-left.phtml(48): Mage_Core_Block_Abstract-getChildHtml('content') #31 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Block/Template.php(189): include('/data/web/A1423...') #32 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Block/Template.php(225): Mage_Core_Block_Template-fetchView('frontend/base/d...') #33 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Block/Template.php(242): Mage_Core_Block_Template-renderView() #34 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Block/Abstract.php(674): Mage_Core_Block_Template-_toHtml() #35 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Model/Layout.php(536): Mage_Core_Block_Abstract-toHtml() #36 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(389): Mage_Core_Model_Layout-getOutput() #37 /data/web/A14237/htdocs/magento/app/code/core/Mage/Sales/controllers/OrderController.php(100): Mage_Core_Controller_Varien_Action-renderLayout() #38 /data/web/A14237/htdocs/magento/app/code/core/Mage/Sales/controllers/OrderController.php(136): Mage_Sales_OrderController-_viewAction() #39 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Sales_OrderController-viewAction() #40 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action-dispatch('view') #41 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Controller/Varien/Front.php(177): Mage_Core_Controller_Varien_Router_Standard-match(Object(Mage_Core_Controller_Request_Http)) #42 /data/web/A14237/htdocs/magento/app/code/core/Mage/Core/Model/App.php(304): Mage_Core_Controller_Varien_Front-dispatch() #43 /data/web/A14237/htdocs/magento/app/Mage.php(596): Mage_Core_Model_App-run(Array) #44 /data/web/A14237/htdocs/magento/index.php(78): Mage::run('', 'store') #45 {main} gtx, koko

    Read the article

  • How to install PHP in a new directory in Windows

    - by jasondavis
    I am using Xampp for a local dev server, I am trying to upgrade it so I can use the latest version of PHP. I had it installed in my c drive c:\webserver\php I just installed everything new in a new drive D d:\webserver\php I then boot everything up and then I run phpinfo() and it is still showing my old version of PHP and even points to the old php installation C:\webserver\php\php.ini Am I missing something obvious here?

    Read the article

  • php, mySQL & AJAX: Unable to use sessions across the scripts in the same domain

    - by Devner
    Hi all, I have the following pages: page1.php, page2.php and page3.php. Code in each of them is as below CODE: page1.php <script type="text/javascript"> $(function(){ $('#imgID').upload({ submit_to_url: "page2.php", file_name: 'myfile1', description : "Image", limit : 1, file_types : "*.jpg", }) }); </script> <body> <form action="page3.php" method="post" enctype="multipart/form-data" name="frm1" id="frm1"> //Some other text fields <input type="submit" name="submit" id="submit" value="Submit" /> </form> </body> page2.php <?php session_start(); $a = $_SESSION['a']; $b = $_SESSION['b']; $c = $_SESSION['c']; $res = mysql_query("SELECT col FROM table WHERE col1 = $a AND col2 = $b AND col3 = $c LIMIT 1"); $num_rows = mysql_num_rows($res); echo $num_rows; //echos 0 when in fact it should have been 1 because the data in the Session exists. //Ok let's proceed further //... Do some stuff... //Store some more values and create new session variables (and assume that page1.php is going to be able to use it) $_SESSION['d'] = 'd'; $_SESSION['e'] = 'e'; $_SESSION['f'] = 'f'; if (move_uploaded_file($_FILES['file']['tmp_name'], $file)) { echo "success"; } else { echo "error ".$_FILES['file']['error']; } ?> page3.php <?php session_start(); if( isset($_POST['submit']) ) { //These sessions are non-existent although the AJAX request //to page2.php may have created them when called via AJAX from within page1.php echo $_SESSION['d'].$_SESSION['e'].$_SESSION['f']; ?> } ?> As the code says it I am posting some info via AJAX call from page1.php to page2.php. page2.php is supposed to be able to use the session values from page1.php i.e. $_SESSION['a'], $_SESSION['b'] and $_SESSION['c'] but it does not. Why? How can I fix this? page2.php is creating some more sessions after some processing is done and a response is sent back to page1.php. The submit button of the form on page1.php is hit and the page gets POST'ed to page3.php. But when the SESSION info that gets created in page2.php is echoed, it's blank signifying that SESSIONS from page2.php are not used. How can I fix this? I looked over a lot of information and have spent about 50 hours trying to do different things with my scripts before arriving at the above conclusions. My app. is custom made using function (not OOPS) and does not use any PHP frameworks & I am not even about to use any as my knowledge of OOP concepts is limited any many frameworks are object oriented. I came across race conditions, but the solutions provided don't help too much. One more solution of using DB to hold sessions and seek and retrieve from DB is the last thing on my mind and I really want to avoid creating table, coding and maintaining code for a task as simple as just keeping sessions across pages in the same domain. So my request is: Is there a way that I can solve the above problem(s) via simple coding in present conditions? Any help is appreciated. Thank you.

    Read the article

  • PHP create huge errors file on my server feof() fread()

    - by Nik
    I have a script that allows users to 'save as' a pdf, this is the script - <?php header("Content-Type: application/octet-stream"); $file = $_GET["file"] .".pdf"; header("Content-Disposition: attachment; filename=" . urlencode($file)); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); header("Content-Description: File Transfer"); header("Content-Length: " . filesize($file)); flush(); // this doesn't really matter. $fp = fopen($file, "r"); while (!feof($fp)) { echo fread($fp, 65536); flush(); // this is essential for large downloads } fclose($fp); ? An error log is being created and gets to be more than a gig in a few days the errors I receive are- [10-May-2010 12:38:50] PHP Warning: filesize() [function.filesize]: stat failed for BYJ-Timetable.pdf in /home/byj/public_html/pdf_server.php on line 10 [10-May-2010 12:38:50] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/byj/public_html/pdf_server.php:10) in /home/byj/public_html/pdf_server.php on line 10 [10-May-2010 12:38:50] PHP Warning: fopen(BYJ-Timetable.pdf) [function.fopen]: failed to open stream: No such file or directory in /home/byj/public_html/pdf_server.php on line 12 [10-May-2010 12:38:50] PHP Warning: feof(): supplied argument is not a valid stream resource in /home/byj/public_html/pdf_server.php on line 13 [10-May-2010 12:38:50] PHP Warning: fread(): supplied argument is not a valid stream resource in /home/byj/public_html/pdf_server.php on line 15 [10-May-2010 12:38:50] PHP Warning: feof(): supplied argument is not a valid stream resource in /home/byj/public_html/pdf_server.php on line 13 [10-May-2010 12:38:50] PHP Warning: fread(): supplied argument is not a valid stream resource in /home/byj/public_html/pdf_server.php on line 15 The line 13 and 15 just continue on and on... I'm a bit of a newbie with php so any help is great. Thanks guys Nik

    Read the article

  • Java PHP posting using URLConnector, PHP file doesn't seem to receive parameters

    - by Emdiesse
    Hi there, I am trying to post some simple string data to my php script via a java application. My PHP script works fine when I enter the data myself using a web browser (newvector.php?x1=&y1=...) However using my java application the php file does not seem to pick up these parameters, in fact I don't even know if they are sending at all because if I comment out on of the parameters in the java code when I am writing to dta it doesn't actually return, you must enter 6 parameters. newvector.php if(!isset($_GET['x1']) || !isset($_GET['y1']) || !isset($_GET['t1']) || !isset($_GET['x2']) || !isset($_GET['y2']) || !isset($_GET['t2'])){ die("You must include 6 parameters within the URL: x1, y1, t1, x2, y2, t2"); } $x1 = $_GET['x1']; $x2 = $_GET['x2']; $y1 = $_GET['y1']; $y2 = $_GET['y2']; $t1 = $_GET['t1']; $t2 = $_GET['t2']; $insert = " INSERT INTO vectors( x1, x2, y1, y2, t1, t2 ) VALUES ( '$x1', '$x2', '$y1', '$y2', '$t1', '$t2' ) "; if(!mysql_query($insert, $conn)){ die('Error: ' . mysql_error()); } echo "Submitted Data x1=".$x1." y1=".$y1." t1=".$t1." x2=".$x2." y2=".$y2." t2=".$t2; include 'db_disconnect.php'; ?> The java code else if (action.equals("Play")) { for (int i = 0; i < 5; i++) { // data.size() String x1, y1, t1, x2, y2, t2 = ""; String date = "2010-04-03 "; String ms = ".0"; x1 = data.elementAt(i)[1]; y1 = data.elementAt(i)[0]; t1 = date + data.elementAt(i)[2] + ms; x2 = data.elementAt(i)[4]; y2 = data.elementAt(i)[3]; t2 = date + data.elementAt(i)[5] + ms; try { //Create Post String String dta = URLEncoder.encode("x1", "UTF-8") + "=" + URLEncoder.encode(x1, "UTF-8"); dta += "&" + URLEncoder.encode("y1", "UTF-8") + "=" + URLEncoder.encode(y1, "UTF-8"); dta += "&" + URLEncoder.encode("t1", "UTF-8") + "=" + URLEncoder.encode(t1, "UTF-8"); dta += "&" + URLEncoder.encode("x2", "UTF-8") + "=" + URLEncoder.encode(x2, "UTF-8"); dta += "&" + URLEncoder.encode("y2", "UTF-8") + "=" + URLEncoder.encode(y2, "UTF-8"); dta += "&" + URLEncoder.encode("t2", "UTF-8") + "=" + URLEncoder.encode(t2, "UTF-8"); System.out.println(dta); // Send Data To Page URL url = new URL("http://localhost/newvector.php"); URLConnection conn = url.openConnection(); conn.setDoOutput(true); OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); wr.write(dta); wr.flush(); // Get The Response BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line; while ((line = rd.readLine()) != null) { System.out.println(line); //you Can Break The String Down Here } wr.close(); rd.close(); } catch (Exception exc) { System.out.println("Hmmm!!! " + exc.getMessage()); } }

    Read the article

  • How do I get code coverage of Perl cgi script when executed by Selenium?

    - by Kurt W. Leucht
    I'm using Eclipse EPIC IDE to write some Perl cgi scripts which call some Perl modules that I have also written. The EPIC IDE lets me configure a Perl CGI "run configuration" which runs my CGI script. And then I've got Selenium set up and one of my unit test files runs some Selenium commands to run my cgi script through its paces. But the coverage report from Module::Build dispatch 'testcover' doesn't show that any of my module code has been executed. It's been executed by my cgi script, but I guess the CGI script was run manually and was not executed directly by my unit test file, so maybe that's why the coverage isn't being recognized. Is there a way to do this right so I can integrate Selenium and unit test files and code coverage all together somehow?

    Read the article

  • Should I use PHP or PHP + J2EE?

    - by Sean Xiong
    I'm going to start a new project with instant message support. I find that there is no good long polling solution in PHP, but there is some good ones in J2EE. I'm wondering if I can integrate PHP and J2EE to get the function? Or should I just use J2EE instead of PHP? Thanks.

    Read the article

  • Looking for good PHP editor or IDE with 'IntelliSense'

    - by Andrew
    Hello, I'm looking for suitable PHP Editor or IDE with syntax auto-completion. I've tried trial versions of programs like Zend Studio, PHPDesigner, NetBeans PHP, NuSphere PhpED, and similar -- but none of them fully satisfied me. I quite liked hint window with detailed info about what function does and what it returns. Also I liked the way NetBeans auto-complete code (for example inserts all required parameters in function declaration as "dummy fields" and then you can jump between them using TAB in order to edit them). On the other hand, environment of NetBeans doesn't belong to the nicest. In this regard I prefer PHPDesigner with its sleek and light interface. At this moment I don't use any of the debugging options, since I don't know yet how to use profiller, breakpoints, watches and what not, so at this point my only concern is good autocompletion. For this purpose NetBean would be great choice, but with future in mind I am not sure debugging will be good in NetBeans, especially as I would prefer to use remote Linux server for this. So in short, I'm looking for editor that: Have similar code auto-completion (IntelliSense) like NetBeans Allow you to debug code using remote server (or sets up own debugging server like PHPDesigner does) without need to run Apache and similar on local computer Is preferably easy to use / intuitive interface Any ideas?

    Read the article

  • use php to parse json data posted from another php file

    - by akshay.is.gr8
    my web hosting has blocked the outward traffic so i am using a free web hosting to read data and post it to my server but the problem is that my php file receives data in the $_REQUEST variable but is not able to parse it. post.php function postCon($pCon){ //echo $pCon; $ch = curl_init('http://localhost/rss/recv.php'); curl_setopt ($ch, CURLOPT_POST, 1); curl_setopt ($ch, CURLOPT_POSTFIELDS, "data=$pCon"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $d=curl_exec ($ch); echo $d."<br />"; curl_close ($ch); } recv.php <?php if(!json_decode($_REQUEST['data'])) echo "json error"; echo "<pre>"; print_r($data); echo "</pre>"; ?> every time it gives json error. but echo $_REQUEST['data'] gives the correct json data. plz help.

    Read the article

  • Permanently write variables to a php file with php

    - by Oliver
    I need to be able to permanently change variables in a php file using php. I am creating a multilanguage site using codeigniter and using the language helper which stores the text in php files in variables in this format: $lang['title'] = "Stuff"; I've been able to access the plain text of the files using fopen() etc and I it seems that I could probably locate the areas I want to edit with with regular expressions and rewrite the file once I've made the changes but it seems a bit hacky. Is there any easy way to edit these variables permanently using php? Cheers

    Read the article

  • Php function available on other php page

    - by Vafello
    I have a function that I use on index.php page and I would like to call it from other php page (other.php). How to make this function available without redeclaration? I think it's achievable using sessions, but I am not sure how to do it exactly.

    Read the article

  • How to return array of C++ objects from a PHP extension

    - by John Factorial
    I need to have my PHP extension return an array of objects, but I can't seem to figure out how to do this. I have a Graph object written in C++. Graph.getNodes() returns a std::map<int, Node*>. Here's the code I have currently: struct node_object { zend_object std; Node *node; }; zend_class_entry *node_ce; then PHP_METHOD(Graph, getNodes) { Graph *graph; GET_GRAPH(graph, obj) // a macro I wrote to populate graph node_object* n; zval* node_zval; if (obj == NULL) { RETURN_NULL(); } if (object_init_ex(node_zval, node_ce) != SUCCESS) { RETURN_NULL(); } std::map nodes = graph-getNodes(); array_init(return_value); for (std::map::iterator i = nodes.begin(); i != nodes.end(); ++i) { php_printf("X"); n = (node_object*) zend_object_store_get_object(node_zval TSRMLS_CC); n-node = i-second; add_index_zval(return_value, i-first, node_zval); } php_printf("]"); } When i run php -r '$g = new Graph(); $g->getNodes();' I get the output XX]Segmentation fault meaning the getNodes() function loops successfully through my 2-node list, returns, then segfaults. What am I doing wrong?

    Read the article

  • PHP file outside doc root needs files outside and inside the document root

    - by jax
    I have a library of classes, all interrelated. Some files are inside the document root and some are outside using the <Directory> and Alias features in httpd.conf Assuming I have 3 files: webroot.php (Inside the document root) alias_directory.php (Inside a folder outside the doc root) alias_directory2.php (Inside a **different** folder outside the doc root) If alias_directory2.php needs both webroot.php and alias_directory.php, This does not work. (Remember alias_directory.php and alias_directory2.php are not in the same locations) require_once $_SERVER['DOCUMENT_ROOT'].'/webroot.php'; //(ok) require_once $_SERVER['DOCUMENT_ROOT'].'/alias_directory.php'; //(not ok) This does not work because alias_directory.php is not in the doc root. Similarly require_once $_SERVER['DOCUMENT_ROOT'].'/webroot.php'; //(ok) require_once dirname(__FILE__).'/alias_directory.php'; //(not ok) The problem here is that dirname(__FILE__) will return the path for alias_directory2.php not alias_directory.php. This works: require_once $_SERVER['DOCUMENT_ROOT'].'/webroot.php'; //(ok) require_once '/full/path/to/directory/alias_directory.php'; //(ok) But is very nasty and is a maintenance nightmare if I decide to move my library to another location. How do I solve this problem, is seems that I need a way to resolve an Alias folder properly.

    Read the article

  • executing php cURL script for long time without changing php.ini settings

    - by Pragati Sureka
    Scenario I have a old blog on blogger that contains thousands of images and posts, i have already imported the posts from blogger to wordpress using their import service (which does not import images) now i want to write a php cURL script that will download all the images off my old blogger blog to wordpress. Problem I have already written a script that goes through all the posts and find the image links of blogger and download the links recursively and store them local to wordpress installation but the problem is that the script stops if its taking longer than max_execution_time which is generally set to 30 secs. Now i dont want to change setting in php.ini file. Is there some way that i can keep my script executing for that long or some other alternative.... like executing in batch or something else... Reason for not changing php.ini settings is that i want to release this script as opensource plugin for wordpress, and not many have access to their php.ini file on the server and and many don't like changing settings for just one script that might run just once. Thank You for helping....

    Read the article

  • Deploy PHP website to client server without showing PHP files

    - by ColmF
    I asked a recent question regarding the use of readfile() for remotely executing PHP, but maybe I'd be better off setting out the problem to see if I'm thinking the wrong way about things, so here goes: I have a PHP website that requires users to login, includes lots of forms, database connections and makes use of $_SESSION variables to keep track of various things I have a potential client who would like to use the functionality of my website, but on their own server, controlled by them. They would probably want to restyle the website using content and CSS files local to their server, but that's a problem for later I don't want to show them my PHP code, since that's the value of what I'd be providing. I had thought to do this with calls to include() from the client's server to mine, which at least keeps variable scope intact, but many sites (and the PHP docs) seem to recommend readfile(), file_get_contents() or similar. Ideally I'd like to have a simple wrapper file on the client's server for each "real" one on my server. Any suggestions as to how I might accomplish what I need? Thanks, ColmF

    Read the article

  • Difference between two PHP times as years, months and days for PHP version 5.2

    - by Dominor Novus
    Forward: I've scanned through the existing questions/answers on this matter. This is not a duplicitous question; I cannot find a working solution from the accepted answers. The main questions/answers I've reviewed can be found here: How to calculate the difference between two dates using PHP? What I need: A calucalation of the difference between two dates expressed as years, months and days that works with PHP version: 5.2. <?php $current_date = date('d-M-Y'); $future_date = '2012-11-01'; ?> What I've tried: Most answers I find online don't seem to exact in that they don't factor in leap years. This highly rated answer won't work because DateTime-diff() is php 5.3+. This accepted answer results in (i.e. the second block of code aimed at PHP 5.2) results in the following being parsed: Array ( [y] = 25 [m] = 11 [d] = 7 [h] = 3 [i] = 15 [s] = 19 [invert] = 0 [days] = 9473 ) Array ( [y] = 25 [m] = 11 [d] = 7 [h] = 3 [i] = 15 [s] = 19 [invert] = 1 [days] = 9473 ) I can't tell if I've incorrectly applied the code or it's simply a case of me not knowing how to manipulate the array.

    Read the article

  • fsockopen() error : Network is unreachable port 43 in php [closed]

    - by hamid
    i've writed some Php code that lookup for domain (whois) but it fails !! this is some of my code : function checkdomain($server,$domain){ global $response; $connection = fsockopen($server,43); fputs($connection, "domain " . $domain . "\r\n"); while(!feof($connection)){ $response .= fgets($connection, 4096); } fclose($connection); } checkdomain("whois.crsnic.net","www.example.com"); the code work on my localhost ( apache,php,mysql, OS - Win XP ) but when i uploaded it to my host (Linux) it failed. and i always see the Below Error/message : Warning: fsockopen() [function.fsockopen]: unable to connect to whois.crsnic.net:43 (Network is unreachable) in /home/hamid0011/public_html/whois/whois.php on line 37 what should i do ? is this my host's problem or whois server ( but it work in localhost ) or my code ? TNX

    Read the article

  • Ajax does not send the data to my php file [migrated]

    - by Mert METIN
    I try to send my data to php file but does not work. This my ajax file var artistIds = new Array(); $(".p16 input:checked").each(function(){ artistIds.push($(this).attr('id')); }); $.post('/json/crewonly/deleteDataAjax2', { artistIds: artistIds },function(response){ if(response == 'ok') alert('dolu'); elseif (response == 'error') alert('bos'); }); and this is my php public function deleteDataAjax2() { extract($_POST); if (isset($artistIds)) $this->sendJSONResponse('ok'); else $this->sendJSONResponse('error'); } However, my artistIds in php side is null. Why ?

    Read the article

  • Why are PHP function signatures so inconsistent?

    - by Shamim Hafiz
    I was going through some PHP functions and I could not help notice the following: <?php function foo(&$var) { } foo($a); // $a is "created" and assigned to null $b = array(); foo($b['b']); var_dump(array_key_exists('b', $b)); // bool(true) $c = new StdClass; foo($c->d); var_dump(property_exists($c, 'd')); // bool(true) ?> Notice the array_key_exists() and property_exists() function. In the first one, the property name(key for an array) is the first parameter while in the second one it is the second parameter. By intuition, one would expect them to have similar signature. This can lead to confusion and the development time may be wasted by making corrections of this type. Shouldn't PHP, or any language for that matter, consider making the signatures of related functions consistent?

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >