Steps to change PHP version in right way

Hello,
I am willing to know about the correct way to change the PHP version.
I am using CyberPanel 2.1 on CentOS 64 bit.
My current website’s used PHP version 5.6, in this version my all websites work fine but:

  1. I am not able to take database backup through phpMyAdmin.

  2. I am not able to take database backup through mysqldump .

  3. Finally, I am not able to upgrade my websites.

While:

  1. My websites need to run PHP version 7.2 and 7.4.

  2. When, I am going to change the PHP version then I received an error, which is attached herewith.

Final: Please help to fix this issue.

Thanks

Hello @Emilia Happy you are here

Try and upgrade the panel using this guide here:

sh <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh)

If using a sudo user rather than root, try this:

sudo su - -c "sh <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh)"

1 Like

i think first think to know which version of centos?

Hello @josephgodwinke
Is this problem related with CyberPanel version?
By the way, I am using CentOS 7 64-bit.

Thanks

Hello @josephgodwinke @shoaibkk
I have successfully upgraded CyberPanel from 2.1 to the 2.3 as per the command provided by @usmannasir .

Now:
How can I change my PHP version in the right way?

Thanks

Not really am using a nullification method to solve your problem.

  1. First upgrade your installation

  2. Enable detailed dynamic logging for debugging and post contents of /home/cyberpanel/error-logs.txt

  3. Post contents of this command ls /usr/local/lsws|grep lsphp OR find / -name lsphp | grep /usr/local/lsws to see the php versions you have installed

  4. To change php version per website:

Go to specific website https://SERVER_URL:8090/websites/emilia.com and click on Change PHP under configurations select available php versions

If you have missing php modules here https://SERVER_URL:8090/managephp/installExtensions Follow this guide [TUTORIAL] How to install any PHP modules using PEAR Package Manager

1 Like

Hello @josephgodwinke
Is it mandatory to Restart “PHP and OpenLiteSpeed” after changing the PHP version?

Thanks

I always recommend you reboot your server after an upgrade to see everything works.

From this disable open_basedir Protection for that website.

Go to specific website https://SERVER_URL:8090/websites/emilia.com and click on open_basedir under files select disable select option under open_basedir Protection

Hello @josephgodwinke ,
Thanks for great help.

  1. Now I am able to change my PHP version as well as take database backup through phpMyAdmin.

  2. When I was visited to “CyberPanel Log Files”, there’s no one error message.

BUT:
I am currently not able to take database backup through mysqldump. When I am going to take database backup then an error message comes:
" Bash : … event not found"

Is there any way to fix this issue?

Thanks

Kindly mark the solution for the issue in the title to help the community. As for you -bash: !": event not found issue turn off history substitution using set +H

mysqldump -u admin_user -p mywebsiteDB > backup.sql

To dump multiple databases:

mysqldump -u root -p --databases db_name1 db_name2 | gzip > full_backup.sql.gz

Hello @josephgodwinke
I have used this command:

mysqldump -u dbusername -pdbpassword dbname > filename.sql

Here’s:
Space between: -u dbusername
Without Space : -pdbpassword

Error Show:
-bash: part_of_my_dbpassword: event not found

Can I make any mistake?
Please clarify.

Thanks

mysqldump console utility exports databases to SQL text files

mysqldump -u username -p database_name > data-dump.sql
  • username is the username you can log in to the database with
  • database_name is the name of the database to export
  • data-dump.sql is the file in the current directory that stores the output.

You will asked for password -p. Use the correct password for said database

Hello @josephgodwinke
I have used correct credentials but unfortunately I got this error message.

Can I change the database password to fix this issue?

If Yes, then how can I do?

Thanks for great help.

To change database user password go to https://SERVER_URL:8090/dataBases/listDBs choose domain for respective databse, click on Change under Password on respective database

1 Like

Thanks @josephgodwinke
Great help :blush:

No problem. Welcome back to the community.

This topic was automatically closed 3 hours after the last reply. New replies are no longer allowed.