Nulled Dreams Rent – Car Rental Booking Management WordPress Theme

Debug PHP availability loops with GDB

1. The Server State

I logged into the server at 10:00 AM. The server was slow. I checked the load. I typed uptime. The load was 12.5. This server has 4 CPU cores. A load of 12.5 is high for 4 cores. It means many tasks are waiting. I needed to see what was happening. I typed top. I looked at the first line. The CPU usage was high. The %us value was 95 percent. This means user programs were using the CPU. The %sy value was 2 percent. The %id value was 1 percent. The CPU had no free time. I looked at the process list. I saw many PHP-FPM processes. One process was using 98 percent of one core. This process stayed at the top of the list. It did not go away. I noted the process ID. The ID was 5402. This was a car rental site. It uses the Dreams Rent – Car Rental Booking Management WordPress Theme. The site handles car bookings. It checks if cars are free. It calculates prices. This theme has many complex parts.

I looked at the memory. I typed free -m. The total memory was 8 gigabytes. The used memory was 2 gigabytes. The free memory was 6 gigabytes. Memory was not the problem. The problem was the CPU. Something in the PHP code was looping. It was running over and over. It did not stop. I needed to find out what the process was doing. I looked at the web server logs. I typed tail -f /var/log/nginx/access.log. I saw many requests to /wp-admin/admin-ajax.php. These requests were for a booking check. This theme uses AJAX to check car dates. I saw one request that never finished. It stayed open for a long time. This request matched the busy PHP process.

I checked the PHP-FPM slow log. I typed cat /var/log/php-fpm/www-slow.log. The log showed a function name. The function was check_car_availability. This function is part of the booking system. Many people go to Download WordPress Themes and get this theme. It is a good theme. But the code can be heavy. The function was taking 30 seconds. It should take 0.1 seconds. This was the source of the high load. I had a target. I needed to see the code inside this function. But first, I wanted to see the process state.

2. Using GDB to Attach to the Process

I wanted to see the exact C calls in the PHP engine. I used gdb. This is a powerful tool. I typed gdb -p 5402. The debugger attached to the process. It stopped the process. I typed bt. This shows the backtrace. The backtrace is a list of functions. I saw many functions from the PHP core. I saw execute_ex. I saw ZEND_DO_ICALL_SPEC_HANDLER. These are standard. Then I looked at the arguments. I used a PHP helper script for gdb. I typed zbacktrace. This shows the PHP functions.

The output showed a loop. The script was in booking-functions.php. It was on line 450. The function was get_available_slots. Inside this function, there was a foreach loop. The loop was going through a list of dates. I looked at the dates. I typed print_zval. The list had 10,000 dates. This was wrong. A car booking usually covers a few days. 10,000 days is 27 years. No one rents a car for 27 years. The code was trying to check every single day. It was checking if the car was free for 27 years. This is why the CPU was at 100 percent. The code was doing too much work.

I detached gdb. I typed quit. I typed y to confirm. The process started running again. It was still at 100 percent. I needed to kill it. I typed kill -9 5402. The load dropped a little. But a new process started. It also went to 100 percent. Another user was trying to book a car. The bug was in the logic. I needed to fix the file. I went to the theme folder. I typed cd wp-content/themes/dreams-rent/. I went to the inc folder. I found booking-functions.php. I opened the file with nano.

3. Investigating the Logic Error

I scrolled to line 450. I found the loop. The code looked at the start date. It looked at the end date. Then it made a list of all days in between. The code used a function called date_diff. It calculated the number of days. If the input was bad, the number of days was huge. I looked at the input validation. There was no validation. The code took the date from the user. It did not check the range. A user could type "2023-01-01" as the start. They could type "2050-01-01" as the end. The code would try to process every day.

I checked the form on the site. I opened my browser. I went to the booking page. I saw the date picker. The date picker was good. It only allowed two weeks. But a bot does not use the date picker. A bot sends a raw request. A bot can send any date. This was a classic input error. The server was trusting the client. You should never trust the client. I needed to add a limit. I decided to limit the booking to 30 days. Most car rentals are short. 30 days is a safe maximum.

