CMS or PHP/MySQL?

Hi,

Back in September or so I posted about help with PHP/MySQL and Freeway integration and got great information. However, I still haven’t quite mastered it yet. Recently, I read some of the posts about using CMS and was wondering if that would work for my situation. (I tried searching for those old posts but couldn’t find them!)

Here’s my situation:
I’ve made a general site for a personal trainer. He would like to allow people to log in and make a meal plan for themselves on like a daily basis. He would then like to be able to view what people entered. He would eventually like to make it so he can sell his fitness programs online a la Jillian of “Biggest Loser” fame. He offers about 3 different programs. I know FileMaker at maybe an intermediate level so creating a DB and making all the relationships is pretty straight forward to me. However, learning how to communicate with a DB via PHP and Freeway is not working for me yet. Is using CMS a way that could help make things a little easier? My gut says no because I haven’t seen anything where a user then can see content (in this case what is available in their plan) and enter it. I’ve looked up a little about WebYep and Joomla.

BTW, my biggest problem with PHP/MySQL and Freeway is that I haven’t been able to successfully make a site read correctly. I’ve followed the tutorial that uses Axiom Widgets as an example but my sales.php page (where the products should show up) end up showing just as the code. I’m been doing it mostly on my computer. I installed MAMP to give me PHP and MySQL. I’ve tried putting the files in either the Sites folder of my Home folder or the htdocs folder MAMP’s FAQ page directs you to do. As far as the mechanics of the tutorial (using a “page” as an .inc file, using the php make markup action to make the page all php code, et), I do understand it.

Any help would be greatly appreciated. I feel lost in so many ways.

Thank you!


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Recently, I read some of the posts about using CMS and was wondering if that would work for my situation. (I tried searching for those old posts but couldn’t find them!)

Here’s my situation: I’ve made a general site for a personal trainer. He would like to allow people to log in and make a meal plan for themselves on like a daily basis. He would then like to be able to view what people entered. He would eventually like to make it so he can sell his fitness programs online a la Jillian of “Biggest Loser” fame.

I think that you might have a long crawl trying to do any of this with a CMS or a blogging software. It’s just too specialized for that. This is the sort of project that screams out for custom development.

What I would recommend is getting a good book, and starting small with some simple projects. Luke Welling and Laura Thompson’s PHP and MySQL Web Development is an easy read, but goes incredibly deep.

Don’t worry too much about Freeway at first, just use a text editor and make some ugly (but database-backed) Web pages to get your feet wet. Getting database code into Freeway is startlingly easy, what with the Markup Items and HTML Markup slots. It’s very simple to take the guts out of a hand-coded application page and simply “thread it” into your highly designed layout. Once it’s there, you can move bits around and re-style them without having to rewrite anything.

Walter


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks Walter.

I’ve looked through that book (& a For Dummies book that had great information, too). I understand a lot of it, but not all of it. Your idea of trying the sample pages using a text editor is great. Any ideas of how to make sure I can use my own computer for practice? I do have a website on Yahoo I can use. I guess there probably really any big difference between using web host or my own computer. I just seemed easier to set up everything under a localhost.

Thanks again for your help.

Brian


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I doubt that your Yahoo account will even approximate a “normal”
hosting provider’s setup. I recommend that you try MAMP or if you’re
daring, enable PHP on your Mac’s built-in Apache (google for
directions) and download and install MySQL (it’s free, and there are
one-click installers for most versions of Mac OS X).

Another approach would be to get one of the extremely affordable
hosting setups from our own James Wilkinson or David Owen, both of
whom provide amazing levels of personal service to the Freeway
community. It’s pennies a day to have a hosting setup that will be
exactly like any host your clients may direct you to use. It’s not
only good practice, it’s a nice feature for your business to be able
to say “I’ll post that on my development server…”

Walter

On May 2, 2008, at 2:37 AM, Brisprad wrote:

Thanks Walter.

I’ve looked through that book (& a For Dummies book that had great
information, too). I understand a lot of it, but not all of it.
Your idea of trying the sample pages using a text editor is great.
Any ideas of how to make sure I can use my own computer for
practice? I do have a website on Yahoo I can use. I guess there
probably really any big difference between using web host or my own
computer. I just seemed easier to set up everything under a localhost.

Thanks again for your help.

Brian


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Extremely wise advice.

On Fri, May 2, 2008 at 6:40 AM, Walter Lee Davis wrote:

