Jump to content

TFT2012

Members
  • Posts

    35
  • Joined

  • Last visited

About TFT2012

  • Birthday 12/15/1980

Profile Information

  • Gender
    Male
  • Location
    Southern California

TFT2012's Achievements

Member

Member (2/5)

0

Reputation

  1. I have the folder structure like: root application system assets uploads folder assets contains all css, img, and js. uploads contains user uploaded file. I set a "helper/assets_helper.php" file to define: define ('ASSETS_PATH', base_url().'assets/'); define ('UPLOAD_URL', base_url().'uploads/'); For all the css, img, and js, it works well like href="<?php echo ASSETS_PATH; ?>css/mycss.css" But when I display the uploaded images, it couldn't display image with <a href="<?php echo UPLOAD_URL;?>images/myupload01.jpg" ><img src="<?php echo UPLOAD_URL;?>images/myupload01.jpg" /></a> This uploaded image actually works fine with my localhost with the link like: http://localhost:9000/uploads/images/myupload01.jpg. But it couldn't display on my hosting server with like: http://users.mywebsite.com/uploads/images/myupload01.jpg Can anyone shed some light on it. Thanks!
  2. That's my first time to see this kind of issue. The PROD environment: Godaddy, IIS7, PHP5.4.30 The Local environment: Linux, PHP 5.5.X The framework: CodeIgniter 2.2.0 Process: I have view have form to update multiple files. echo form_open_multipart('admin/UploadFiles'); The controller will do an initial check, if( isset($_SERVER["CONTENT_LENGTH"]) && ($_SERVER["CONTENT_LENGTH"]>((int)ini_get('post_max_size')*1024*1024))) { $this->session->set_flashdata('upload_error', 'Your file is too big to handle.'); redirect($_SERVER['HTTP_REFERER']); } else { if($_FILES['files']['error'][0] != 0) { $this->session->set_flashdata('upload_error', 'There are no files selected.'); redirect($_SERVER['HTTP_REFERER']); } else { $photo_info = array(); $photo_info = $_FILES['files']; $this->load->model('uploadfile'); $results = $this->uploadfile->UploadImages($photo_info); // My debug echo "<pre>"; print_r($results); echo "</pre>"; // redirect($_SERVER['HTTP_REFERER']); } In my model file, for debug purpose, I only put these lines. Since I have traced the code line one by one, finally found the 500 error happens here. if (!empty($this->CheckFileError($images))) { $results['fail'] = $this->CheckFileError($images); foreach($this->CheckFileError($images) as $err) $error_idx[] = $err['index']; } It happens on empty($this->CheckFileError($images)) //$this->CheckFileError($images) is an array If I just "return $this->CheckFileError($images)", it has no error at all. But If I do the code above, it will give me Internal 500 error. After I change to count($this->CheckFileError($images)) == 0 everthing works. All the other logics in the actual model are remain same. I only change this line. It has no problem at all in my local. Only when I run it on my Godaddy IIS share hosting. Initially I thought the temp folder to hold the files is not writable. I even spent whole night to talk to Godaddy guys, but no progress. Even I tried create .user.ini to change the "upload_tmp_dir", it still gave me 500 error. Tonight, I debugged my code lines one by one, tested it in local first, then tested in Godaddy. Finally I found the root cause for my internal 500 error. However, I don't know why empty() will cause this issue. Can anyone explain it? I Googled, but didn't find any userful information. The reason why I use IIS is because I write my most of the services in WCF. Thanks!
  3. Figured it out. Since the CI will get $uri = $_SERVER['REQUEST_URI'] at the begining even doing the setup $config['uri_protocol'] = 'AUTO'; in config.php. Using the link through Squid, the $uri will return full http path, like http://mysite:9000/... However, using the link without passing Squid will just return "/index.php/....". The later is recoginzed by CI correctly, but the 1st is not. So I go to system/core/URI.php, add the following to take of the "http://" part, just make its format same as "/index.php/...." private function _detect_uri() { if ( ! isset($_SERVER['REQUEST_URI']) OR ! isset($_SERVER['SCRIPT_NAME'])) { return ''; } $uri = $_SERVER['REQUEST_URI']; // Starts here if(strstr($uri, 'http')) { $temp_uri = explode(':', $uri); $uri = str_replace($_SERVER['SERVER_PORT'], '', $temp_uri[2]); } // Ends here if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0) { $uri = substr($uri, strlen($_SERVER['SCRIPT_NAME'])); } ................ ................ }
  4. I have setup the CI app at the port 9001. I didn't do the rewrite things. So my url looks like the original one mysite:9001/index.php/category/shoes. It works well before I setup the Squid. I tried to setup the Squid on the same server with Apache. I assigned the port 9000 to Squid. To test, I added a simple sysinfo.php file to display phpinfo on the root of my app. It works if I do mysite:9000/sysinfo.php (go through Squid). However if I do mysite:9000/index.php/category/shoes, it will say "404 page not found". The mysite:9001/index.php/category/shoes still works though. Can anyone give me a hand on this? Thanks!
  5. Finally I figured it out. It was quite simple. Ignore the settings above, I wrote the following one. The Squid ver is 3.3.9 acl Safe_ports port 9000-9009 #My testing ports http_port 9000 accel defaultsite=mywebsitename cache_peer "the IP of mywebsite" parent "the actual port mywebsite uses" 0 # I assigned 9000 to Squid # I changed the actual website port from 9000 to 9001.
  6. I have a HTTP server setup on port 9000. I want to setup a squid proxy server lies before it. After I installed the squid, I just did two changes: acl Safe_ports port 9000 # http acl ppnetwork src 192.168.0.0/24 http_access allow ppnetwork Then, I squid -k parse squid The squid is running. I can see the log from cache.log 2013/09/18 16:25:44 kid1| Store logging disabled 2013/09/18 16:25:44 kid1| Swap maxSize 0 + 262144 KB, estimated 20164 objects 2013/09/18 16:25:44 kid1| Target number of buckets: 1008 2013/09/18 16:25:44 kid1| Using 8192 Store buckets 2013/09/18 16:25:44 kid1| Max Mem size: 262144 KB 2013/09/18 16:25:44 kid1| Max Swap size: 0 KB 2013/09/18 16:25:44 kid1| Using Least Load store dir selection 2013/09/18 16:25:44 kid1| Set Current Directory to /home/xxxxx/squid/var/cache/squid 2013/09/18 16:25:44 kid1| Loaded Icons. 2013/09/18 16:25:44 kid1| HTCP Disabled. 2013/09/18 16:25:44 kid1| Squid plugin modules loaded: 0 2013/09/18 16:25:44 kid1| Accepting HTTP Socket connections at local=0.0.0.0:3128 remote=[::] FD 9 flags=9 2013/09/18 16:25:45 kid1| storeLateRelease: released 0 objects But, if I access the http site like http://mysite:9000, should I supposed to see any contents in the squid access.log? If so, why is my access.log empty? Do I setup the proxy server correctly? Thanks!
  7. Hi all, Are we able to make Apache create the access_log each month automatically? I tried like this: But it returns me the file name just like " access_log_%{year_month}t ". Can anyone help? Thanks a lot.
  8. Determine the if the method is "POST" or "GET"
  9. The form.php is re-directed from feedback.php. $_POST won't have data because the form action is "feedback.php", but not "form.php". Since you use session, you may save the $_POST in session variable, then read it on form.php.
  10. This file contains the class CurlData{}. parseapc.php calls the data service from it in order to retrieve the necessary data. So I don't put session_start() inside.
  11. Yeah, I applied session_start() in all index.php, dashboard.php, readapc.php, and includes/login.php
  12. Hi, I have question about the PHP session. First, I have the site directory like this: -- root ---- classes -------- auth.php -------- curldata.php ---- includes -------- longin.php ---- index.php ---- dashboard.php ---- readapc.php The index.php has the login form: <form action="includes/login.php" method="post"> If login is successful, the login.php will do: require_once ("../classes/auth.php"); if ( success) { $_SESSION["logged"] = true; $_SESSION["user"] = array information // The user information array is returned from "auth.php". header("Location: ../dashboard.php"); } else header("Location: ../index.php"); In dashboard.php, it will display the $_SESSION['user'] data correctly. If clicking the link to readapc.php inside dashboard.php, the $_SESSION['user'] is good as well. The problem happened when I do the following code inside "readapc.php": (It is okay if I don't do this) require_once ("classes/curldata.php"); $result = data retrieved from curldata.php; $_SESSION['data'] = $result; If I do the things above, when I click the readapc.php, the session data is gone, readapc.php does NOT show $_SESSION['user'] data no more. (I am in readapc.php page now). But the $_SESSION['data'] is displayed well. Then, if I click dashboard.php link, it will jump to login page (index.php) because I setup if (!isset($_SESSION['logged'])) header("Location: index.php") on all index.php, dashboard.php, and readapc.php. Could anyone give me a hand on this problem? Thanks!
  13. In IE, we can do such things: wscript = new ActiveXObject("WScript.Shell"); wscript.SendKeys("%{ }"); Can we do the similar thing in Firefox? If so, how can we achieve it in Firefox. Thanks.
  14. Hi, I have a newbie question again here. Now I am really confused with $this in each phtml page. Like, I have a IndexController.php in controller folder, then correspondingly, will have a index folder underneath the view->scripts folder. Then inside the views->scripts->index folder, each phtml file, the $this will refer to the IndexController object. Am I right? If I am correct above, then Zend wants us to use layout. For application->layouts->scripts folder, I create a phtml file named main.phtml ( follow the Zend quickstart guide ). Inside the main.phtml, it contains $this too, like $this->layout()->content. There is no such a controller like xxxxController for layout, I am wondering which object this $this refers to? Why can it invoke layout() and content, where do these two come from? I only thing did for layout was adding "resources.layout.layoutpath = " in Bootstrap.ini. Please help, thanks!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.