Welcome Guest, Not a member yet? Register   Sign In
Issues moving Codigniter from Windows server to Linux based server
#1

I have moved a CodeIgniter based site from a Windows based server to a Linux based server. I have had various issues. Currently I am stuck on images failing to upload. (server timeout error - about 3 seconds after upload finishes)

Steps taken: Set uploads folder to 777. Try php 5.4 & 5.2. I was looking for a suspected temp folder somewhere, but not finding one. I have searched, and found an article discussing CodeIgniter timing out after 300s. But in my case, it times out almost immediately upload is initiated. File attempting to upload is 41kb.
I have checked php settings, max_input_time: 60, upload_max_filesize: 64M, post_max_size: 64M
Base url & path changed: must be right, the whole site works except for uploading images in admin area.
Garry Cross, Web Design, Hosting & Domains
Garry Cross Personal Computers (GXPC)
Reply
#2

(This post was last modified: 06-10-2015, 12:07 AM by gazzari.)

After much searching, it appears it might most likely be an Ajax issue. The file uploader appears to be ajax, and there are known issues with CI and Ajax and session errors.

I found some log files. They do correspond to what I did on the website.
The first line is the last line displaying action of refreshing web page and time taken.
The following lines are for click on browse for image and click upload.

Code:
DEBUG - 2015-06-10 01:58:43 --> Total execution time: 0.0495
DEBUG - 2015-06-10 02:00:10 --> Config Class Initialized
DEBUG - 2015-06-10 02:00:10 --> Hooks Class Initialized
DEBUG - 2015-06-10 02:00:10 --> Utf8 Class Initialized
DEBUG - 2015-06-10 02:00:10 --> UTF-8 Support Enabled
DEBUG - 2015-06-10 02:00:10 --> URI Class Initialized
DEBUG - 2015-06-10 02:00:10 --> Router Class Initialized
DEBUG - 2015-06-10 02:00:10 --> Output Class Initialized
DEBUG - 2015-06-10 02:00:10 --> Input Class Initialized
DEBUG - 2015-06-10 02:00:10 --> Global POST and COOKIE data sanitized
DEBUG - 2015-06-10 02:00:10 --> Language Class Initialized
DEBUG - 2015-06-10 02:00:10 --> Loader Class Initialized
DEBUG - 2015-06-10 02:00:10 --> Helper loaded: url_helper
DEBUG - 2015-06-10 02:00:10 --> Helper loaded: sql_date_helper
DEBUG - 2015-06-10 02:00:10 --> Helper loaded: form_helper
DEBUG - 2015-06-10 02:00:10 --> Database Driver Class Initialized
DEBUG - 2015-06-10 02:00:10 --> Native_session Class Initialized
DEBUG - 2015-06-10 02:00:10 --> Session class already loaded. Second attempt ignored.
DEBUG - 2015-06-10 02:00:10 --> Cart Class Initialized
DEBUG - 2015-06-10 02:00:10 --> Encrypt Class Initialized
DEBUG - 2015-06-10 02:00:10 --> Model Class Initialized
DEBUG - 2015-06-10 02:00:10 --> Model Class Initialized
DEBUG - 2015-06-10 02:00:10 --> Model Class Initialized
DEBUG - 2015-06-10 02:00:10 --> Controller Class Initialized
DEBUG - 2015-06-10 02:00:10 --> Template Class Initialized
DEBUG - 2015-06-10 02:00:10 --> MY Controller Class Initialized
DEBUG - 2015-06-10 02:00:10 --> Encrypt class already loaded. Second attempt ignored.
Garry Cross, Web Design, Hosting & Domains
Garry Cross Personal Computers (GXPC)
Reply
#3

(This post was last modified: 06-10-2015, 12:23 AM by skunkbad.)

This might sound like a stupid question, but do the directories you are uploading to actually exist? If you are trying to upload to a child directory that doesn't exist, you'd have to use mkdir first.

I've worked a lot with CI and ajax uploaders, and not had any problems related to sessions. I think blaming sessions is common, but you could remove the need for a session, and then does you uploader then start working? Probably not.

