Learning PHP
Permalink
I have begun learning PHP using an eBook. The following strange results are happening: Per the book I have created two simple PHP files. They are named phpinfo.php and hello.php. Both files show in the user root directory. Both files show when I use the ls command in my mac terminal.
When I try to run them in my browser only the first one runs. The second results in a 404 error, File Not Found. How is this possible?
Thanks
When I try to run them in my browser only the first one runs. The second results in a 404 error, File Not Found. How is this possible?
Thanks
How would I check where the system is pointing? Thanks
Are your working locally ? Wich environnement pc mac ? Do you have WAMP or easyphp installed?
I am working locally on my macbook. I downloaded and installed the latest version of PHP from php-osx.liip.ch. This version does not override the version that is builtin OSX. It installs in a different location.
As instructed in the book, I run the PHP programs from my Chrome browser:
Http://localhost/phpinfo.php works
Http://localhost/hello.php returns 404 error.
Both files are in my user root directory and nowhere else as far as I know.
UPDATE: This may or may not be relevant. I was checking file permissions in the root folder. I noticed that the hello.php file had the following permissions: -rw-r--r--@
The @ indicates extended permissions and they are accessed with the xattr -l command. It displayed the following:
python: posix_spawn: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No such file or directory
I don't know what it means but seems like some kind of error.
Further checking showed that the above "error" displays for all files and directories in the folder.
As instructed in the book, I run the PHP programs from my Chrome browser:
Http://localhost/phpinfo.php works
Http://localhost/hello.php returns 404 error.
Both files are in my user root directory and nowhere else as far as I know.
UPDATE: This may or may not be relevant. I was checking file permissions in the root folder. I noticed that the hello.php file had the following permissions: -rw-r--r--@
The @ indicates extended permissions and they are accessed with the xattr -l command. It displayed the following:
python: posix_spawn: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No such file or directory
I don't know what it means but seems like some kind of error.
Further checking showed that the above "error" displays for all files and directories in the folder.
I recommand you to install MAMP to have a full working web server solution with php and mysql.
It will be much easier to test your pages
http://www.mamp.info/en/
It will be much easier to test your pages
http://www.mamp.info/en/
I deleted the new downloaded version of php and installed MAMP. But how do I use MAMP? I can start it and turn on servers but where do I enter code? Sorry for question.
Do you know how to use Google ? :)https://www.youtube.com/watch?v=cdZWUJzdcDk...
I watched the video and things are working now, Thank you.
check that your file hello.php doesn't have an extra space somewhere in the file name, maybe at the end after the extension or at the beginning.
a 404 error says the webserver cannot find the specified page. I think you are pointing to the wrong folder/filename. Did you check this ?