I wrote a new line of code. I typed $diff = $start->diff($end);. Then I added a check. I typed if ($diff->days > 30) { return false; }. This would stop the loop before it started. I saved the file. I typed Ctrl+O. I pressed Enter. I typed Ctrl+X. Now I needed to test the fix. I sent a bad request to the server. I used curl. I sent a start date of 2023 and an end date of 2060. The server answered fast. It returned an error message. It did not hang. I checked top. The CPU load was 0.5. The fix worked for the input part.

4. Deep Dive into Database Latency

But I saw another issue. When a real user made a booking, it was still a bit slow. It took 2 seconds. 2 seconds is okay, but not great. I wanted it to be faster. I checked the database. I used mysqladmin processlist. I saw a query. The query was SELECT * FROM wp_car_bookings WHERE car_id = 5. This query was looking for all bookings for car 5. I looked at the table structure. I typed mysql -u root -p. I entered my password. I typed use wordpress_db;. I typed describe wp_car_bookings;.

The table had many columns. It had id. It had car_id. It had start_date. It had end_date. I looked at the indexes. I typed show index from wp_car_bookings;. I saw an index on id. But there was no index on car_id. This was the problem. The database had to read every row to find car 5. If the table has 50,000 bookings, the database reads 50,000 rows. This takes time. This is called a full table scan. It is slow. It uses disk I/O. It uses CPU.

I needed to add an index. I typed ALTER TABLE wp_car_bookings ADD INDEX (car_id);. The command finished in 0.5 seconds. I checked the speed again. I made a new booking. The query took 0.01 seconds. The total page load was now 0.5 seconds. This was a big improvement. I checked the load average. It was 0.2. The server was quiet. The fans were not loud. I looked at the disk usage. I typed iostat -x 1 5. The %util was 0.1 percent. The disk was idle.

5. Analyzing PHP-FPM Performance

I wanted to make sure PHP-FPM was tuned correctly. I opened the config file. I typed nano /etc/php-fpm.d/www.conf. I looked for the pm setting. It was set to dynamic. This is the default. I looked at pm.max_children. It was set to 50. I looked at pm.start_servers. It was set to 5. I looked at pm.min_spare_servers. It was set to 5. I looked at pm.max_spare_servers. It was set to 35. This was okay for 8 gigabytes of RAM. Each PHP process uses about 50 megabytes. 50 processes use 2.5 gigabytes. There is plenty of room.

But I saw a setting called pm.max_requests. It was set to 0. This means a process lives forever. This can be bad. PHP processes can leak memory over time. It is better to restart them. I changed the value to 500. After 500 requests, the process will die. A new process will start. This keeps the memory fresh. I also looked at request_terminate_timeout. It was set to 0. I changed it to 30. If a script takes more than 30 seconds, the server will kill it. This stops one bad script from hanging the whole system.

I saved the file. I restarted PHP-FPM. I typed systemctl restart php-fpm. I checked the status. It was running. I looked at the logs. There were no errors. I felt good about the changes. The server was now safer. It was faster. It was more stable.

6. Inspecting the Dreams Rent Code Further

I went back to the code of the Dreams Rent – Car Rental Booking Management WordPress Theme. I wanted to see how it calculates the price. I found a file called price-calculator.php. I opened it. The code was complex. It checked for discounts. It checked for insurance. It checked for taxes. It used many database calls. I saw a loop inside another loop. This is called a nested loop. Nested loops can be very slow.

If you have 10 cars and 10 types of insurance, the code runs 100 times. This is fine. But if you have 100 cars and 100 types of insurance, it runs 10,000 times. I saw that the code was getting all insurance types from the database inside the car loop. This is a common mistake. You should get all insurance types once. Then you should use the list. You should not ask the database 100 times for the same data. This is called the "N+1 problem".

I fixed the code. I moved the database call outside the loop. I put the data in an array. Then I used the array inside the loop. This reduced the number of database calls from 100 to 1. I tested the price page. It loaded instantly. I checked the Download WordPress Themes site to see if there was an update. There was no update for this issue. So I wrote down my changes. I will need them if the client updates the theme later.

7. Monitoring Network Traffic

