Alias in Virtual Server

12 posts / 0 new
Last post
#1 Mon, 12/20/2010 - 08:52
marciano

Alias in Virtual Server

Hello,

For testing purposes before websites go to production I have some Alias defined in main Virtual Server.

Alias /theSite "/home/theSite/public_html" to get http://mainDomain.com/theSite to open web content /home/theSite/public_html

My old sever does the job alright but doing the same in my new server I get PHP Fatal error: Call to undefined function mysql_connect() in...

Some of my domains are already in production with no mysql connection problems but failed using the Alias http://mainDomain.com/theSite

Thanks for any help

Mon, 12/20/2010 - 10:15
andreychek

Hmm, it sounds like PHP's MySQL module isn't being loaded. You're saying other domains on the same server are using MySQL?

If so, it sounds like something is going on that's preventing your new site from loading MySQL. One possibility is that the extension_path set in the php.ini for that particular domain is wrong. You may want to take a look in the domain's error_log file to get some specifics though -- that's in $HOME/logs/error_log.

Also, you may want to check out Virtualmin's alias feature described in here:

http://www.virtualmin.com/documentation/web/faq

That's a nice and simple way of testing sites before their DNS is live.

-Eric

Mon, 12/20/2010 - 10:45
marciano

You know that first domains I tested in that way went fine. Last one gets into trouble, and testing again previous domains, all of them are in the same trouble. This is a line of the error log [Mon Dec 20 14:23:55 2010] [error] [client 66.249.72.212] PHP Fatal error: Call to undefined function mysql_connect() in /home/theSite/public_html/Connections/conn.php on line 9

conn.php contains the mysql data for database connection

I'll look into your link. Anyway I am worried about this because the same test from my old server, still working, is fine.

Both servers have a clean Virtualmin install. Something has changed during server move that affected mysql connection in that way.

extension_path is not set in /home/../etc/php.ini There is extension_dir = "/usr/lib64/php/modules"

Thank you

Mon, 12/20/2010 - 11:50
andreychek

Yeah, it could be that extension_dir. Try commenting that out and see if that helps.

-Eric

Mon, 12/20/2010 - 12:09
marciano

/etc/php.ini extension_dir = "/usr/lib/php/modules"

/home/.../etc/php.ini extension_dir = "/usr/lib64/php/modules"

Is it correct lib64 vs lib ? mysql.so is located inside lib64 dir.

I commented both but nothing has change I also created a new VS with an alias and put it at top of VSs to see if my Main VS has a setting fault. Same problem.

Mon, 12/20/2010 - 12:08
andreychek

The extension_dir to use depends on your distro and architecture... just take a look at the actual path and see if there's a mysql.so in that dir :-)

It sounds like there's several domains that work on your server -- that means whatever extension_dir setting they're using is the correct one.

-Eric

Mon, 12/20/2010 - 12:11
marciano

just a casuality, I edited the previous post with that info.

So I would change it to lib64. Anyway the problem is still there.

Mon, 12/20/2010 - 12:20
marciano

Using "Preview website" there's no mysql problem... Where are logged eventual apache php errors of previews?

Mon, 12/20/2010 - 14:27
andreychek

If there are any errors, they would all show up in the Apache logs of the Virtual Server that owns the website being viewed... those are in $HOME/logs/error_log.

-Eric

Mon, 12/20/2010 - 19:34
Locutus

Just to make sure: Are the files in /home/thesite owned by the correct user/group and set to the correct permissions?

Actually it's unusual to put files for a domain outside the home directory of that domain (which should be /home/maindomain.com or a variant of that by default). Doing this can cause all kinds of side-effects.

Tue, 12/21/2010 - 08:47
marciano

Yes, you're right. All files are in /home/domain/public_html. Some read-only are in /home/domain

Thu, 10/17/2013 - 15:10
briand

just like to comment on this so it helps

had problems when moving a site across from one server to a new one (using Cloudmin replicate) I was getting an error "Call to undefined function mysql_connect"

extension_dir = "/usr/lib/php/modules" new server is now 64 bit and so PHP needs this set to 'lib64' extension_dir = "/usr/lib64/php/modules"

took me quite some time to solve this problem, but thanks to the above posts I got it :o)

Topic locked