A story about PHP that was okay in the development environment but buggy in the production environment LEVEL 1-3 + 1

It's called a production environment, but it's usually a test environment. Please look a lot.

LEVEL1 case

Isn't there something for those who are developing on windows? It is not case sensitive in the development environment (windows) and is case sensitive in Linux.

The biggest damage I suffered was when the client sent me the images to use in the site creation. It's because some files with uppercase extensions are mixed in, so it's a fool.

image.png

Did you understand ...

I didn't notice it because the image was sent under the agreement of [code]. [Extension]. I noticed it just before putting it in the production environment, but it was very dangerous.

In addition, it should be noted

if (file_exists($imagePath . $fileName '.jpg')) {

} elseif (file_exists($imagePath . $fileName '.JPG')) {

}

The debt I wrote while I was in the second year at that time is still in active use.

LEVEL2 SSL If you are a web developer, you may meet them a little.

<iframe name="iframe" src="http://example.com/aaaaa/bbbb/" width="100%" scrolling="no" align="top" frameborder="0"></iframe>

An incident has occurred. You cannot load an http iframe from an https site.

I often use iframes when requesting "I will manage the source code, but I want to mess with some of it from my company!", But if the domain where the client's source is uploaded does not support SSL, it is ridiculous. There will be no.

The contents of the frame are pure white.

I wish I had made the development environment compatible with SSL without laying it sideways, but this time it was discovered for the first time in the test environment.

It will take time for the other party to support SSL, and as a result of discussions between both parties, we decided to proceed with the production with the power technique of "hard code the content in the frame for the time being". (Scary)

Right now, only content such as javascript and iframe is blocked, and images etc. are displayed properly as secure communication is not guaranteed, but Chrome seems to block images sequentially from 2020, so be careful. is.

LEVEL3 expansion module

Be careful with functions you don't normally use. In conclusion, I had a bug using a function that can be used only after installing the extension module, which is not a function that comes standard with php.

This was when I was reviewing the source code brought by a junior engineer, not me.

//The remainder of dividing the amount by 100 million
$surplus = bcmod($price, '100000000');

(I saw this guy for the first time ...% is good ...?) While thinking, I thought that it was not wrong and that it was not a bad thing to adopt a new writing style, so I gave it to the review.

However, when I gave it to the test environment ... image.png Whew! ??

... As I wrote at the beginning, let's carefully examine the functions that we see for the first time.

LEVEL 4 (bonus)

It's not php. Story around DB.

I won't go into details, but here are some of the walls I've encountered in the past. ・ Large amount of deadlock ⇒We did not consider writing from services other than the created process.

-Replication delay ⇒The master and slave were not prepared properly in the test environment.

・ Processing is more than 5 times slower than expected ⇒ When handling large-scale data, there was a considerable difference in the total processing time just because the distance between the WEB server and the DB server was large. Also, I have not tested it in an environment where it is mounted from an external server and handles data.

etc···

Summary (or lessons learned)

・ Let's make the production environment and the development environment as close as possible. ・ When you do something you haven't done before, be careful.

Recommended Posts

A story about PHP that was okay in the development environment but buggy in the production environment LEVEL 1-3 + 1
A story that stumbled when using pip in a proxy environment
A story that makes it easier to see Model debugging in the Django + SQLAlchemy environment
The story that the Homebrew environment was blown away when Anaconda was installed
A story about a build error in a shared library that references libusb
A story about creating a program that will increase the number of Instagram followers from 0 to 700 in a week
[Memorandum] A story about trying OpenCV tutorial (face recognition) in a Windows environment
[Development environment] How to create a data set close to the production DB
About the development environment you are using
The story that XGBoost was finally installed
Escape from Python's virtual environment ~ A story about being trapped in a virtual environment I created ~
Use the latest pip in a virtualenv environment
About the matter that was worried about sampling error
Set a fixed IP in the Linux environment
A story about running Python on PHP on Heroku
Think about building a Python 3 environment in a Mac environment
Build a Minecraft plugin development environment in Eclipse
The story that fits in with pip installation
A story that was convenient when I tried using the python ip address module
Note that I was addicted to npm script not passing in the verification environment
CodePicnic that can create a [Development | Run | Tutorial | Demo] environment that runs on the browser
A story that an error occurred when PyInstaller was used in a program that uses googleapiclient
A story about trying to introduce Linter in the middle of a Python (Flask) project
You have to be careful about the commands you use every day in the production environment.