Support

Admin Tools

#9796 can ATpro htaccess prevent mysql access?

Posted in ‘Admin Tools for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
n/a
PHP version
n/a
Admin Tools version
n/a

Latest post by nicholas on Monday, 21 March 2011 18:33 CDT

user30134
Hello
I have moved on to the final stage of getting a new domain ready to go live and have com across an odd issue and thought I would ask if anyone has had a similar issue and so I can exclude ATpro.

I have installed joomla site, AT pro & juga, all seems to be good to go. However when I try to load a php script that calls to mysql I get a denied access. I created a simple connect php file to test and it gave a 403 error. I then tested the connect file on another domain (same mysql server) and no problem tests out fine. Obviously the joomla site can access mysql, however when any script tries to utilize the database I get a denied no access allowed - even when it is referring to the joomla config file for credentials.

So, something on the test domain is stopping the connect from access mysql and I am trying to exclude any influence from ATpro and the generated htaccess file.

Any input would be appreciated.
Thanks
John

nicholas
Akeeba Staff
Manager
The sort answer is no, .htaccess can not block MySQL access.

The reason is very simple. .htaccess is being read by Apache (the web server), not PHP. It controls if a request from a web visitor is accepted by the web server or not. If it is accepted and references a PHP file, Apache hands it over to the PHP executable. Subsequently, the code runs and when it hits the database connection part, PHP tries to contact MySQL in order to connect. So, .htaccess plays no role in your issue.

That said, there is a very strong possibility that you have the wrong hostname. Using "localhost" as your database hostname instructs PHP to contact your MySQL server over shared memory or named pipes. If this is not enabled on the MySQL server, the connection will fail. Using "127.0.0.1" as the database host name forces PHP to use TCP/IP networking to contact the MySQL server. Try that first. If that fails, check with your host that the database hostname, the database name, username and password are correct. It's possible that, after a system upgrade on your host's end, some or all of this information changed and you need to accommodate for those changes.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

user30134
Thanks Nicholas

I thought best to check first.
I have checked the credentials and all seem correct, re-entered etc.
It has to be a domain issue.

Thanks for your help
Regards
John

nicholas
Akeeba Staff
Manager
You're welcome!

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

user30134
Hello Nicholas
the .htaccess can refuse access to php files and this is why I have been getting the 403 error.

When I added my test connect php file to the exceptions in the htaccess it worked fine.

Now I need to add the real php files to the exceptions to see if they will run.
John

The file in the main directory was fine, the php files in the admin folders still will not run - it has to be a permissions issue related to the htaccess or http file.

nicholas
Akeeba Staff
Manager
Yes, if you're trying to directly access stray PHP files (not through Joomla!'s index.php) they are blocked. It's part of the front-end protection. I was tricked into replying to the header title, if .htaccess can prevent PHP from connecting to MySQL rather than the question which was implied in the post body, if bespoke PHP files are being blocked. Sorry, I missed that part in my reply :(

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!