Php ini in wamp

WAMP Optimization For Better Performance

Developing on a local environment is the most common way of building web applications, because it’s a lot faster, easier and fun than on a remote server like back in old days. With code versioning like git or mercurial, it makes even more better way of developing websites when you’re in a team of developers or coding only by yourself. In this tutorial I will lay down some tips on wamp optimization for better performance. Some, if not all of the tips, will be suitable for other local environments like XAMPP or MAMP. So let’s get started!

Windows OS Side

This section contains tips which could to be done on Windows operations system layer:

Changing Power Plan

If you did not take into consideration of changing your power plan to high performance, then congratulations, only this move will make your development faster by 50%. I myself sometimes forget that my power plan was set on balanced or power saver when I needed to save some of battery life, and was wondering why the heck my computer is so slow. After checking for windows updates or antivirus updates and looking at task manager to find out what processes drains the performance, I remember that I have to switch my power plan.

Читайте также:  Byte to character in java

Wamp optimization for better performance

Disabling Antivirus

While not the best and secure way when optimizing local environment, disabling antivirus when developing can help. Some antivirus softwares are known to significantly slow down Apache and MySQL, like Avast, Norton, McAfee, Bit Defender.

Edit Windows Hosts File

If you have setted up virtual hosting for your applications, you probably have written the local domain which is pointing to that virtual host in windows hosts file. If you have not written local domains to the windows hosts file yet, follow up to know what I’m talking about:

Press the Windows key and type cmd. Right click on cmd and choose Run as administrator (In order to be able to save changes to the windows system files).

windows cmd

windows hosts file

Here you can see hosts file. Let’s open it with notepad, by typing notepad hosts.

You probably have written those domains line by line. So the trick is to write all domains on one line, like this:

windows-hosts-file

As you see, I also added 127.0.0.1 and localhost in front of my projects domains, which might help to improve lookup.

WAMP Side

Now the real optimization of WAMP development environment begins. I listed tips that helped me the most:

Changing realpath_cache_size

This was the best leap of performance to me. Let’s open php.ini settings file by browsing to wamp/bin/php/php5.*.*(whatever version you have)/ and opening phpForApache.ini file. Or alternatively, clicking on green WAMP icon in your windows bottom tool bar, PHP->php.ini. Find realpath_cache_size line, and change the default value which is 16K to 4M or lower.

Php ini realpath_cache_size modify

Now 4M I noticed is the size that works best for my PC. I saw people saying that this value should not be more than 512K, and I think this is true if your PC has lower than 2GB of RAM or something. You can change and see which size would be best for you, but I recommend not setting higher than 4M.

Disable XDebug

If you are sure that you’re not using XDebug, then it can make your WAMP 2x faster. You can disable it in the same php.ini file, by commenting out XDebug section with adding ; on the beginning of each xdebug line. This is how look like commented XDebug section in my php.ini:

Php ini disable xdebug

Make MySQL Not Use IPv6

IPv6 briefly is the most recent version of the Internet Protocol. Making MySQL not to use IPv6 can make serious speed improvements. To disable it for MySQL, browse to wamp/bin/mysql/mysql*.*.*(whatever version you use)/ and open my.ini. Or again, alternatively you can click on wamp green icon in windows bottom tool bar, and navigate to MySQL->my.ini. Find [wampmysqld] section, and write bind-address = :: on a new line.

My ini bind address

If it did not help, you can try disabling IPv6 entirely. Here is a great blog post on how to do it .

Install And Enable PHP WinCache Extension

This extension is windows-specifically. It provides some great caching layers to the wamp. By default, it is not provided in WAMP installations, so follow these steps to install and enable it:

  1. Head to WinCache download page and download package specifically for you PHP version.
  2. Unpack the package and copy php_wincache.dll file into PHP extensions directory wamp/bin/php/php*.*.*(whatever version you use)/ext/.
  3. Add the following line in the end of php.ini file: extension = php_wincache.dll
  4. Save and close php.ini file.
  5. Restart WAMP.

To see if it is enabled successfully, you can create phpinfo.php file in the root of web directory of WAMP, which is wamp/www/, and write these lines of code:

Head over to http://localhost/phpinfo.php, and search for a section called wincache. If the extension is enabled, then list of configuration settings will be provided by the WinCache.

After all changes are done, don’t forget to restart WAMP if you haven’t, by clicking on WAMP green icon and selecting Restart All Services.

So that’s it, these tips helped me to improve drastically my local development environment performance, and I hope it will help you too. If you have other great tips that helped you and which I did not include here, let me know in the comment sections below!

Источник

Where is PHP.ini in WordPress?

