Jump to content

TFT2012

Members
  • Posts

    35
  • Joined

  • Last visited

Everything posted by TFT2012

  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!
  15. Thank you Avi. It works. The Zend reference guide didn't mention that at all. Could you explain to me why it should add resource.view[] to configuration.
  16. Hi, I just start learning Zend Framework (1.11) and follow the ZF reference guide on Zend.com. I have a question here: I added the an _init function into Bootstrap under Application folder. The whole Bootstrap codes look like: class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { protected function _initDocType() { $this->bootstrap('View'); $view = $this->getResource('View'); $view->doctype('XHTML1_STRICT'); } } After I adding this _initDocType() function, the main page http://localhost/public/ cannot be displayed. If I commented out the _initDocType(), then page shows. Can anyone help me on this? Thank You!
  17. Thank you kicken. I have used cmake to install the MySQL. Now I have new questions on configuration. Since I installed the mysql on my personal folder, like /home/myname/lamp/mysql, when I tried to use ./mysqld start, it shows If I tried ./mysqladmin version, it shows ======= Question: I didn't see that mysql.sock file, where can I find it? I don't have permission to write to /etc/, where to copy that my-medium.cnf file (this is one of the step from tutorial).
  18. I used kill -TERM PID (the pid for port 8090) since I couldn't get rid of it before. Since I messed up the vhost conf file, somehow only one instance was ended by ./apachectl stop. Therefore I tried to kill the process to see if it works to stop the server. I am fool. Thanks for your remind. Hahh.
  19. Ahh..Thanks! You remind me. I messed up the vhost conf file. Thank You!
  20. I have an issue to choose the MySQL package. Since I cannot use RPM to install, I have to install from source. But I tried download mysql-5.5.24.tar.gz and mysql-5.5.24-linux2.6-i686.tar.gz, I couldn't find configure to run. Can anyone tell me which correct package should I download? Thanks!
  21. It's not localhost. Since I don't have SU right, I only can test remotely. First, I went to 8091, ./apachectl stop the service. Then I went to 8090 to do the same thing, but it says "httpd (no pid file) not running". From ps -eaf, the service(8090) is still running. Even I kill -TERM pid (8090), when I use xxxx:8090 on my browser, the page is still showing no matter how many times I refresh. It seems I couldn't control this Apache server(8090), which I installed before. Like the ps -eaf or netstae -lep --tcp has NO httpd running, but from remotely, http://xxx:8090 is still working.
  22. Now, the question above is solved. I installed apr and apr-util, then use --with-apr instead of --with-included-apr I have another question. After I installed, I ./apachect1 start. I can see it when I do ps -eaf | grep httpd. It also shows on netstat -lep --tcp But when I open the link, xxxx:8091 on my browser, the page can not be displayed. I have another apache running on 8090, which works normally. port 8090 apache server is on /home/myname/server1 (installed before, work fine, apache2.22.xx) port 8091 apache server is on /home/myname/server2 (just installed, apache2.4.2) Could anyone give me a hand? Thank you very much.
  23. I try to install the Apache 2.4.2 on my Linux. I have downloaded latest APR, APR-UTIL and extracted them to ./srclib/apr and ./srclib/apr-util. I also extracted the pcre to ./srclib/pcre. But when I tried to use ./configure --with-included-apr, it sill gave me How to install it correctly? Anything I missed?
  24. I have a part of php code (in Apache) which uses file_get_contents() to get data through a service url (in IIS7). The IIS 7 will need about 30 minutes to give the data back. Then I need to keep this execution in my Apache server for about 30 minutes. I have set the max_execution_time to 3600 in PHP, how can I do it in Apache? I added TimeOut 3600 to httpd.conf, but it seems dosen't work. Because after about 30 seconds running, the web page will ask me to download the php file instead of keep running the script. 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.