Installing PHP and MySQL
Run httpd with
/etc/rc.d/init.d/httpd start
Create a test file /var/www/html/test.php containing the following line
phpinfo();
Use a web browser to browse to http://localhost/test.php
If PHP is working, this should display your settings. Since v7.2, RedHat uses PostgreSQL instead of MySQL you will have to change a number of settings. Note in particular that the default PHP is not installed with MySQL support.
PHP-Nuke Web Portal System
You need a working Linux box and download and install the following software:
- Apache (www.apache.org)
- PHP 4.0.4 or better with mod_php Apache module (www.php.net)
- mySQL database server (www.mysql.com)
Run /usr/bin/mysql_install_db to install initial MySql tables. This is safe to do at any time. Set a password for the MySQL root user with
mysqladmin -u root -p password 'new-password' mysqladmin -u root -h localhost.localdomain -p password 'new-password'
Test installation with
cd sql-bench; run-all-tests
However this is not installed with the RedHat7.2 standard rpms. MySQL commands are in /usr/bin
mysqladmin version mysqladmin variables
To see the MySQL databases
mysqlshow mysqlshow databasename
Run mySql with
/etc/rc.d/init.d/mysqld start
Create table for PHP-NUke with
mysqladmin create nuke
Then fill the databases with
mysql nuke
To connect to a MySQL database PHP needs MySQL extensions. These can be found in php-mysql-4.0.6-7.i386.rpm
To make it easier to administer MySQL databases, install phpMyAdmin
Access it at http://localhost/phpMyAdmin-2.3.0/
su - postgres createdb nuke psql nuke
I got a load of errors
Download nuke_pg.sql
su - postgres createdb nuke cat /root/nuke_pg.sql | psql nuke
Lots of messages as it runs but no errors! Cool!
Next problem, Looking at http://localhost/test/admin.php shows lots of errors;
Warning: Supplied argument is not a valid PostgreSQL link resource in /var/www/html/test/includes/sql_layer.php on line 197
Lots of posts about this on the BlueWolverine forums so try their version of phpnuke. It looks like replacing my version of includes/sql_layer.php with theirs might do the job. Bit better, just a lot of errors at line 303 in sql_layer.php
Put the @ back in line 303 like the comment suggests.
$res=@pq_exec($id,$query);
Great! Now only 1 error.
Warning: Unable to connect to PostgreSQL server: connectDBStart()->connect() failed: Connection refused Is the postmaster running (with -i) at ‘localhost’ and accepting connections on TCP/IP port 5432? in /var/www/html/test/includes/sql_layer.php on line 92
I added “-o -i” options to /etc/rc.d/init.d/postgresql as follows:
su -l postgres -s /bin/sh -c "/usr/bin/pg_ctl <strong>-o -i</strong> -D $PGDATA -p /usr/bin/postmaster start > /dev/null 2>&1"
Now restart Postgres and httpd
/etc/rc.d/init.d/postgresql restart
/etc/rc.d/init.d/httpd restart
Getting close, a new error:
Warning: Unable to connect to PostgreSQL server: FATAL 1: user “root” does not exist in /var/www/html/test/includes/sql_layer.php on line 92
Looks like the user is wrong in config.php. Fix it:
$dbuname="postgres"; $dbpass="";
Hmm another error:
Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/html/test/themes/NukeNews/theme.php on line 57
It looks like my Linux box (a P166 with only 80Mb ram) is too slow and PHP is timing out. Modify the max_execution_time in /etc/php.ini to a bigger value
max_execution_time=480;