Another approach would be to get one of the extremely affordable
hosting setups from our own James Wilkinson or David Owen, both of
whom provide amazing levels of personal service to the Freeway
community. It’s pennies a day to have a hosting setup that will be
exactly like any host your clients may direct you to use. It’s not
only good practice, it’s a nice feature for your business to be able
to say “I’ll post that on my development server…”


Ernie Simpson – Freeway 5 Pro User – http://www.thebigerns.com/freeway/

I’ve tried using MAMP. The info page says everything is installed. I’ll try using just a basic text file with PHP code like you suggested to see if it is working correctly. Any Freeway page I’ve tried to do just shows the code and doesn’t build the page. Like I said above, I’ve even tried putting the files in the Sites folder or the htdocs folder that MAMP originally defaulted to (When I used Sites, I did direct MAMP there of course).

I guess my question with MAMP is: Is PHP and MySQL running on my Mac the same way as if I installed it directly?

As far as hosting, I understand what you mean. I’m doing another site for someone else and we chose a different host. Funny thing is it costs less than Yahoo and they offer more services-and better support for MySQL and PHP. I might just try to get the trainer to switch then.

Thanks again to both of you.

Brian


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

No. MAMP fiddles with all of the paths and ports so that everything
is running in your Applications folder and nothing conflicts. You can
have MAMP and the “real” stuff installed on the same Mac, and neither
one will know about the other. You will need to point your browser at
a non-standard port to see your MAMP site, IIRC. So you would go to
http://localhost:4000/mysite/mypage.php or something like that.

Walter

On May 2, 2008, at 10:48 AM, Brisprad wrote:

I guess my question with MAMP is: Is PHP and MySQL running on my
Mac the same way as if I installed it directly?


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks again Walter! Sorry I’m slow with the thank you but I’ve been busy the last 2 days with work and other things.

I decided to setup MySQL on my computer the normal way, not through MAMP. I also installed phpMyAdmin. But that has brought up more questions. I can look at a DB using the MySQL Admin tool you can download. I can even use CocoaMySQL to look at and set up DBs. However, I tried using phpMyAdmin and I keep getting an error that it can’t talk to MySQL. I go to the Setup Script page and can change things but it won’t save the file. Is this a problem only if I want to use phpMyAdmin? Can I do everything to administer DB through CocoaMySQL? The one thing I’ve noticed is the path for the socket is different: The setting MySQL has is /tmp/mysql.sock. phpMyAdmin has var/mysql/mysql.sock. If I try to reset it with the Setup page, it just won’t save.

I’m sorry if this is going a little off topic maybe but appreciate the help!

Brian


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

This probably means that the folder where you are trying to save the
file is set with permissions that won’t allow the www user to save
the file. PHP runs as the same user as Apache (the Web server) so you
need to make it possible for that user to save files… You can solve
this by making that folder world-writeable and world-executable. I
haven’t done this in a while, but I think the folder is called
configuration or config. Anyway, use Transmit or another app that can
view local files and monkey with their permissions, and set that
folder to world-everything (777 permissions) and try again. The setup
script definitely works fine.

Walter

On May 4, 2008, at 6:54 PM, Brisprad wrote:

However, I tried using phpMyAdmin and I keep getting an error that
it can’t talk to MySQL. I go to the Setup Script page and can
change things but it won’t save the file.


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I was able to change it with Transmit-no problem. However, it still isn’t allowing me to use phpMyAdmin to change the configuration.

I did try using a Freeway file I created similar to the Axiom one (making the same pages, using the same DB) but I get these errors:

Warning: mysql_connect() [function.mysql-connect]: Can’t connect to local MySQL server through socket ‘/var/mysql/mysql.sock’ (38) in /Users/brisprad/Sites/sales/sales.php on line 6

Warning: mysql_db_query(): supplied argument is not a valid MySQL-Link resource in /Users/brisprad/Sites/sales/sales.php on line 17
Database error in GetProducts
Error #2002: Can’t connect to local MySQL server through socket ‘/var/mysql/mysql.sock’ (38)

Like I said in my previous post, if I look at MySQL through Terminal and use the Status command, it says the Unix socket is /tmp/mysql.sock. Using a PHP test page, it shows /var/mysql/mysql.sock. Could this be a problem with the above errors?

