Jump to content

The most basic php question..

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
13 replies to this topic

#1
phpforfun

phpforfun

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,236 posts
ok so I am on a new OS. I am on ubuntu 7.10. I have installed php5, mysql and apache.. I am trying to run all the old scripts I have, and for some reason, I get this error on the index..

Fatal error: Call to undefined function mysql_connect() in /var/www/index.php on line 8

for every single script and tutorial I find, its always mysql_connect()

is there another command to connect to the database?????

#2
phpforfun

phpforfun

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,236 posts
really? 24 views, no comments?

#3
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts

phpforfun said:

really? 24 views, no comments?

I initially ignored this as I figured you might search the forum and find the tutorial I wrote for setting up a LAMP server specifically on Ubuntu 7.1...
http://forum.codecal...ver-ubuntu.html

#4
Guest_Jordan_*

Guest_Jordan_*
  • Guests
It sounds like you have MySQL/Apache/PHP Setup or you wouldn't get a PHP error but it also sounds like you didn't compile MySQL into PHP (which I thought was built in now).

In your php.ini file (usually /etc/php.ini but I don't know about Ubuntu) make sure that this line:

extension=mysql.so

is not commented (comments use a # sign).

Restart Apache and see if you get the error.

#5
phpforfun

phpforfun

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,236 posts

John said:

I initially ignored this as I figured you might search the forum and find the tutorial I wrote for setting up a LAMP server specifically on Ubuntu 7.1...
http://forum.codecal...ver-ubuntu.html
I used howtoforge.com. I did type those commands in, I have mysql installed, thats why im confused.

Jordan said:

It sounds like you have MySQL/Apache/PHP Setup or you wouldn't get a PHP error but it also sounds like you didn't compile MySQL into PHP (which I thought was built in now).

In your php.ini file (usually /etc/php.ini but I don't know about Ubuntu) make sure that this line:


extension=mysql.so


is not commented (comments use a # sign).

Restart Apache and see if you get the error.

I will do that when I get home. I fugured any apache has mysql in it... I didnt see why it wouldnt. Thanks jordan.

#6
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts

Jordan said:

It sounds like you have MySQL/Apache/PHP Setup or you wouldn't get a PHP error but it also sounds like you didn't compile MySQL into PHP (which I thought was built in now).

In your php.ini file (usually /etc/php.ini but I don't know about Ubuntu) make sure that this line:


extension=mysql.so


is not commented (comments use a # sign).

Restart Apache and see if you get the error.

For anyone who followed my tutorial, php.ini will be located in /etc/php5/apache2/, but for those who did followed my tutorial, configuration should not be necessary.

#7
phpforfun

phpforfun

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,236 posts

John said:

For anyone who followed my tutorial, php.ini will be located in /etc/php5/apache2/, but for those who did followed my tutorial, configuration should not be necessary.

thats funny, because my php.ini is located in /etc/, not /etc/php5/apache2. Ill look more into this when I get home.

Forgot to setup ssh :(

Edited by phpforfun, 02 April 2008 - 12:55 PM.


#8
phpforfun

phpforfun

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,236 posts
edited the code in php.ini

Quote

; For example, on Windows:
;
; extension=msql.dll
;
; ... or under UNIX:
;
extension=msql.so
;
Restarted apache

Quote

justin@Justin-Ubuntu:~$ sudo /etc/init.d/apache2 restart
* Restarting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[ OK ]
justin@Justin-Ubuntu:~$
Restarted MySQL

Quote

justin@Justin-Ubuntu:~$ sudo /etc/init.d/mysql restart
* Stopping MySQL database server mysqld [ OK ]
* Starting MySQL database server mysqld [ OK ]
* Checking for corrupt, not cleanly closed and upgrade needing tables.
justin@Justin-Ubuntu:~$

Still get the error...

#9
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
msql != mysql

#10
phpforfun

phpforfun

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,236 posts

John said:

msql != mysql

msql or mysql? And do I insert that in there anywhere?

#11
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
If you want PHP to load the mysql extension you need to add/uncomment this line:

Quote

extension=mysql.so
if you want to load msql [microsoft sql] add/uncomment this line:

Quote

extension=msql.so


#12
phpforfun

phpforfun

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,236 posts
ok I got it, I just deleted MySQL, and PHP, reinstalled it, works... ok

Thanks a lot john and jordan!

Edited by phpforfun, 02 April 2008 - 09:56 PM.