WinCache caching incorrect CakePHP files - php

I have a bizarre problem with WinCache and it's possible this isn't the best forum. I checked SuperUser but there are 0 results regarding WinCache. Support seems to be weak throughout the web but at least SO has discussed it before.
I have a live and a development site on the same server (CakePHP framework, Windows Server 2008 R2, IIS 7.5, PHP 5.3, FastCGI, WinCache 1.1). Live site is on port 80 and dev on 81. IIS has two web sites, each pointing to a different root folder in Inetpub\wwwroot. Each site is run under a different application pool.
Some time after a change to the dev site the live site started erroring. After some painful debugging I found out that the following (totally lame) chain of events occurs:
Live PHP script loads as normal following GET request
Live PHP script POSTs to itself as normal following user selection
Dev PHP script handles POST request and errors when form parameters are not as expected.
If I inspect the WinCache properties through the web interface under port 80 (live site) I see the document root is Inetpub\wwwroot\Live - as expected. However, if I review the list of cached files under the file cache tab I see some files cached twice. Mouse-over tells me that one is from Inetpub\wwwroot\Dev and the other from Inetpub\wwwroot\Live.
How is this possible? Why is IIS using one in a GET request and another in POST? I know that CakePHP chooses which files to load based on a formatted URL, but the index.php file which handles routing is within Inetpub\wwwroot\Live, so presumably could never request a file in a different doc root. It seems to me that PHP asks IIS for a file, but IIS is losing its marbles when communicating with WinCache.
So far I can't see any way to disable WinCache for one site, but even if I could I probably wouldn't trust it anymore.
Any suggestions on this vexing issue will be much appreciated.

I have no Problems.
Try this:
Use Wincache 1.2 (Beta)
Dont use "." in the AppPool Name.
(Opt.) Create a ProcessUser for each AppPool.
Look for session files called "wincache_session_*" in the our session directory.
Copy the wincache.php from "[AppDir 86]\IIS[Wincache]\wincache.php" in each webdirectory
and open it over http.

Related

Setting Up PHP Push/Pull With Ubuntu Server

Bear with me here ... I can't show exact examples or provide a link to the web server for security reasons. If anything more is needed I will gladly provide it.
What I HAVE:
I have a server that hosts an internal networked intranet for my company.
Coded with PHP, MySQL, HTML, etc
Ubuntu 14.04LTS
Normal Apache Web Server Configuration
Login access
Couple hundred PHP files for different pages/features needed for the company
Maintenance
FTP into the directories (shown below)
Manually edit PHP files with Notepad++
Test in Beta Directory -> move to -> Secure (overwriting current file there)
I know this procedure for maintaining is horrible so I'm trying to come up with a better solution
What I NEED:
Features
IDE Connectivity (Aptana,Eclipse,etc)
Commit/Push/Pull Capable with Server from IDE
Version Control
Keep backups for Rollbacks
Test & Main Server
Like how I have a Beta and Secure Directory for testing and releasing to everyone
What needs to be done on the Ubuntu Server in order to accept push/pull requests, store multiple versions, and store commit messages?
Do I need to install anything on the Ubuntu server in order to communicate with the remote computer I'm trying to access from?

Laravel / Nginx serving wrong site

