LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 01-21-2007, 09:43 PM   #1
rickbot
LQ Newbie
 
Registered: Mar 2005
Location: Toronto, Canada
Distribution: debian
Posts: 27

Rep: Reputation: 15
php5 - problems after upgrade


hi folks. i've recently upgraded my php from 4 to 5 and its acting very strangely.
i've been following a book (Beginning php apache mysql web development) and some of my scripts are still working but when i try anything that involves mysql, i get a blank page. no errors, just blank, and 'display_errors' is turned on in php.ini. phpinfo() also gives the same result. i'm using suse 10.0 with apache 2.0.54 and mysql 4.1.13. i've used apt/synaptic to upgrade php and i selected everything available so i don't think i could be missing anything. if anyone is familliar with this book, i'm on the 'moviesite' section and the earlier files which only access other php files are working fine, its when i try the stuff that creates the database and populates it that apparently nothing happens. the same phpinfo() file which worked fine with php4 now comes up blank as well. i've gone through my apache config files and can't see anything wrong. any ideas?
 
Old 01-22-2007, 01:52 AM   #2
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu
Posts: 1,426

Rep: Reputation: 100Reputation: 100
take another look at php.ini whether you find this
error_reporting(E_ALL ^ E_NOTICE);
if there is sth like
error_reporting(0);
it would be an explanation for the blank page. But I'm just guessing...
Good luck,
j
 
Old 01-22-2007, 06:49 AM   #3
rickbot
LQ Newbie
 
Registered: Mar 2005
Location: Toronto, Canada
Distribution: debian
Posts: 27

Original Poster
Rep: Reputation: 15
on my system it looks like: error_reporting = E_ALL & ~E_NOTICE. everything looks right as far as i can tell. i'm wondering if something extra has to be done to enable a certain module. i have both php5-mysql and php5-mysqli packages installed. can you have both or does it have to be one or the other?
 
Old 01-22-2007, 06:09 PM   #4
rickbot
LQ Newbie
 
Registered: Mar 2005
Location: Toronto, Canada
Distribution: debian
Posts: 27

Original Poster
Rep: Reputation: 15
found the answer! in the files i used to create and populate the database, i just copied and pasted code from the book in pdf. for some reason, any double-quotes were not recognized properly. once i manually re-typed all the double-quotes, everything works.
 
Old 01-22-2007, 08:42 PM   #5
rickbot
LQ Newbie
 
Registered: Mar 2005
Location: Toronto, Canada
Distribution: debian
Posts: 27

Original Poster
Rep: Reputation: 15
not resolved!

ok, i spoke too soon. a simple connect script worked:
PHP Code:
<?php
     $connect 
mysql_connect("localhost""root""*****")
        or die (
mysql_error());
     echo 
"connection successful";
?>
so i got excited but after i manually typed all this, i got no 'Movie Database successfully created', no errors, nothing. browser says 'page loaded' but its blank:
PHP Code:
<?php
//connect to mysql
$connect mysql_connect("localhost""root""*****") or
    die (
mysql_error());

//create main database
mysql_create_db("wiley") or
    die (
mysql_error());

//select database
mysql_select_db("wiley");

//create "movie" table
$movie "CREATE TABLE movie (
    movie_id int(11) NOT NULL auto_increment,
    movie_name varchar(255) NOT NULL,
    movie_type tinyint(2) NOT NULL default 0,
    movie_year int(4)  NOT NULL default 0,
    movie_leadactor int(11) NOT NULL default 0,
    movie_director int(11) NOT NULL default 0,
    PRIMARY KEY (movie_id),
    KEY movie_type (movie_type, movie_year)
    )
    TYPE=MyISAM AUTO_INCREMENT=4"
;

$results mysql_query($movie)
    or die (
mysql_error());

//create "movietype" table
$movietype "CREATE TABLE movietype (
    movietype_id int(11) NOT NULL auto_increment,
    movietype_label varchar(100) NOT NULL,
    PRIMARY KEY (movietype_id)
    )
    TYPE-MyISAM AUTO_INCREMENT=9"
;

$results mysql_query($movietype)
    or die (
mysql_error());

//create "people" table
$people "CREATE TABLE people (
    people_id int(11) NOT NULL auto_increment,
    people_fullname varchar(255) NOT NULL,
    people_isactor tinyint(1) NOT NULL default 0,
    people_isdirector tinyint(1) NOT NULL default 0,
    PRIMARY KEY (people_id)
    )
    TYPE=MyISAM AUTO_INCREMENT=7"
;

$results mysql_query($people)
    or die (
mysql_error());

echo 
"Movie Database successfully created!";
?>
checking with mysql via terminal shows that no new database was created. i'm lost.

Last edited by rickbot; 01-22-2007 at 08:44 PM.
 
Old 01-23-2007, 09:09 PM   #6
rickbot
LQ Newbie
 
Registered: Mar 2005
Location: Toronto, Canada
Distribution: debian
Posts: 27

Original Poster
Rep: Reputation: 15
got it this time! turns out there are two different 'php.ini' files. all this time i've been looking at /etc/php.ini and then i discovered /etc/php5/apache2/php.ini. i edited the latter to turn error_reporting = On and got:
Code:
Fatal error: Call to undefined function mysql_create_db() in /home/rickbot/public_html/htdocs/moviesite/createmovie.php on line 8
the problem is that 'mysql_create_db()' is no longer supported in php5. i changed:
PHP Code:
mysql_create_db("wiley") or 
    die (
mysql_error()); 
to:
PHP Code:
mysql_query("CREATE DATABASE IF NOT EXISTS wiley"
    or die (
mysql_error()); 
and problem solved! thanks guys.
 
  


Reply

Tags
mysql, php5


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP5 having problems with libmysqlclient alitrix Linux - Software 2 05-23-2007 08:50 AM
Apache22 and php5 problems blood_omen *BSD 6 10-23-2006 10:49 AM
Installing Apache2, PHP5 etc on FC2? or better to upgrade OS? grahamu Linux - Software 1 08-03-2006 10:02 AM
Apache PHP5 module won't work after Mandriva 2006 upgrade MJatIFAD Linux - Software 2 02-14-2006 03:58 PM
PHP5 compiling problems Ephracis Linux - Software 10 02-10-2005 01:45 PM


All times are GMT -5. The time now is 07:19 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration