SocialEngine installation MySQL blank password error.
Today I'm going to share a useful tip with you I found recently. This is the second blog post I'm writing in this week, and it feels good to be active again with the blog after a long time. Anyway, without further ado let's get into the topic.
During last week I helped installing SocialEngine for one of my clients in his local computer (Maybe he wanted a development version of it). If you don't know what's SocialEngine, it's a social networking script written in PHP. It's not free, but it's quite cheap and it's worth the money you spend if you want to create a good feature rich social network. The installation process is really easy and even a non technical person can handle it with ease as it's straightforward. You just need to provide your database credentials and it installs it automatically. But it's not that true always! You might need to change file permissions for a few directories and files, and during the setup, it asks for your database credentials. So you might need to know a few things about "how the things work" ;)
That's why I had to be in that scenario. My client had installed MySQL in his local computer and as we all know, the default login credentials for a MySQL installation is "root" user and a blank password (unless you change it during installation.).
Now, the problem was SocialEngine did not accept blank passwords for database login details during the installation process. Please see the below image. It gives you an error as shown below. My client was frustrated and looking for a way to fix this. He didn't want to change the MySQL root password just because of this. He had a few other projects using this same login, and I guess he did not want to spend his time changing the login details everywhere. Fair enough!!
I checked the source code for the SocialEngine and found out that, by changing a small line of code you can remove this blank password validation and install it using the default mysql login details. Here's how to do it if you ever face this same problem.
Kindly note this fix is only for a specific version of Social Engine. I'm not certain if this will be the same in future releases, or it is the same in old versions of SocialEngine. I'm writing this specific to the version of SocialEngine script I received from my client. This method should definitely work if you are using the version 4.8.7. If not, please contact me or leave a comment here, I can help you with it.
This installation form validation is located in the "install/forms/DbInfo.php" file. Open that file in any code editor or a text editor you prefer, and go to the line 100 and 101. It will be something similar to this.
097. // init password
098. $this->addElement('Password', 'password', array(
099. 'label' => 'MySQL Password:',
100. 'required' => true,
101. 'allowEmpty' => false,
102. 'validators' => array(
103. array('NotEmpty', true),
104. ),
105. ));
Now if you check the line 100, it's to validate if the password field is filled in. Since we don't have a password, we must be able to submit it with a blank value. Therefore let's change this value from "true" to "false". Then in line 101, you see it asks whether to allow empty values, yes, of course we need to allow empty values because our password is empty. So let's make it "true".
That's it, now this should look like this;
100. 'required' => false,
101. 'allowEmpty' => true,
Now if you provide your mysql login details (with your blank password), it should submit the form without giving you any errors. One thing to note is that I'm not aware of earlier or latest versions of SocialEngine as I was only working with this version of it. So please let me know if this doesn't work for your version so I can update this.
I hope this will be helpful to someone in future and save his/her time. Please let me know what you think about this in a comment below, and please do not forget to share this with your friends in Google+, Facebook and twitter if you think this will be useful to them :)
During last week I helped installing SocialEngine for one of my clients in his local computer (Maybe he wanted a development version of it). If you don't know what's SocialEngine, it's a social networking script written in PHP. It's not free, but it's quite cheap and it's worth the money you spend if you want to create a good feature rich social network. The installation process is really easy and even a non technical person can handle it with ease as it's straightforward. You just need to provide your database credentials and it installs it automatically. But it's not that true always! You might need to change file permissions for a few directories and files, and during the setup, it asks for your database credentials. So you might need to know a few things about "how the things work" ;)
That's why I had to be in that scenario. My client had installed MySQL in his local computer and as we all know, the default login credentials for a MySQL installation is "root" user and a blank password (unless you change it during installation.).
Now, the problem was SocialEngine did not accept blank passwords for database login details during the installation process. Please see the below image. It gives you an error as shown below. My client was frustrated and looking for a way to fix this. He didn't want to change the MySQL root password just because of this. He had a few other projects using this same login, and I guess he did not want to spend his time changing the login details everywhere. Fair enough!!
I checked the source code for the SocialEngine and found out that, by changing a small line of code you can remove this blank password validation and install it using the default mysql login details. Here's how to do it if you ever face this same problem.
Kindly note this fix is only for a specific version of Social Engine. I'm not certain if this will be the same in future releases, or it is the same in old versions of SocialEngine. I'm writing this specific to the version of SocialEngine script I received from my client. This method should definitely work if you are using the version 4.8.7. If not, please contact me or leave a comment here, I can help you with it.
This installation form validation is located in the "install/forms/DbInfo.php" file. Open that file in any code editor or a text editor you prefer, and go to the line 100 and 101. It will be something similar to this.
097. // init password
098. $this->addElement('Password', 'password', array(
099. 'label' => 'MySQL Password:',
100. 'required' => true,
101. 'allowEmpty' => false,
102. 'validators' => array(
103. array('NotEmpty', true),
104. ),
105. ));
Now if you check the line 100, it's to validate if the password field is filled in. Since we don't have a password, we must be able to submit it with a blank value. Therefore let's change this value from "true" to "false". Then in line 101, you see it asks whether to allow empty values, yes, of course we need to allow empty values because our password is empty. So let's make it "true".
That's it, now this should look like this;
100. 'required' => false,
101. 'allowEmpty' => true,
Now if you provide your mysql login details (with your blank password), it should submit the form without giving you any errors. One thing to note is that I'm not aware of earlier or latest versions of SocialEngine as I was only working with this version of it. So please let me know if this doesn't work for your version so I can update this.
I hope this will be helpful to someone in future and save his/her time. Please let me know what you think about this in a comment below, and please do not forget to share this with your friends in Google+, Facebook and twitter if you think this will be useful to them :)
0 comments :
Post a Comment