I have tried everything.
I recently tried to deploy a new Laravel application on my Ubuntu Digital Ocean droplet. I have done this many times in the past and have done nothing out of the ordinary with this project. I'm using https://gist.github.com/jamieshepherd/50419bb148a4f43e8266 this as a template nginx configuration, which I base all of my sites off. However, this time I deployed and went to my domain, I was served another client's site. The site had no images, styles, scripts etc. - but sure enough this was the wrong site. Weirdly, I could go to /images/example.jpg and get the correct file which would be in /public/images/example.jpg - but the actual routes were being served from a completely different folder.
There is absolutely no reference to the other client in my project anywhere, I feel like it has something to do with Laravel or PHP5-FPM setting some kind of root directory to the other folder.
I have gone to /public/index.php and just echo and died a message, and this works fine. When I revert the change and let the application run it again displays the other client's application. Here's a list of other things I've tried.
Temporarily renaming the other client's folder, as expected, NewSite throws a 404 error
Temporarily disabling the other client's nginx block, NewSite continues to serve the other client's site (remember, not css/images/scripts, weirdly)
Reinstalling PHP5-FPM
Printing the document_root, everything looks normal (/web/NewSite/public)
Trying to run the site off a different port
Pulled a working Laravel application from a completely different server, put it on this server, set the domain to point to this working application, serves the other client's site
Grep'd for any references to the client site in any of the project folders just to check I wasn't going insane, confirmed I'm not insane, though after all this I'm not sure anymore
Really I'm lost, I have no idea how to debug this any more.
Site trying to deploy: http://paragon.gg
Client site view that it's servring: https://swellhunter.co.uk
Client site NGINX conf: https://gist.github.com/jamieshepherd/4ff5430ddb13ed04f22c
Edit: Update: To make matters even more bizarre. I have temporarily removed swellhunter from sites-enabled, visited paragon.gg, still serves swellhunter's index. WHAT? There is absolutely no reference to the site at all now, I've even moved the paragongg folder to a completely different place to check. How on earth is it even finding the view with no reference to go on?
Seems like an issue with Laravel rather than with nginx or with your VPS.
Since you pointed out simple PHP file is pointing out rightly.
SSH to your droplet and run you laravel app using php artisan serve.
And access your droplet on port:3000
If the problem persists you can rule out server issues and can concentrate on debugging laravel app. Maybe be there is something wrong with you laravel app itself, some unwanted changes etc. Did you verify your laravel App?
Can you paste an LS -l of the directory? Have you checked to see what you have in the Laravel app/config/app.php for url ? I just took a look at paragon.gg and put https://paragon.gg it gave me a cert error but after I accepted it the site looked fine. Is that not the result you wanted?

Diagnosing "The connection to localhost was interrupted"

I've been developing a Laravel 4 site on my work machine for over a year. Today I began receiving a The connection to localhost was interrupted error whenever I attempt to access the site. At the moment I'm just trying to find applicable log files that might tell me what's failing, and would appreciate suggestions from those more versed in tracking down this kind of failure. You'll see one possible cause below, but I still need to find some error logs to have any idea how to fix it. Here are some pertinent details:
I'm running Windows 7, IIS 7.5, PHP 5.5.1, and Laravel 4.1.23.
The application is accessed via https://localhost/ephy, and IIS is configured to deliver the ephy directory over SSL.
http://localhost/ephy correctly returns a 403 error indicating that the page must be accessed over SSL.
When copies of phpinfo.php (containing just a call to phpinfo() ) are placed in both the root directory and the ephy subdirectory, http://localhost/phpinfo.php executes, while https://localhost/ephy/phpinfo.php returns the connection reset error.
The application itself is executing successfully on the production server, so the PHP code is valid.
Yesterday I installed Office 2013, uninstalled Office 2010, uninstalled Office 2013, and then reinstalled Office 2013 (in that order). I also installed 2 GB of memory, because Outlook 2013 kept hanging.
The site was accessible as of 4pm yesterday, after all of that installation activity was already over.
I've made no changes to the application or the computer configuration since 4pm.
I've restarted the computer several times.
I've checked the files in C:\inetpub\logs\LogFiles , but they don't show any error messages.
So, I know PHP is running successfully and that the issue is specific to serving the application directory itself, but that's as far as I've been able to get. Recommendations on where to find (or how to generate) logs which would indicate what's happening, or any insights into the failure itself, would be appreciated.
Ok, after finally finding the magic combination of search terms on Google (ERR_CONNECTION_RESET localhost iis 7, for those who are curious, the first term being the error message from Chrome specifically), I was able to determine that this behavior can be caused by not having the self-signed security certificate correctly bound to the site in IIS. As I said, the site had been working successfully, but with the software updates I'd done something probably got borked (maybe adding the memory changed the computer's identity such that the certificate was no longer valid? I don't know).
So, I followed the instructions at http://weblogs.asp.net/scottgu/tip-trick-enabling-ssl-on-iis7-using-self-signed-certificates (with a bit of adjustment because apparently the binding has to be done at the default site level in IIS 7.5, rather than at the individual site level), whacking and replacing the existing certificate and SSL binding in the process. The site is now working again on my box.
So, in a nutshell: if you're running SSL on localhost under IIS and you get "connection to localhost was interrupted" messages, try redoing the certificate and binding.
Man, glad that's over...

