Initial Server Response on a simple "Hello World" PHP file behaving erratically.

If you dont have Litespeed you shouldn't have lsphp set in the php section.
 
OPCache both enabled)
based on
root@***** /]# php -v
PHP 7.4.20 (cli) (built: Jun 17 2021 13:01:33) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

you dont have opcache on.

it should look similar to this
PHP 7.4.20 (cli) (built: Jun 17 2021 16:38:28) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with the ionCube PHP Loader + ionCube24 v10.4.5, Copyright (c) 2002-2020, by ionCube Ltd.
with Zend OPcache v7.4.20, Copyright (c), by Zend Technologies
 
Mysql lets try this.

ok in the /etc/my.cnf
Code:
Code:
nano /etc/my.cnf
Make it look like this. Note: put your server fqdn where it shows "server.domainname.com"
Code:
Code:
[mysqld]
#local values
local-infile=0
#skip-name-resolve=1
#log-error=/usr/local/mysql/data/server.domainname.com.err
bind-address = 127.0.0.1
max_allowed_packet=64MB
#max_connections=25
wait_timeout=100

#innodb values
innodb_log_file_size=512MB #25% of Buffer pool
innodb_file_per_table
innodb_buffer_pool_size=4G # 50% of memory
innodb_buffer_pool_instances=4 #1 per GB


#temp values
tmpdir=/tmp
join_buffer_size=256k
table_definition_cache=1000
thread_cache_size=1000
then restart mariaDB with
Code:
Code:
systemctl restart mariadb
systemctl status mariadb
OR
systemctl restart mysqld
systemctl status mysqld

This has been done now and the results are below:

[root@****** etc]# systemctl restart mysqld
[root@****** etc]# systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/etc/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2021-06-30 17:53:35 SAST; 11s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 3055534 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
Process: 3055512 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 3055536 (mysqld)
CGroup: /system.slice/mysqld.service
└─3055536 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

Jun 30 17:53:30 ******.********.com systemd[1]: Starting MySQL Server...
Jun 30 17:53:35 ******.********.com systemd[1]: Started MySQL Server.
[root@****** etc]#


in options file what is the webserver? Apache or some form of Litespeed?

Here is the info in the options file:

#WEB Server Settings
unit=no
webserver=apache
http_methods=ALL
litespeed_serialno=trial
modsecurity=yes
modsecurity_ruleset=comodo
apache_ver=2.4
apache_mpm=worker
mod_ruid2=no
userdir_access=no
harden_symlinks_patch=yes
use_hostname_for_alias=no
redirect_host=******.*********.com
redirect_host_https=no

#WEB Applications Settings
phpmyadmin=yes
phpmyadmin_public=yes
phpmyadmin_ver=5
squirrelmail=yes
roundcube=yes
webapps_inbox_prefix=no



If you dont have Litespeed you shouldn't have lsphp set in the php section.
I think it is selected there because we run Cloudlinux. This was pointed earlier in the thread here by k1l0b1t which also made me raise my eyebrows because I too thought that the only time it was meant to be used was if we were using LiteSpeed which we are not:
https://forum.directadmin.com/threa...p-file-behaving-erratically.63821/post-331710

based on
root@***** /]# php -v
PHP 7.4.20 (cli) (built: Jun 17 2021 13:01:33) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

you dont have opcache on.

it should look similar to this
PHP 7.4.20 (cli) (built: Jun 17 2021 16:38:28) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with the ionCube PHP Loader + ionCube24 v10.4.5, Copyright (c) 2002-2020, by ionCube Ltd.
with Zend OPcache v7.4.20, Copyright (c), by Zend Technologies
We run CloudLinux so each account runs in its own container. OPCache is enabled in the PHP options on the specific accounts that we have been using for testing or am I missing something? The command is being run by root and that setting is applicable to the current user or is it not? If I run phpinfo() on the account, it shows the Zend OPCache module as enabled. I've PM'd you the link to check the PHP setup on the account.
 
Last edited:
So is this a shared server account or VPS?
Not shared but multiple websites on a VPS owned by a single client. The client has a friend who also uses the server and he is afraid that the friends website might gobble resources from his websites. He also doesn't want his less important sites consuming too much resources for his main site so I recommended CloudLinux.

There was also the added EoL of Centos 7.x and 8.x so he just decided to go with CL.
 
The TTFB has actually dropped by between almost 0.5s So there has been a significant improvement. We are not entirely there yet though. :-D

1625070511682.png


1625070547351.png
 