I wanted to check the network. I used nload. This shows the incoming and outgoing traffic. The traffic was 200 kilobits per second. This is low. The server is not a bottleneck for the network. I checked the open ports. I typed ss -tunlp. I saw port 80 for HTTP. I saw port 443 for HTTPS. I saw port 22 for SSH. I saw port 3306 for MySQL. MySQL was listening on 127.0.0.1. This is good. It means no one can connect to the database from the outside.

I looked at the TCP connections. I typed netstat -an | grep :80 | wc -l. There were 40 connections. Most were in the TIME_WAIT state. This means the connection is closing. This is normal for a web server. I checked the sysctl settings for the network. I typed cat /proc/sys/net/ipv4/tcp_fin_timeout. It was 60. I changed it to 30. This makes the server close old connections faster. It frees up resources.

I typed nano /etc/sysctl.conf. I added net.ipv4.tcp_fin_timeout = 30. I also added net.core.somaxconn = 1024. This allows more connections to wait in the queue. I applied the changes. I typed sysctl -p. The server network stack was now tuned.

8. Checking the File System

I checked the disk space again. I typed df -h. The root partition was 40 percent full. The /var/log folder was using 1 gigabyte. I looked at the logs. There were many old logs. I typed ls -lh /var/log/nginx/. I saw files from last year. These files were big. They were not compressed. I checked the logrotate config. I typed cat /etc/logrotate.d/nginx.

The config said to keep 14 days of logs. But it was not working. I found a mistake in the path. I fixed the path. I ran logrotate manually. I typed logrotate -f /etc/logrotate.conf. The old logs were deleted. The current logs were compressed. The disk usage dropped by 800 megabytes. I checked the inode usage. I typed df -i. It was 10 percent. This was fine. Inodes are for the number of files. If you have many small files, you can run out of inodes even if you have space.

9. Tuning MySQL Further

I went back to MySQL. I wanted to see the buffer pool. I typed mysql -e "show variables like 'innodb_buffer_pool_size';". The value was 128 megabytes. This is the default. It is very small. This server has 8 gigabytes of RAM. I should give more to MySQL. I decided to set it to 4 gigabytes. This allows MySQL to keep the whole database in RAM. RAM is much faster than the disk.

I opened the MySQL config. I typed nano /etc/my.cnf. I found the [mysqld] section. I added innodb_buffer_pool_size = 4G. I also added innodb_log_file_size = 512M. This helps with write performance. I saved the file. I restarted MySQL. I typed systemctl restart mysqld. It took a few seconds. Then it was back. I checked the memory usage. I typed free -m. 6 gigabytes were used now. 2 gigabytes were free. This is a good balance.

I checked the MySQL hit rate. I typed mysqladmin extended-status | grep -i pool_read. The result showed that 99 percent of reads were from the buffer pool. This means MySQL rarely touches the disk. This makes the car rental booking search very fast. Users like fast sites.

10. Evaluating the PHP OpCache

I checked the PHP OpCache. OpCache stores compiled PHP code in RAM. This stops PHP from reading and parsing files on every request. I typed php -i | grep opcache. I saw that it was enabled. The memory size was 128 megabytes. I looked at the hit rate. It was 98 percent. This was good. But I saw that opcache.validate_timestamps was set to 1.

This means PHP checks the file on the disk every time. It checks if the file has changed. This uses disk I/O. On a live server, the files do not change often. I changed the value to 0. Now PHP will not check the file. It will use the version in RAM. If I change the code, I will need to restart PHP-FPM. This is a small price for more speed. I changed it in /etc/php.ini. I restarted PHP-FPM.

11. Testing the Booking Flow

I went back to the site. I acted like a customer. I searched for a car. I picked a date. I added insurance. I went to the checkout page. Every page loaded in under 300 milliseconds. This is very fast. I looked at top during my test. The PHP process used 5 percent of the CPU. The load average stayed at 0.1. The server was not struggling.

I looked at the Dreams Rent – Car Rental Booking Management WordPress Theme settings in the WordPress admin. I saw a setting for "Google Maps". It was enabled. But the client did not have an API key. This caused a slow down in the browser. The browser tried to load the map and failed. I told the client to get a key or turn it off. He turned it off. The page became even smoother.

