Jump to content

Why Can't I Open PHP Files on My New Mac?


Devious Designs

Recommended Posts

[!--quoteo(post=357676:date=Mar 23 2006, 01:23 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Mar 23 2006, 01:23 PM) [snapback]357676[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I havn't setup PHP on an Mac before but what I expect is that Apache or what ever webserver you're using is misconfigured and so you get the save/open dialog box.
[/quote]

the computer isn't even connecte to the internet.
I'm talking about saved php files.
Link to comment
Share on other sites

[!--quoteo(post=357678:date=Mar 23 2006, 05:25 PM:name=Devious Designs)--][div class=\'quotetop\']QUOTE(Devious Designs @ Mar 23 2006, 05:25 PM) [snapback]357678[/snapback][/div][div class=\'quotemain\'][!--quotec--]
the computer isn't even connecte to the internet.
I'm talking about saved php files.
[/quote]

whilst the Mac is pre-shipped with a web server set up, it doesnt include a PHP installation initially. A 'Save' dialog' normally means that the server can't parse it, your browser doesn't understand the format, so you get prompted to save it.

if you try and open a PHP file with a copy of FF, Safari or IE, or whatever browser, you need some sort of program/installation to parse it. if i open a local php file with Safari, IE or FF on my pc OR my mac, i'm gonna get a problem similar to yours.
Link to comment
Share on other sites

[!--quoteo(post=357683:date=Mar 23 2006, 01:38 PM:name=redbullmarky)--][div class=\'quotetop\']QUOTE(redbullmarky @ Mar 23 2006, 01:38 PM) [snapback]357683[/snapback][/div][div class=\'quotemain\'][!--quotec--]
whilst the Mac is pre-shipped with a web server set up, it doesnt include a PHP installation initially. A 'Save' dialog' normally means that the server can't parse it, your browser doesn't understand the format, so you get prompted to save it.

if you try and open a PHP file with a copy of FF, Safari or IE, or whatever browser, you need some sort of program/installation to parse it. if i open a local php file with Safari, IE or FF on my pc OR my mac, i'm gonna get a problem similar to yours.
[/quote]


Any reccomendations?
Link to comment
Share on other sites

[!--quoteo(post=357705:date=Mar 23 2006, 01:18 PM:name=Devious Designs)--][div class=\'quotetop\']QUOTE(Devious Designs @ Mar 23 2006, 01:18 PM) [snapback]357705[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Any reccomendations?
[/quote]

Install PHP
Link to comment
Share on other sites

[!--quoteo(post=357705:date=Mar 23 2006, 06:18 PM:name=Devious Designs)--][div class=\'quotetop\']QUOTE(Devious Designs @ Mar 23 2006, 06:18 PM) [snapback]357705[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Any reccomendations?
[/quote]

absolutely - [a href=\"http://www.entropy.ch/software/macosx/php/\" target=\"_blank\"]http://www.entropy.ch/software/macosx/php/[/a]
Link to comment
Share on other sites

[!--quoteo(post=357714:date=Mar 23 2006, 02:28 PM:name=redbullmarky)--][div class=\'quotetop\']QUOTE(redbullmarky @ Mar 23 2006, 02:28 PM) [snapback]357714[/snapback][/div][div class=\'quotemain\'][!--quotec--]
absolutely - [a href=\"http://www.entropy.ch/software/macosx/php/\" target=\"_blank\"]http://www.entropy.ch/software/macosx/php/[/a]
[/quote]

Thanks!

Which one should I get?

PHP 5 on Mac OS X 10.3/10.4
PHP 5.1.2 for Apache 1.3
PHP 5.1.2 for Apache 1.3 with commercial PDFLib
PHP 5.0.4 for Apache 2
PHP 5.0.4 for Apache 2 with commercial PDFLib
PHP 4 on Mac OS X 10.3/10.4
PHP 4.3.11 for Apache 1.3
PHP 4.3.11 for Apache 1.3 with commercial PDFLib
PHP 4 on Mac OS X 10.2
PHP 4.3.4 for Apache 1.3

Link to comment
Share on other sites

i actually opted for php4. if your mac is new, my guess is that you've got OSX 10.4, so go for this one:

[!--quoteo(post=357768:date=Mar 23 2006, 08:45 PM:name=Devious Designs)--][div class=\'quotetop\']QUOTE(Devious Designs @ Mar 23 2006, 08:45 PM) [snapback]357768[/snapback][/div][div class=\'quotemain\'][!--quotec--]
PHP 4 on Mac OS X 10.3/10.4
PHP 4.3.11 for Apache 1.3
[/quote]

but i don't think php5 was there before when i first installed it. best thing to do is have a look around these forums and elsewhere for the differences between 4 and 5.

cheers
Link to comment
Share on other sites

[blockquote][div align=\"CENTER\"][!--sizeo:5--][span style=\"font-size:18pt;line-height:100%\"][!--/sizeo--][b]RETURN OF THE PHP PROBLEM II[/b][!--sizec--][/span][!--/sizec--][/div]

Okay, I first started this discussion at sitepoint in [a href=\"http://www.sitepoint.com/forums/showthread.php?t=360896\" target=\"_blank\"] This thread[/a]

After posting on 5 different forums, including Apple, the issue... Is still there.

In my initial post, I talked about how php files do not display in my fireFox browser. I still have the problem, but I have moved on and concluded that this is because A) I do not have OSX Server installed and/or B) My php + MySql isn't installed correctly, which is the [u]real[/u] [u]problem[/u].

[b]In a nutshell: I am trying to set up Dreamweaver MX for PHP. And I need some really clear instructions, from the begging to end.[/b]

I have OS 10.4
Dreamweaver MX 2004
PHP 5.1.2 for Apache 1.3 (Like a normal person, I downloaded the NEWEST version)
MySql 5.0.19 (Like any normal person, I dl'd the newest version)

The first problem I have is with the installations of PHP and MySql. I cannot find their folders. I do not have a /usr/local/mysql directory like Dreameaver says. The Terminal tells me "Command Not Found" (that's all the Terminal have EVER told me. :rolleyes: )

Dreamweaver...

Look, I am not a the village idiot and I am convinced that this so called "super mac G5" is the village idiot. I have installed hundreds of php scripts on Cpanel running Apache. Why do I need to open terminal? I hate the Terminal, I am scared shitless of it. All the Terminal commands that Dreamweaver tells me to do ALWAYS FAIL.

WHY do you ask? am I listening to Dreamweaver? Because unlike the MORONS at Apple Computers, they actualy supplied me with [i]some[/i] PHP/MySql documentation.

Everything that everyone has told me to download has not worked. and the worst part about all of this all is that I only get ONE MORE CHANCE to do it right.



Bonus Questions:
1) It should say it in the system profiler but it doesn't. So how the hell do I know if server is installed? [/blockquote]
Link to comment
Share on other sites

the terminal, unfortunately, is there to stay and you'll eventually become its best buddy.

however. open a Finder window. go to your home directory. you see a directory called 'Sites'? this is where you create your sites.

to answer your bonus question first: open a browser. type in [a href=\"http://localhost\" target=\"_blank\"]http://localhost[/a].
if you get an apache splash screen, it works.

in a previous link, i gave you an OSX php installation. install it. create a PHP file in your 'Sites' directory containing:

[code]
<?php
p h p i n f o ( );
?>
[/code]
(remove the spaces in my code - for some reason, it wouldnt let me post this reply without them...)

and run it.

if youre using dreamweaver, then you don't even need to set up remote info, just local and testing server, using Local/Network where it says 'Access' where youre settign up your site.

That's really all there is to it, unless something drastic is going wrong.

Cheers
Mark
Link to comment
Share on other sites

do not forget to uncomment php modules in appache config file: /etc/local/httpd/httpd.conf.
Look for those lines:
1.#LoadModule php4_module libexec/httpd/libphp4.so remove #
2.#AddModule mod_php4.c remove #

php comes preinstalled on mac.
Link to comment
Share on other sites

[!--quoteo(post=359075:date=Mar 27 2006, 07:49 PM:name=villav)--][div class=\'quotetop\']QUOTE(villav @ Mar 27 2006, 07:49 PM) [snapback]359075[/snapback][/div][div class=\'quotemain\'][!--quotec--]
do not forget to uncomment php modules in appache config file: /etc/local/httpd/httpd.conf.
Look for those lines:
1.#LoadModule php4_module libexec/httpd/libphp4.so remove #
2.#AddModule mod_php4.c remove #

php comes preinstalled on mac.
[/quote]

But I don't have an httpd.conf file.

Link to comment
Share on other sites


See, this stuff drives me nuts. I follow step by step directions and they don't work.
Then people tell me to download all this software... They might as well recall MySQL because it doesn't work very proficiently.

[quote]Setup for Sample PHP Site
Macromedia Dreamweaver MX 2004 comes with sample PHP pages to let you build a small web application. This chapter describes one way to set up the sample application using Microsoft Internet Information Server (IIS) or Personal Web Server (PWS). For more information on these web servers, see Installing a Web Server. If you're using a different web server, see "Setting Up a Web Application" in Using Dreamweaver Help.
If you're a Macintosh user, you can either connect to a remote PHP server or develop PHP sites locally using the Apache web server and PHP application server installed with your operating system. For setup information, see the following websites:
• developer.apple.com/internet/macosx/php.html
• www.entropy.ch/software/macosx/
Setting up a web application is a three-step process. First, configure your system. Second, define a Dreamweaver site. Third, connect the application to your database. This setup guide follows this three-step process.
Configuring your system (PHP)
You must configure your system before you can run PHP pages on it. Specifically, you must make sure a web server and a PHP application server are installed and running on your system, then you must create a root folder for your PHP files.
Configuring your Macintosh system (PHP)
If you're a Macintosh user, you can run PHP pages on your computer using the Apache web server and PHP application server installed with your operating system. Configuring your system consists of making sure the web server and PHP application server are working, then creating a root folder for your PHP files.
Testing the PHP installation (Macintosh)
You can test the Apache web server and PHP application server on your Macintosh by running a test page.
However, before you can use the web server to serve PHP pages and content from MySQL databases, you must configure the server to work with PHP and MySQL. For information on this process, see www.macromedia.com/devnet/mx/dreamweaver/articles/php_macintosh.html.
To test the Apache web server and PHP application server:
1. Configure the server as described in the article on the Macromedia website.
2. In Dreamweaver or any text editor, create a plain text file and name it timetest.php.
3. In the file, enter the following code:
4. <p>This page was created at <b>
5. <?php echo date("h:i:s a", time()); ?>
6. </b> on the computer running PHP.</p>
7. This code displays the time the page was processed on the server.
8. Copy the file to the /Users/your_user_name/Sites folder on your Macintosh.
9. This Sites folder is your personal root folder for the Apache web server.
10. In your web browser, enter the following URL and press Return:
11. [a href=\"http://localhost/~your_user_name/timetest.php\" target=\"_blank\"]http://localhost/~your_user_name/timetest.php[/a]
The test page should open and display a time of day.
The specified time is known as dynamic content because it changes every time you request the page. Click your browser's Refresh button to generate a new page with a different time.
Note: Looking at the source code (View > View Source in Safari) will confirm that the page does not use any client-side JavaScript to achieve this effect.
If the page doesn't work as expected, check for the following possible errors:
• The file does not have a .php extension.
• The URL contains a typing mistake. Check for errors and make sure the filename is not followed by a slash, such as [a href=\"http://localhost/~your_user_name/timetest.php/\" target=\"_blank\"]http://localhost/~your_user_name/timetest.php/[/a]. Also make sure you included the tilde (~) before your user name.
• The page code contains a typing mistake.
• The Apache server is not running. Look in System Preferences, in the Sharing category, to see whether Personal Web Sharing is enabled.
After testing and testing the server software, create a root folder for your web application. (See Creating a root folder (Macintosh).)
Creating a root folder (Macintosh)
After the server software is installed, create a root folder for your web application on the Macintosh.
To create a root folder for your web application:
• Create a folder called MySampleApp in the /Users/your_user_name/Sites folder.
• Apache will process any page in this folder or in any of its subfolders in response to an HTTP request from a web browser.
After configuring your system, you must define a Dreamweaver site. (See Defining a Dreamweaver site (PHP).)
Defining a Dreamweaver site (PHP)
After configuring your system, copy the sample files to a local folder and define a Dreamweaver site to manage the files.
Note: If you're a Macromedia HomeSite or ColdFusion Studio user, you may find it useful to think of a Dreamweaver site as being like a HomeSite or Studio project.
Copying the sample files
If you haven't already done so, copy the sample files from the Dreamweaver application folder to a folder on your hard disk.
To copy the sample files:
1. Create a new folder called Sites-Local in your user folder on your hard disk.
2. For example, create one of the following folders:
• C:\Documents and Setting\your_user_name\My Documents\Sites-Local (Windows)
• /Users/your_user_name/Documents/Sites-Local (Macintosh).
3. Note: On the Macintosh, there's a folder called Sites already in your user folder. Don't use that Sites folder as your local folder; the Sites folder is where you place your pages to make them publicly accessible when you're using the Macintosh as a web server.
4. Locate the GettingStarted folder in the Dreamweaver application folder on your hard disk.
5. If you installed Dreamweaver to its default location, the path to the folder is as follows:
• C:\Program Files\Macromedia\Dreamweaver MX 2004\Samples\GettingStarted\ (Windows)
• /Applications/Macromedia Dreamweaver MX 2004/Samples/GettingStarted (Macintosh)
6. Copy the GettingStarted folder into the Sites-Local folder.
After copying the GettingStarted folder, define the folder as a Dreamweaver local folder. (See Defining a local folder.)
Defining a local folder
After copying the GettingStarted folder, define the folder containing the PHP sample files as a Dreamweaver local folder.
To define the Dreamweaver local folder:
1. In Dreamweaver, select Site > Manage Sites. In the Manage Sites dialog box, click the New button, then select Site.
2. The Site Definition dialog box appears.
3. If the Basic tab is showing, click the Advanced tab.
4. In the Site Name text box, enter Trio-PHP.
5. The name identifies your site within Dreamweaver.
6. Click the folder icon next to the Local Root Folder text box, then browse to and select the folder (inside the GettingStarted folder) that contains the PHP sample files. The folder should be as follows:
• C:\Documents and Setting\your_user_name\My Documents\Sites-Local\GettingStarted\ 4-Develop\php (Windows)
• /Users/your_user_name/Documents/Sites-Local/GettingStarted/4-Develop/php (Macintosh)
Leave the Site Definition dialog box open. Next, define a web server folder as a Dreamweaver remote folder. (See Defining a remote folder.)
Defining a remote folder
After defining a local folder, define a web server folder as a Dreamweaver remote folder.
To define the Dreamweaver remote folder:
1. In the Advanced tab of the Site Definition dialog box, select Remote Info from the Category list.
2. The Remote Info screen appears.
3. In the Access pop-up menu, choose how you want to move your files to and from the server: across a local network (the Local/Network option) or using FTP.
4. Note: There are other options in the Access pop-up menu, but this chapter doesn't cover them. For information about them, see Using Dreamweaver Help.
5. Enter the path or FTP settings to the web server folder you created in Creating a root folder (Windows).
6. The folder may be on your hard disk or on a remote computer. Even if you created the folder on your hard disk, that folder is still considered to be the remote folder. The following example shows a possible Remote Folder path if you chose Local/Network access and your remote folder is on your Windows hard disk:
7. Remote Folder: C:\Inetpub\wwwroot\MySampleApp
8. On the Macintosh, the folder might be as follows:
9. Remote Folder: /Users/your_user_name/Sites/MySampleApp
10. For more information on FTP, see "Setting Remote Info options for FTP access" in Using Dreamweaver Help.
Leave the Site Definition dialog box open. Next, define a folder to process dynamic pages. (See Specifying where dynamic pages can be processed (PHP).)

Specifying where dynamic pages can be processed (PHP)
After defining the Dreamweaver remote folder, specify a folder to process dynamic pages. Dreamweaver uses this folder to display dynamic pages and connect to databases while you're developing your application.
To specify the folder to process dynamic pages:
1. In the advanced Site Definition dialog box, click Testing Server in the Category list.
2. The Testing Server screen appears. Dreamweaver needs the services of a testing server to generate and display dynamic content while you work. The testing server can be your local computer, a development server, a staging server, or a production server, as long as it can process PHP pages. In many situations, including setting up for the Trio site, you can use the same settings as the Remote Info category (see Defining a remote folder) because they point to a server capable of processing PHP pages.
3. Select PHP MySQL from the Server Model pop-up menu.
4. In the Access pop-up menu, select the same method (Local/Network or FTP) you specified for accessing your remote folder.
5. Dreamweaver enters the settings you specified in the Remote Info category. Leave the settings unchanged.
6. In the URL Prefix text box, enter the root URL you would enter in a web browser to request a page in your web application.
7. To display live data in your pages while you work, Dreamweaver creates a temporary file, copies it to the website's root folder, and attempts to request it using the URL prefix.
8. Dreamweaver makes a best guess at the URL prefix based on the information you provided in the Site Definition dialog box. However, the suggested URL prefix may be incorrect. Correct or enter a new URL prefix if the suggestion in Dreamweaver is incorrect. For more information, see "About the URL prefix" in Dreamweaver Help (Help > Using Dreamweaver).
9. For the PHP sample content in Windows, the prefix should be as follows:
10. URL Prefix: [a href=\"http://localhost/MySampleApp/\" target=\"_blank\"]http://localhost/MySampleApp/[/a]
11. On the Macintosh, the prefix should be as follows:
12. URL Prefix: [a href=\"http://localhost/~your_user_name/MySampleApp/\" target=\"_blank\"]http://localhost/~your_user_name/MySampleApp/[/a]
13. Tip: The URL prefix should always specify a directory, rather than a particular page on the site. Also, be sure to use the same capitalization you used when you created the folder.
14. Click OK to define the site and dismiss the Site Definition dialog box, then click Done to dismiss the Manage Sites dialog box.
After specifying a folder to process dynamic pages, upload the sample files to the web server. (See Uploading the sample files.)
Uploading the sample files
After specifying a folder to process dynamic pages, upload the sample files to the web server. You must upload the files even if the web server is running on your local computer.
If you don't upload the files, features such as Live Data view and Preview in Browser may not work properly with dynamic pages. For example, image links might be broken in Live Data view because the image files are not on the server yet. Similarly, clicking a link to a detail page while previewing a master page in a browser will cause an error if the detail page is missing from the server.
To upload the samples files to the web server:
1. In the Files panel (Window > Files), select the root folder of the site in the Local View pane.
2. The root folder is the first folder in the list.
3. Click the blue Put Files arrow icon in the Files panel toolbar, and confirm that you want to upload the entire site.
4. Dreamweaver copies all the files to the web server folder you defined in Defining a remote folder.
The Dreamweaver site is now defined. The next step is to connect to the sample database installed with Dreamweaver. (See Connecting to the sample database (PHP).)

Connecting to the sample database (PHP)
During installation, Dreamweaver copies a SQL script to your hard disk. You can use this script to automatically create a sample MySQL database. This section describes how to create a connection to the sample database.
This section assumes you have installed and configured MySQL on your local or remote computer. To download and install the database system, visit the MySQL website at www.mysql.com.


Creating the MySQL database
The sample files for Dreamweaver MX 2004 include a SQL script capable of creating and populating a sample MySQL database.
Before starting, make sure MySQL is installed and configured on your local or remote computer. You can download the latest version from the MySQL website at www.mysql.com.
To create the sample MySQL database:
1. Copy the SQL script file, insert.sql, to an appropriate folder on the computer that has MySQL installed.
2. If you installed Dreamweaver to its default location, the path to the script file is as follows:
• C:\Program Files\Macromedia\Dreamweaver MX 2004\Samples\Database\insert.sql (Windows)
• /Applications/Macromedia Dreamweaver MX 2004/Samples/Database/insert.sql (Macintosh)
3. If the computer running MySQL is a Windows computer, copy the insert.sql script to MySql\Bin. If the computer running MySQL is a Macintosh, copy the insert.sql script to your Documents folder in your home folder.
4. On the computer that has MySQL installed, open a command prompt window (Windows) or a Terminal window (Macintosh).
• In Windows, you can open the command prompt by selecting Start > Programs > Command Prompt or Start > Programs > Accessories > Command Prompt.
• On the Macintosh, you can open a Terminal window by going to the Applications folder, opening the Utilities folder, and double-clicking Terminal.
5. (Windows only) Change to the mysql\bin directory by entering the following commands at the command prompt:
6. cd \
7. cd mysql\bin
8. Note: On the Macintosh, you should be able to run mysql from any directory; it should have been added to your path during installation of MySQL. If the following step doesn't work on the Macintosh, though, try typing /usr/local/bin/mysql instead of mysql.
9. Start the MySQL client by entering the following command:
10. mysql -uUser -pPassword
11. For example, if your MySQL user name (also known as an account name) and password are Tara and Telly3, then enter the following command:
12. mysql -uTara -pTelly3
13. If you don't have a password, omit the -p argument as follows:
14. mysql -uTara
15. If you didn't define a user name while configuring your MySQL installation, enter root as the user name, as follows:
16. mysql -uroot
17. The MySQL client's command prompt appears, as follows:
18. mysql>
19. Create a new database by entering the following command at the MySQL prompt:
20. mysql>CREATE DATABASE TrioMotors;[/quote]

Last login: Mon Mar 27 23:05:38 on ttyp1
Welcome to Darwin!
mac:~ albert$ mysql -uMonaco
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13 to server version: 4.1.18-standard

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> CREATE DATABASE TrioMotors;
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'triomotors'
mysql>
Needless to say, I can't get any further. :-/

[quote]21. MySQL creates a new database, but it doesn't contain any tables or records yet.
22. Log out of the MySQL client by entering the following command at the prompt:
23. mysql>quit;
24. At the system command prompt, populate the new TrioMotors database in MySQL.
25. In Windows, use the following command:
26. mysql -uUser -pPassword TrioMotors < insert.sql
27. On the Macintosh, use the following command:
28. mysql -uUser -pPassword TrioMotors < ~/Documents/insert.sql
29. This command uses the insert.sql file to add tables and records to the TrioMotors database you created in step 5.
After creating the MySQL database, create a database connection to it in Dreamweaver. (See Creating a database connection.)[/quote]
Link to comment
Share on other sites

which part of your 'War & Peace' did you want us to read first? lol

i may have mentioned this in an earlier post in this topic, but: whip open Safari. type in: [a href=\"http://localhost\" target=\"_blank\"]http://localhost[/a].

1, if it worked -> great, you've just learnt how to walk. now you can learn to run
2, if it didnt work, then it's not a surprise that none of the other stuff works. first things first. open your system preferences, then 'Sharing' (i think it is) and make sure you have 'Web sharing' or whatever it is checked. try again.

Link to comment
Share on other sites

[!--quoteo(post=359434:date=Mar 28 2006, 10:10 PM:name=Devious Designs)--][div class=\'quotetop\']QUOTE(Devious Designs @ Mar 28 2006, 10:10 PM) [snapback]359434[/snapback][/div][div class=\'quotemain\'][!--quotec--]
redbullmarky,

I can access localhost. I just can't run SQL
[/quote]

ok so you can't run SQL now, so i'm guessing that your PHP problem is ok now?

with SQL, i think that to create databases you need to log in as root user:

mysql -u root -p

if you've not set the password for root, then when it asks, just press enter. if it works, youre in and you can then set your root password then start your 'create database' stuff.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.