Refreshing a PHP Server Cache

I have a paypal listener in a directory on a site I maintain e.g. \paypal\listener.php
I have it set to write to a mysql database, but it is writing to my development environment instead of my production environment.
This is weird because I have a model e.g. DAO.php that controls all access to the database. In other directories e.g. \directory2\page.php The page.php successfully writes to the production environment.
THE PROBLEM: To me this means that listener.php is including an old version of DAO.php (which is a class that was internally set to the development enviornment) In other directories though when this file is included the new version is being included.
Is it possible that one PHP implementation would server different versions of a file to different scripts??? If so how do I refresh the server cache that is making this happen?
I have already tried modifying and re-saving every relevant file to make the server think they are new.
Restarting the server probably would have solved this issue, but that was not an option, the Server was a Microsoft IIS machine using application pools and refreshing the application pools solved the problem.

Unable to deploy/move forward with simple web app

Beginning details:
Windows 7 Professional 64 bit
WAMP Version: 2.5
MySQL Version: 5.6.17
PHP Version: 5.5.12
Apache Version: 2.4.9
I also have Git, Heroku Toolbelt, etc.
I'm trying to deploy a PHP inventory web app I have on my computer using Heroku.
Currently, it's installed on my PC using WAMP server. Up to this point, it was just a web app used at a country club where any computer/phone/tablet could access and adjust inventory as long as they were on the same wireless network as the server.
Right now, I'm trying to get to the point where the country club can access the app from anywhere, and figured, I could host it on Heroku.
Every tutorial I watch/read explains how to deploy a single index.php file that contains a single line of code saying something like, "Hello world!", but this app contains 8 folders and 22 PHP files, all in the "www" file of WAMP. I've tried learning the concepts of how this works (creating a single file for everything; trying to deploy the index.php I already have, etc.)
I have tried tutorials and a lot of Heroku reading and attempts, but I'm unable to move forward with anything in terms of adding user authentication or the ability to sell it to restaurants/country clubs. I've combed through every word on Heroku tutorials, and I don't run into a single error during anything I try, but at the end of it all, when I try "heroku open", it opens up a blank page.
My "www" directory contains:
- cgi-bin
- css
- dbBackup
- img
- inc
- js
- tcpdf
- tmp
Then, there are all the PHP files of the different functions of the app listed below those.
My main question here is...what is the file that gets deployed on Heroku in this situation? I don't understand how the CSS, JS, and other database-related functions are included in a single index.php file that is apparently the file that's deployed when you launch a web app like this.
Thank you!
The default page loaded when a site is accessed is typically "index.html" or "index.htm". This file would normally have the content to create the initial splash page with links to the different services you might offer. Those services are what you would use php for with the supporting data in your MySQL database. In addition to copying your base files and directories over to the Heroku server, you will also need to create the MySQL tables and then populate them with data. This is a relatively simple process using the MySQL Workbench. It may be tedious if you have lots of tables and schema, but it is relatively simple. Comment back if you need help in this area or would like to discuss further.
Heroku runs a standard web server and looks for "index.php" as your starting file by default. You should have either an "index.htm", "index.html", or "index.php" file in your current base (www) directory. If you don't then it's likely that you currently start your app by going to a URL (www.yourwebsite.com) followed by a slash and some other text, such as "/tcpdf/startup.html".
If you have one of the index. files, then that's your starting point. Copy the complete set of files and directories over to your heroku site and then test it based on the URL they have given you, which will automatically look for an 'index.php' file. You will need to back up and restore your database from your local system to the heroku server, which is relatively straightforward using the mysql workbench. You'll need to recreate the users and their schema permissions on the heroku site so that the php files can access the new database.

Categories