12. Security Audit

I checked the file permissions. I typed find . -type d -not -perm 755. I found some folders with 777 permissions. This is very bad. 777 means anyone can write to the folder. A hacker can upload a script and run it. I changed the permissions. I typed find . -type d -exec chmod 755 {} \;. I did the same for files. I typed find . -type f -exec chmod 644 {} \;.

I checked the wp-config.php file. It was 644. I changed it to 600. Now only the owner can read it. This protects the database password. I looked for strange files in the uploads folder. I typed find uploads -name "*.php". I found one file called mailer.php. This was not a part of WordPress. It was a backdoor. A hacker had uploaded it earlier. I deleted it. I typed rm uploads/mailer.php.

I checked the user list in WordPress. I saw a user called backup_admin. I asked the client. He did not know this user. I deleted the user. I changed all the passwords for the other admins. I installed a security plugin to monitor file changes.

13. Looking at the Linux Kernel Stack

I wanted to see the kernel behavior. I used vmstat 1 10. This shows system stats every second. I looked at the cs column. cs is context switches. It was 500. This is a low number. It means the CPU is not wasting time switching between tasks. I looked at the in column. in is interrupts. It was 1000. This is also normal.

I looked at the bi and bo columns. These are blocks in and out. They were both 0. This confirms that the disk is quiet. The MySQL buffer pool is doing its job. I looked at the wa column. It was 0. The CPU is never waiting for the disk. This is the goal for a fast server. I checked the dmesg output. There were no hardware errors. There were no "out of memory" messages.

14. Checking the Mail System

The car rental site sends emails for bookings. I checked the mail queue. I typed mailq. It was empty. I checked the mail log. I typed tail -n 100 /var/log/maillog. I saw the last booking email. It was sent to Gmail. It was accepted. The delay was 2 seconds. This is good.

I noticed that the server was using PHP mail(). This is not the best way. It can get marked as spam. I advised the client to use an SMTP service. He agreed. I set up a plugin for SMTP. Now the emails are more reliable. They have a higher chance of reaching the customer.

15. Analyzing the CSS and JavaScript

I looked at the browser console. I saw many CSS files. I saw many JavaScript files. Each file is a separate request. This slows down the mobile users. I looked at the Dreams Rent – Car Rental Booking Management WordPress Theme assets. There were 20 scripts.

I installed an optimization plugin. It merged the scripts into one file. It merged the CSS into one file. It also minified them. This means it removed the extra spaces. The total page size dropped from 2 megabytes to 1 megabyte. The number of requests dropped from 50 to 15. The site felt much faster on my phone.

16. The Importance of Caching

I checked the page cache. WordPress has to run many PHP scripts to show a page. A page cache saves the HTML. For the next user, the server just sends the HTML. It does not run the PHP. I installed a cache plugin. I configured it. I tested it. I looked at the response headers. I saw X-Cache: HIT.

The response time was now 50 milliseconds. This is like a static site. The database is only used for the booking search and the final checkout. The home page, the car list, and the contact page are all served from the cache. This saves a lot of CPU power. The server can now handle many more users.

17. Looking at the Log Rotation Again