Well good. leave that config in mysql for now.

Well if we want lsphp on cloudlinux we would have to follow documentation for that. if not we should remove it I think. not a 100% sure i dont use cl


Lets try this for opcache in the account we wan to be fast can you set?

Code:
opcache.memory_consumption=384
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=16000
opcache.revalidate_freq=48

you will need to cycle php and apache

I was assuming it was one big server.
multiple websites on a VPS owned by a single client.
shared.

If its got multiple accounts essentially its shared.

Well depending on how many sites and what the traffic and resource usage is cloudlinux could be more of a burden
 
Well good. leave that config in mysql for now.

Well if we want lsphp on cloudlinux we would have to follow documentation for that. if not we should remove it I think. not a 100% sure i dont use cl


Lets try this for opcache in the account we wan to be fast can you set?

Code:
opcache.memory_consumption=384
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=16000
opcache.revalidate_freq=48

you will need to cycle php and apache

I was assuming it was one big server.

shared.

If its got multiple accounts essentially its shared.

Well depending on how many sites and what the traffic and resource usage is cloudlinux could be more of a burden

I'm just trying to figure out how to apply this. Doesn't seem to be very straight forward on CloudLinux
 
I can show you the global way. If you want to try that.
Please do share because I am so confused right now. It seems that if we are using CloudLinux, then the php1_mode must be set to lsphp. This is set this way to lsphp. In the help tip it saysthe following:

1625077285628.png


This tells me that there must be some form of LiteSpeed integrated in to CloudLinux. I don't know how because the options file shows Apache as the web server.

So if I wanted to change the opcache settings, I can't seem to figure out how.
 
ok run this.

Code:
cd /usr/local/directadmin/custombuild
./build set opcache yes
./build opcache
 
then do this
Code:
cd /usr/local/directadmin/custombuild
mkdir -p custom/opcache
cp -p configure/opcache/opcache.ini custom/opcache/opcache.ini

in the custom opcache.ini file only have
Code:
opcache.memory_consumption=384
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=16000
opcache.revalidate_freq=48

then re run this

Code:
cd /usr/local/directadmin/custombuild
./build opcache
 
funny! I actually did exactly everything you have foretold! this already. I had to first create a custom folder in /usr/local/directadmin/custombuild because the folder didn't exist. then I made an opcache folder and copied the configure/opcache/opcache.ini to custom/opcache/opcache.ini

I then edited that file and made the changes you advised.

Then I ran this:
./build set opcache yes
./build opcache

and this was the output

opCache is now installed for PHP 7.4.
CageFS: Executing 'cagefsctl --force-update'...
Copying /usr/local/php74/lib/php.conf.d/10-directadmin.ini to /usr/share/cagefs-skeleton/usr/local/php74/lib/php.conf.d/10-directadmin.ini
Updating users ...
Updating statuses of users ...

i then restarted httpd and then reloaded the php info page but it still shows the default settings. So I rebooted the entire server just to make 100% sure but still same settings.

This was the output:

1625078817095.png


here is the output of the /usr/share/cagefs-skeleton/usr/local/php74/lib/php.conf.d/10-directadmin.ini file

[root@****** custombuild]# cat /usr/share/cagefs-skeleton/usr/local/php74/lib/php.conf.d/10-directadmin.ini
extension_dir=/usr/local/php74/lib/php/extensions/no-debug-non-zts-20190902
zend_extension=/usr/local/php74/lib/php/extensions/no-debug-non-zts-20190902/opcache.so
opcache.memory_consumption=384
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=16000
opcache.revalidate_freq=48
opcache.enable_cli=1
opcache.validate_permission=1
opcache.use_cwd=1
opcache.revalidate_path=1
opcache.enable_file_override=1
 
what is

Code:
cat /usr/local/php74/lib/php.conf.d/10-directadmin.ini
 
what is

Code:
cat /usr/local/php74/lib/php.conf.d/10-directadmin.ini

Here you go
[root@*******custombuild]# cat /usr/local/php74/lib/php.conf.d/10-directadmin.ini
extension_dir=/usr/local/php74/lib/php/extensions/no-debug-non-zts-20190902
zend_extension=/usr/local/php74/lib/php/extensions/no-debug-non-zts-20190902/opcache.so
opcache.memory_consumption=384
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=16000
opcache.revalidate_freq=48
opcache.enable_cli=1
opcache.validate_permission=1
opcache.use_cwd=1
opcache.revalidate_path=1
opcache.enable_file_override=1
 
Back
Top