I’m sorry if I’m getting to a pain about this. I’ve looked on Apple’s discussions, too. Is there somewhere else that would be better since I’m going beyond Freeway here?

Thanks again for your help.

Brian

Anyway, use Transmit or another app that can
view local files and monkey with their permissions, and set that
folder to world-everything (777 permissions) and try again. The setup
script definitely works fine.


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Oh, okay. That’s a well-known Mac MySQL problem. The Mac OS place to
put the mysql “socket” file is in /tmp/ rather than /var/ .

If you have installed the Developer tools on your Mac, then open a
Terminal and issue this command:

locate mysql.sock

Make note of where the system says it is. Now, move to where the PHP
believes it is:

cd /var/mysql

If you get an error at this point that the path does not exist, then
pause to create it:

sudo mkdir -p /var/mysql

You will be challenged for an administrator password. Use your own
password, as the owner of the computer you are the default
administrator.

Now, move into the folder (if you weren’t there already).

cd /var/mysql

Finally, make a symbolic link (kind of like an alias) to the real
mysql.pid file:

sudo ln -s /tmp/mysql.sock

(The command above starts with lower-case L, not capital I or numeral
1.) You may be challenged again for your admin password, but if you
have been working quickly, you may not. There’s a time-out between
challenges.

After doing this level of change, it’s a good idea to stop and start
Apache using the Sharing control panel.

Then try again, it should be working for you.

Walter

On May 5, 2008, at 2:38 AM, Brisprad wrote:

I was able to change it with Transmit-no problem. However, it still
isn’t allowing me to use phpMyAdmin to change the configuration.

I did try using a Freeway file I created similar to the Axiom one
(making the same pages, using the same DB) but I get these errors:

Warning: mysql_connect() [function.mysql-connect]: Can’t connect to
local MySQL server through socket ‘/var/mysql/mysql.sock’ (38) in /
Users/brisprad/Sites/sales/sales.php on line 6

Warning: mysql_db_query(): supplied argument is not a valid MySQL-
Link resource in /Users/brisprad/Sites/sales/sales.php on line 17
Database error in GetProducts
Error #2002: Can’t connect to local MySQL server through socket ‘/
var/mysql/mysql.sock’ (38)

Like I said in my previous post, if I look at MySQL through
Terminal and use the Status command, it says the Unix socket is /
tmp/mysql.sock. Using a PHP test page, it shows /var/mysql/
mysql.sock. Could this be a problem with the above errors?

I’m sorry if I’m getting to a pain about this. I’ve looked on
Apple’s discussions, too. Is there somewhere else that would be
better since I’m going beyond Freeway here?

Thanks again for your help.

Brian

Anyway, use Transmit or another app that can
view local files and monkey with their permissions, and set that
folder to world-everything (777 permissions) and try again. The setup
script definitely works fine.


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi again,

I still can’t get it to work. I’ve even followed other help on these pages:

Getting MySQL and Mac OS X 10.5 Working Working With PHP in Mac OS X 10.5

In Terminal, when I ask to see where the mysql.sock file is, it says /var/mysql/

I tried setting the default socket in the php.ini file to:
mysql.default_socket = /var/mysql/mysql.sock and then to mysql.default_socket = /tmp/mysql.sock

Does it need to say private/var/…?

In editing the my.cnf file, I had to mess with permissions.

I’m worried now that I’ve messed with too much not exactly knowing what I’m doing and that it will never work. I understand that PHP is looking for the mysql.sock file in /var/mysql/ but that MySQL installed it in /tmp/. Where should the file officially reside? I have one in each location if you look by going through the Finder. I did notice that both are zero k files and thought that was odd.

Should I maybe follow the instructions on the first link again to reset?

I really do appreciate all the help and feel bad that I’m asking so much!

Thanks again,
Brian


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

What version of Mac OS are you running there?

It’s not unusual for these files to appear very small, even 0k to the
Finder. All they are is a reference to a process ID. Try this. Move
into the directory where you want to look at the socket (either /var/
or /tmp/) and issue this command:

ls -a

(Lower-case L for the first character.)

That should tell you explicitly if what you are seeing is a symbolic
link or not.

If both appear to be symbolic links, then you may have created an
infinite loop! (The Space-Time Continuum could collapse, etc… Just
kidding!) Delete both, and start over, but this time make sure that
MySQL is actually running:

ps auxc | grep mysql | grep -v grep