There are many commands in the php.ini file, by changing each command changes happen in WordPress. Therefore we need to know where is PHP.ini in wordpress.

As you probably know WordPress is developed by the powerful programming language of PHP. In this article, we would like to talk about the php.ini file and where is PHP.ini in WordPress?

Therefore, one of the most important files you may come across in the hosting panel is the php.ini file. There are many commands in the php.ini file, by changing each command a lot of things change in WordPress.

First, let us discuss where you can actually find the php.ini file in the server, Linux, XAMPP and etc. Then, we will recommend a few configurations for the php.ini file.

Where is PHP.ini in WordPress?

The first question we answer is where to find the php.ini file?

It doesn’t matter if WordPress is on a live server or a local server. The best way to find the location of this file is to create a PHP file.

It doesn’t matter what name you use for this file. You only need to use the .php extension for it.

Then copy and paste the code below into the created file:

Finally, once the file is saved, open it in the browser. After running the file, you should be able to see the information of php.ini file.

The location of php.ini should be visible in the Configuration file path or in the Loaded Configuration File.

In normal circumstances, the file will be placed in the first location. Otherwise, if the PHP is installed as a module, it will be in the second location.

Creating the .php file may not always work and you have to use other methods to find the location of the php.ini file.

Where is PHP.ini in WAMP?

If you have WordPress installed locally on your computer, you can find the file via the program you are using. Although, the location of php.ini is different in each program. Below, we discuss different programs and where to find the php.ini in each of them.

If you are using the WAMP, then finding the php.ini is an easy task. Simply, right-click on the icon of the program and from the appeared menu click on PHP. In the opened menu you will be able to see the php.ini. This is all you need to do to find the php.ini file in the WAMP server.

Where to Find PHP.ini in XAMPP?

Finding php.ini in the XAMPP server is a bit different. Open the program and click on Config next to the Apache module. From the opened menu click on PHP(php.ini).

Where to Find PHP.ini in Linux?

If you are a Linux user, to find the php.ini file, type the code below in the Linux terminal:

PHP –I | grep “Loaded Configuration File”

The output you receive should be like below:

Loaded Configuration File => /usr/local/lib/php.ini

Normally, the php.ini file is located in the Loaded Configuration File. If you couldn’t find it there, simply change the path to Configuration File.

Where is PHP.ini in cPanel?

As mentioned above, it doesn’t matter if you have WordPress installed locally or on a live server.

In any case, there are multiple ways of finding the php.ini file in WordPress. Follow the steps below if you have WordPress installed on a live server and have access to the cPanel:

  • Login to your hosting panel
  • Open File Manager
  • Php.ini file is located in the Root directory

Don’t forget that the root directory is in the public_html folder. Simply click on it from the left-hand side menu.

There are some recommended configurations for the php.ini that makes the WordPress run better. Other than php.ini configurations there are other options that we will mention down below:

PHP.ini

Copy and paste the following code in the PHP.ini file:

max_execution_time = 60 memory_limit = 128M post_max_size = 8M upload_max_filesize = 8M max_input_time = 60 file_uploads = On safe_mode = Off

.htaccess file

Copy and paste the line below into the .htaccess file. This file can be found in the root directory of your website. Often, it is hidden. Therefore, use an FTP client like FileZilla to show the hidden files.

php_value max_execution_time = 60

wp-config.php file

Copy and paste the line below in the wp-config.php file to eliminate the run-time limit. Or if it is already in the file, change the value to 60.

PHP.ini Configurations You Can Change

There are many commands in the php.ini file. Some of them can be changed. Below are those that we can change. Knowing what each of them does is very important.

Memory_limit

As you can probably tell by its name, memory_limit is the command to limit the memory usage of PHP in WordPress.

The value you define for the memory_limit must be more than the file you are trying to upload. This is the memory needed to upload files and run commands. The recommended value is 128 MB.

Max_execution_time

The time needed to execute every script is defined by this command. In other words, the time the server needs to run the commands.

For example, if you are uploading a fairly big size to the server, it will take more than a few seconds. Therefore, you must remove the execution time or increase it.

Post_max_size

This command defines the maximum data a post can have. To eliminate the limitation change the value to 0. By using the POST method you can call the post from the server.

Upload_max_filesize

This command defines the maximum file you are allowed to upload on WordPress. You have probably seen the limited upload number displayed in the WordPress gallery. This command defines that limitation.

If the memory limit exhaust error occurred, you must eliminate this command or increase it.

Max_input_time

This command defines the seconds required for each data to be analyzed. Data like POST and GET.

The time begins exactly when the command requests PHP from the server and it ends when the command starts. The default value is -1. To eliminate this limitation, set the value to 0.

Источник

Оцените статью