I wanted to make sure the cache files were not filling up the disk. The cache plugin saves files in wp-content/cache. I checked the size. It was 50 megabytes. This is fine. I added a cron job to clear the cache once a week. This keeps the files fresh. I typed crontab -e. I added 0 0 * * 0 rm -rf /var/www/html/wp-content/cache/*.

I also checked the error logs. I typed tail -f /var/www/html/wp-content/debug.log. I saw a few notices. These were not errors. They were just warnings about old code. I turned off the debug log in wp-config.php. It is better not to write these to the disk on a live site.

18. Tuning the Nginx Gzip Compression

I checked the Gzip settings in Nginx. Gzip compresses the files before sending them. This saves bandwidth. I opened the config. I typed nano /etc/nginx/nginx.conf. I saw that gzip was on. But the gzip_types list was short. It only had text/html.

I added text/css, application/javascript, application/json, and image/svg+xml. I also set gzip_comp_level to 5. Level 9 is too slow. Level 1 is too weak. Level 5 is a good balance. I saved the file. I tested the config. I typed nginx -t. It was okay. I reloaded Nginx. I typed systemctl reload nginx.

19. Investigating the Apache Benchmark

I wanted to stress test the server. I used ab. This is the Apache Benchmark tool. I typed ab -n 1000 -c 10 https://dreams-rent-site.com/. This sends 1000 requests, 10 at a time. I watched the server during the test. The load went up to 1.5. This is very good.

The test finished in 10 seconds. It handled 100 requests per second. For a small car rental site, this is plenty of power. The client will never have 100 users per second. The server was stable. There were no failed requests. The 99th percentile response time was 150 milliseconds.

20. Checking the PHP Error Reporting

I looked at the PHP settings for errors. On a live site, you should not show errors to the user. A hacker can use the error messages to learn about the server. I typed grep display_errors /etc/php.ini. It was set to Off. This was correct.

I checked log_errors. It was On. This was also correct. The errors go to the log, not the screen. I looked at error_reporting. It was set to E_ALL & ~E_DEPRECATED. This is a good setting. It logs important things but skips the noise.

21. Reviewing the SSH Security

I checked the SSH config. I typed cat /etc/ssh/sshd_config. I saw PermitRootLogin yes. I changed it to no. It is better to log in as a normal user and use sudo. I also saw that password authentication was on. I advised the client to use SSH keys.

I changed the SSH port from 22 to 2222. This stops many automated bots. They usually scan port 22. I restarted SSH. I typed systemctl restart sshd. I made sure the firewall was open on the new port. I used firewall-cmd --add-port=2222/tcp --permanent. I reloaded the firewall.

22. Inspecting the MySQL Query Cache

I looked at the MySQL query cache. I typed mysql -e "show variables like 'query_cache_type';". It was OFF. MySQL 8 does not have a query cache. It was removed because it caused locks on big servers. My innodb_buffer_pool_size is doing the same job but better.

I checked the table cache. I typed mysql -e "show variables like 'table_open_cache';". It was 4000. I checked the number of open tables. It was 500. This is good. MySQL has all the theme tables open. It does not have to open and close them.

23. Analyzing the System Entropy

I checked the entropy pool. Entropy is used for random numbers. It is important for SSL. If the pool is empty, the server slows down. I typed cat /proc/sys/kernel/random/entropy_avail. The value was 3500. This is high.

Some servers use haveged to increase entropy. But this server has a modern kernel. It handles entropy well. I tested an SSL handshake. It took 50 milliseconds. This is fast. The users will not see a lag when they go to the HTTPS site.

24. Final Check of the Dreams Rent Theme Files

I went through the Download WordPress Themes category one more time. I looked at the documentation for Dreams Rent. It mentioned a feature for "Exporting Bookings". I checked the code for the export. It used a lot of RAM.

It was getting all bookings and putting them into one CSV file. If there are 100,000 bookings, the PHP process will crash. I limited the export to the last 12 months. This makes the file smaller. It makes the process safer. I also added a progress bar to the admin side so the user knows it is working.

25. Looking at the PHP-FPM Slow Log Again

I checked the slow log one last time. It was empty. The server has been running for two hours since my fixes. No script has taken more than 5 seconds. The site is fast. The CPU is quiet. The client is happy.

I deleted my temporary test files. I typed rm test-booking.php. I cleared the history of the commands. I typed history -c. I logged out of the server.

26. Analyzing the System Load Average Over Time

I want to see how the load changes during the day. I checked the sar reports. I typed sar -q. This shows the load queue. I saw the peak at 10:00 AM. Since then, the load has been flat at 0.1. I looked at the CPU usage history. I typed sar -u. The idle time was 99 percent.

This confirms that my fixes were not just temporary. They solved the core issue. The nested loops are gone. The missing indexes are added. The input validation is in place. The server is ready for the long term.

27. Understanding the Wait States

I looked at the vmstat output again. I saw that the wa (I/O wait) was always 0. This is the most important number. If wa is high, the server is slow even if the CPU is 0. It means the CPU is waiting for the slow disk. Because I moved the database and the code to the RAM, the disk is not used.

The st column was also 0. st is steal time. This is the time the physical host takes from the virtual server. If st is high, the problem is with the data center, not the server. 0 means the host is healthy.

28. Checking the Inode Table

I checked the inodes one more time. I typed ls -i. Every file has an inode. I looked at the count in the uploads folder. There were 20,000 files. This is okay. The Dreams Rent – Car Rental Booking Management WordPress Theme creates many thumbnails for every car photo.

I advised the client to use a plugin to remove unused images. This keeps the folder clean. It makes the backups smaller. He said he would do it next week.

29. Evaluating the Swap Memory

I checked the swap usage. I typed free -m. The swap used was 0. This is good. If the server starts using swap, it becomes 100 times slower. I set the swappiness to 10. This tells the kernel to use RAM as much as possible. I typed sysctl vm.swappiness=10. I added it to /etc/sysctl.conf.

Now the server will stay in the fast RAM. It will only use the disk if the RAM is completely full. With 8 gigabytes of RAM and my current tuning, this will not happen.

30. Looking at the PHP-FPM Process Manager

I checked the pm.max_children again. I decided to increase it to 100. The server has enough RAM. If there is a sudden spike in bookings, 100 workers can handle it. I updated the config. I restarted PHP-FPM. I watched the process list. I saw 5 workers start. The others will start if needed.

I checked the pm.process_idle_timeout. It was 10 seconds. This means idle workers will die after 10 seconds. This is fine. It frees up the memory when the site is quiet at night.

31. Reviewing the MySQL Binary Log

I checked the binary log. Binary logs are used for replication and backups. But they can grow very large. I typed ls -lh /var/lib/mysql/mysql-bin.*. I saw 2 gigabytes of logs. I checked the expiration. I typed mysql -e "show variables like 'binlog_expire_logs_seconds';".

It was set to 30 days. I changed it to 7 days. This is enough for most backups. I typed SET GLOBAL binlog_expire_logs_seconds = 604800;. This will save 1.5 gigabytes of disk space. I updated the config file to make it permanent.

32. Analyzing the Network Interface Errors

I checked the network card. I typed ifconfig eth0. I looked at the errors and dropped counts. They were both 0. This means the connection to the internet is clean. There is no packet loss.

If there were errors, it could cause the AJAX booking search to fail. The browser would wait for a packet that never arrives. This server is in a good data center. The hardware is solid.

33. Evaluating the PHP Realpath Cache

I checked the realpath_cache_size. PHP uses this to store the locations of files. If it is too small, PHP has to search the disk. I typed php -i | grep realpath. It was 4 megabytes.

I increased it to 16 megabytes. WordPress has many files in many folders. A larger cache helps PHP find the files faster. I also set the realpath_cache_ttl to 600 seconds. I updated the PHP config.

34. Final Check of the SSL Certificate

I checked the SSL certificate expiration. I used openssl. I typed echo | openssl s_client -connect dreams-rent-site.com:443 2>/dev/null | openssl x509 -noout -dates. The certificate was valid for 90 days.

It was a Let's Encrypt certificate. The auto-renewal was active. I checked the cron job. It was in /etc/cron.d/certbot. Everything was in order. The users will not see a security warning.

35. Looking at the Log File Format

I checked the Nginx log format. It was the standard format. I decided to add the request time to the logs. This helps me find slow pages in the future. I edited the nginx.conf. I added $request_time to the log_format line.

Now every line in the access log shows how long the request took. I can use awk to find the slowest pages easily. For example, I can type awk '$NF > 1.0' access.log to see all pages that took more than 1 second.

36. Examining the MySQL Inode Cache

I checked the MySQL open file limit again. I typed mysql -e "show variables like 'open_files_limit';". It was 10,000. This is more than enough for the 500 tables. Each table uses two files. So MySQL is using 1000 file descriptors.

The system limit is 65,000. I checked it with cat /proc/sys/fs/file-max. We are safe. The database will not crash because of file limits.

37. Reviewing the System Time Sync

I checked the system time. I typed timedatectl. The NTP service was active. The time was correct. This is important for logs and for booking dates. If the server time is wrong, a user might see a booking from the past.

I checked the time zone. It was UTC. This is the best choice for a server. It avoids confusion with daylight saving time.

38. Analyzing the PHP Garbage Collector

I checked the PHP garbage collector. I typed php -r "var_dump(gc_status());". It was active. It had collected 1000 items. This means it is cleaning up memory cycles.

This helps keep the PHP workers light. I did not need to change anything here. PHP 8.1 has a good garbage collector.

39. Final Verification of the Caching Headers

I checked the caching headers for static files. I typed curl -I https://dreams-rent-site.com/wp-content/themes/dreams-rent/style.css. I saw Cache-Control: max-age=31536000.

This means the browser will keep the CSS file for one year. It will not ask the server again. This saves bandwidth. It makes the site load instantly for returning users.

40. Inspecting the MySQL Temp Table Settings

I checked where MySQL creates temporary tables. I typed mysql -e "show variables like 'tmp_table_size';". It was 16 megabytes. I increased it to 64 megabytes. This allows MySQL to do more work in the RAM.

If a query needs a large temp table, it will now stay in the RAM. If it goes above 64 megabytes, it will go to the disk. 64 megabytes is enough for all the car rental booking queries.

41. Looking at the PHP-FPM Slow Log Path

I checked the permission of the slow log file. I typed ls -l /var/log/php-fpm/www-slow.log. It was owned by root. The group was www-data. The permission was 660.

This is good. The PHP-FPM process can write to it. I can read it. It is not open to the world.

42. Analyzing the Kernel Interrupt Moderation

I checked the network card interrupt settings. I typed ethtool -c eth0. The moderation was on. This is good for high-speed traffic. It reduces the number of times the network card wakes up the CPU.

It makes the system more efficient under heavy load. I decided not to change it. The default values were fine.

43. Checking the System Hostname

I checked the hostname. I typed hostname. It was car-rental-server. I checked the /etc/hosts file. It had the correct local entries. This avoids delays when the server tries to look up itself.

I also checked the DNS settings. I typed cat /etc/resolv.conf. It was using Google DNS. This is fast and reliable.

44. Evaluating the PHP Open Basedir

I checked the open_basedir setting. It was not set. This means PHP can access any file on the system. For a single site server, this is okay. But for security, it is better to limit it.

I set it to /var/www/html:/tmp. Now PHP can only read files in the web folder and the temp folder. This stops a hacker from reading the /etc/passwd file if they find a bug in the code. I added this to the PHP-FPM pool config.

45. Final Review of the Nginx Buffers

I checked the Nginx buffers again. I typed cat /etc/nginx/conf.d/buffers.conf.

client_body_buffer_size 128k;
client_max_body_size 10m;
client_header_buffer_size 1k;
large_client_header_buffers 4 4k;

These are safe values. They handle large booking forms and file uploads. I did not need to change them.

46. Analyzing the MySQL Binary Log Formats

I checked the binlog format. I typed mysql -e "show variables like 'binlog_format';". It was ROW. This is the most secure format for replication. It logs the actual changes in the rows.

I kept it as ROW. It is a bit slower than STATEMENT, but it is much safer for complex databases like the car rental one.

47. Checking the System Umask

I checked the system umask. I typed umask. It was 0022. This means new files are created with 644 permissions. New folders are created with 755. This is the standard.

I did not change it. It is safe for a web server.

48. Evaluating the Nginx Keepalive Requests

I checked keepalive_requests. It was 100. I increased it to 1000. This allows a browser to download 1000 files over one connection. It is better for modern sites with many small images.

I restarted Nginx.

49. Final Check of the Theme Functions File

I opened functions.php for the last time. I looked for any old error_log() calls I left behind. I found none. I checked the Dreams Rent – Car Rental Booking Management WordPress Theme version. It was the latest version.

I am confident in the fix. The site is now faster than ever. The server is secure. The logs are clean.

50. Closing the Technical Note

The server is now running perfectly. The car rental booking engine is optimized. The database is indexed. The network is tuned. The total CPU usage is minimal. The site administrator can now sleep well.

I have recorded all steps. I will monitor the site for one more day. If everything stays green, I will close the ticket. The task is complete. (End of report.)

评论 0