Does the ajax uploader you are working with provide any debugging info sent to console? What uploader is it? Just for kicks, you could try out the uploader that is demonstrated in Community Auth. It definitely works, and I'm using it on a production website where thousands of files have been uploaded using it. No session problems. Windows, Linux, Mac ... no problems. Windows server, Linux server ... no problems.
Reply
#4

If you are using relative paths, try to use abolute. If you are using absolute, try to use relative paths.
Reply
#5

The directories do exist. There are images in them which display on the site.

NO idea if it has debugging. After some searching, came up with http://dojotoolkit.org/

How would I try without session?

After what you said, and my experience with these sites, I am guessing it could also be a missing capital letter at a start of a file.

I spent hours combing through files to get the site working when I first moved it from the windows server. There are a mixture of capitalised and uncapitalised files right through the site.
Garry Cross, Web Design, Hosting & Domains
Garry Cross Personal Computers (GXPC)
Reply
#6

It would be great if I could find someone who knew CI that was trustworthy. I tried Freelancer for a few jobs-it wasn't worth it.
I had one job quoted at US$1000 just to start, I fixed it in 15 minutes.

I am in a bit of a dilemna, I have a customer who wants their site working, and obviously doesn't want to pay for something which they didn't do. I have also a wholesale hosting provider which has dumped server changes on me making a heap of sites need repairs. This is why I am leaving them and moving my sites. Unfortunately the guy who built the site was very loose with coding which doesn't help.
Garry Cross, Web Design, Hosting & Domains
Garry Cross Personal Computers (GXPC)
Reply
#7

(This post was last modified: 06-10-2015, 02:06 AM by Avenirer.)

also, make sure you don't have CSRF enabled, or, if you do, make sure it's done correctly.

after a few seconds... Oups... sorry, missed the fact that you said it worked on windows...
Reply
#8

When something worked on Windows and started failing when it was moved to Linux, you're going to be looking at a few specific things, but likely won't need to change any code (with one exception):
  • Capitalization of filenames must match the filename conventions required by the version of CodeIgniter you are using. With CI2 you're usually looking at all-lowercase filenames for controllers and models, while library class and filenames must use matching case (usually ucfirst). Check the documentation for any file type you're not sure about, or look at the code for the loader if you're comfortable reading through it for the filename handling.
  • Permissions. Remember that, in most cases, the only thing that really matters for uploading is whether the account being used by your web server (usually www-data for Apache/Linux) has permission to write to the directory.
  • Configuration differences between the server and the local environment (this is the exception in which you may have to change some code, but it will usually be in your /application/config/ directory or your .htaccess file). Of course, if everything else is working, most of the configuration is probably fine (unless you have an upload.php file in your config directory with some configuration error).
Reply
#9

I set this up on my windows laptop running EasyPHP. Site runs as it should there also, but gets same timeout.

I contacted my wholesale hosting, and they said there was missing files. Errors below.

12:14:14 access("application/libraries/MY_Encrypt.php", F_OK) = -1 ENOENT (No such file or directory) 12:14:14 access("application/third_party/libraries/Encrypt.php", F_OK) = -1 ENOENT (No such file or directory) 12:14:14 access("application/libraries/Encrypt.php", F_OK) = -1 ENOENT (No such file or directory)

These are supposed to be missing files, but are not in the original source files. And are not in any backups.

I cannot find any other configuration settings anywhere.

Dojo appears to be the ajax uploader used.
Garry Cross, Web Design, Hosting & Domains
Garry Cross Personal Computers (GXPC)
Reply
#10

(This post was last modified: 06-10-2015, 05:31 PM by gazzari. Edit Reason: More info )

I added the 3 missings files as empty php files and got an error, "Non-existent class: Encrypt"

system/libraries/Encrypt.php exists, but the other 3 do not.

I had a look in an archived zip: CodeIgniter_2.1.3.zip
The 3 files
application/libraries/MY_Encrypt.php <sort of expected this not to be there
application/libraries/Encrypt.php <I expected this ti be in the zip file
application/third_party/libraries/Encrypt.php <I imagine this is probably a copy of the 1 above

Where would I get these files?
Garry Cross, Web Design, Hosting & Domains
Garry Cross Personal Computers (GXPC)
Reply




Theme © iAndrew 2016 - Forum software by © MyBB