If you don’t see anything listed after that command, then have a look
through the MySQL documentation for how to start the server. I don’t
know if there is a control panel for Leopard yet, so you may have to
use the command-line to start it up.

Once MySQL is actually running, you will see a mysql.sock, in one
location or the other, and then you can try the link thing if you
can’t get PHP to see it. Basically, you should only need the link if
PHP is looking for the socket in a different location. Also, try
restarting your entire computer to see if that clears things up –
although again you will need to start MySQL manually if you do this
and you don’t have the control panel goodie to do that for you.

Walter

On May 5, 2008, at 2:58 PM, Brisprad wrote:

Hi again,

I still can’t get it to work. I’ve even followed other help on
these pages:


Getting MySQL and Mac OS X 10.5 Working


Working With PHP in Mac OS X 10.5

In Terminal, when I ask to see where the mysql.sock file is, it
says /var/mysql/

I tried setting the default socket in the php.ini file to:
mysql.default_socket = /var/mysql/mysql.sock and then to
mysql.default_socket = /tmp/mysql.sock

Does it need to say private/var/…?

In editing the my.cnf file, I had to mess with permissions.

I’m worried now that I’ve messed with too much not exactly knowing
what I’m doing and that it will never work. I understand that PHP
is looking for the mysql.sock file in /var/mysql/ but that MySQL
installed it in /tmp/. Where should the file officially reside? I
have one in each location if you look by going through the Finder.
I did notice that both are zero k files and thought that was odd.

Should I maybe follow the instructions on the first link again to
reset?

I really do appreciate all the help and feel bad that I’m asking so
much!

Thanks again,
Brian


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Forgot to clarify – the character that separates these commands is
the Pipe (found as the Shift-character of the backslash on US
keyboards). It’s a vertical line, and in this font, looks just like
Capital i and Lower-case L. Grrrr. Damned ambiguous fonts.

Walter

On May 5, 2008, at 3:18 PM, Walter Lee Davis wrote:

ps auxc | grep mysql | grep -v grep


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

What version of Mac OS are you running there?

I have Leopard–10.5.2

If both appear to be symbolic links, then you may have created an
infinite loop! (The Space-Time Continuum could collapse, etc… Just
kidding!)

They seemed to me to be real links. Wouldn’t there have been something after the file name if I was looking through Terminal.

Delete both, and start over, but this time make sure that
MySQL is actually running:

ps auxc | grep mysql | grep -v grep

know if there is a control panel for Leopard yet, so you may have to
use the command-line to start it up.

I deleted them and restarted MySQL. The Control Panel works now for 10.5! I actually did it from Command line though since I was there.

Once MySQL is actually running, you will see a mysql.sock, in one
location or the other, and then you can try the link thing if you
can’t get PHP to see it.

It is now back in /var/mysql/.

I tried looking at my page I am trying to use and am not getting any errors-the page loads but doesn’t look into the database. That is, my variables like “$myDescription” show on the completed page.

Am I right in thinking I need to make a symbolic link in /tmp/ to tell MySQL to look at /var/?

When I try to log into MySQL as root under Terminal, I get this error:

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)

I can connect using the MySQL Administrator. I changed the socket name under Options>Advanced Networking tab to be /var/mysql/mysql.sock. Now when I lok at the mySQL status, it says the same thing. And it lets me log in.

My Freeway page still says the variable names. My page is nearly identical to the Axiom Widgets, just a different look. I followed the tutorial and used one of the templates.

I know I’m close!! Thanks again or all your huge help! I’m glad I didn make the Space-Time Continuum collapse-well, not yet!

Brian


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Is the page filename ending in .php? Take a look at your Apache
config file:

/etc/apache2/httpd.conf

Make sure that the AddType is there for php – it should look like this:

 AddType application/x-httpd-php .php
 AddType application/x-httpd-php-source .phps

And then take a look at your DirectoryIndex statement, make sure that
you have added index.php there:

     DirectoryIndex index.html index.php

If you make either or both of these changes, be sure to bounce Apache
(turn it off and on again) so that the configuration is re-loaded.

Walter

On May 5, 2008, at 7:50 PM, Brisprad wrote:

I tried looking at my page I am trying to use and am not getting
any errors-the page loads but doesn’t look into the database. That
is, my variables like “$myDescription” show on the completed page.


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Is the page filename ending in .php?

Yes.

Take a look at your Apache
config file:

/etc/apache2/httpd.conf

Make sure that the AddType is there for php – it should look like this:

 AddType application/x-httpd-php .php
 AddType application/x-httpd-php-source .phps

Where does it go on the list of other things? I searched for other AddTypes but most were commented out. I tried adding it after here:

If the AddEncoding directives above are commented-out, then you probably should define those extensions to indicate media types:

AddType application/x-compress .Z

AddType application/x-gzip .gz .tgz

but then I couldn’t get any page to work after bouncing Apache. I moved it a little higher:

372 #

373 #AddType application/x-gzip .tgz

374 #

375 AddType application/x-httpd-php .php

376 AddType application/x-httpd-php-source .phps

377 #

It looks like I have the # in the wrong place. I’m sure this is basic but where do they go to tell the file the lines after are comments and the lines without are commands?

And then take a look at your DirectoryIndex statement, make sure that
you have added index.php there:

     DirectoryIndex index.html index.php

Am I correct in that I saw only one line that said DirectoryIndex? I simply added the index.php

Thanks again Walter! Hope this all makes sense to you.

Brian


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Have you uncommented the call to load PHP? Is PHP running?

Walter

On May 5, 2008, at 10:17 PM, Brisprad wrote:

Is the page filename ending in .php?

Yes.

Take a look at your Apache
config file:

/etc/apache2/httpd.conf

Make sure that the AddType is there for php – it should look like
this:

 AddType application/x-httpd-php .php
 AddType application/x-httpd-php-source .phps

Where does it go on the list of other things? I searched for other
AddTypes but most were commented out. I tried adding it after here:

If the AddEncoding directives above are commented-out, then you
probably should define those extensions to indicate media types:

AddType application/x-compress .Z

AddType application/x-gzip .gz .tgz

but then I couldn’t get any page to work after bouncing Apache. I
moved it a little higher:

372 #

373 #AddType application/x-gzip .tgz

374 #

375 AddType application/x-httpd-php .php

376 AddType application/x-httpd-php-source .phps

377 #

It looks like I have the # in the wrong place. I’m sure this is
basic but where do they go to tell the file the lines after are
comments and the lines without are commands?

And then take a look at your DirectoryIndex statement, make sure that
you have added index.php there:

     DirectoryIndex index.html index.php

Am I correct in that I saw only one line that said DirectoryIndex?
I simply added the index.php

Thanks again Walter! Hope this all makes sense to you.

Brian


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

On 6 May. 2008, 9:49 am, waltd wrote:

Have you uncommented the call to load PHP? Is PHP running?

Yes. In fact, I also set up a PHP info page and was able to see it fine-that’s what made me realize that PHP was looking for the socket in /var/.

Does it matter where the AddType lines go? It has only been since I changed them that my page won’t load at all. I get a “Can’t find server” message.

Brian


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Rrrr. Roll back and let’s start this over a little smaller-scale.

I imagine that where you have those statements now is making Apache
fail to start at all. If you have been editing your httpd.conf in
BBEdit or TextMate or similar, use undo to get back to where you
started. If you can’t get there from here, let me know and I will try
to locate you a virgin Mac OS X 10.5 httpd.conf. My daughter’s mini
probably hasn’t been fooled with at all.

What I would like you to do is to look for each of these statements
in your (reverted) httpd.conf.

DirectoryIndex

AddType application/x-httpd-php

Wherever they are, edit them in place to get the desired code. You
will probably find that DirectoryIndex is there, uncommented, but
contains only index.html. You will also probably find that AddType is
there, but commented out. If it isn’t commented out, then it will be
wrapped in an IF statement that conditions it running on PHP being
loaded as a module.

Finally, if you would pastie[1] your PHP page to me, I can see if
there’s something fundamentally wrong with it that might be causing
the problem. This could all be a storm in a teakettle – we’re
running in circles trying to “fix” PHP, when the page has a syntax
error or something…

Walter

  1. http://pastie.caboo.se

On May 6, 2008, at 9:51 AM, Brisprad wrote:

On 6 May. 2008, 9:49 am, waltd wrote:

Have you uncommented the call to load PHP? Is PHP running?

Yes. In fact, I also set up a PHP info page and was able to see it
fine-that’s what made me realize that PHP was looking for the
socket in /var/.

Does it matter where the AddType lines go? It has only been since I
changed them that my page won’t load at all. I get a “Can’t find
server” message.

Brian


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options