jazzman1
Staff Alumni-
Posts
2,713 -
Joined
-
Last visited
-
Days Won
12
Everything posted by jazzman1
-
How To Remove .php - Why So Many Options?
jazzman1 replied to justlukeyou's topic in Apache HTTP Server
Looking pretty for visitors but not for the server (machine) The test I made it in my local CentOS server and everything works just fine. Make sure that a tree directory structure is correct. -
How To Remove .php - Why So Many Options?
jazzman1 replied to justlukeyou's topic in Apache HTTP Server
Check Apache conf whether a mod_rewrite module is installed and enabled too. May I ask you something? Is there some reasonably reason to do this? I just provide you en axample, but not sure how mutch effectively an flexible is that if you have a complex web structure. -
How To Remove .php - Why So Many Options?
jazzman1 replied to justlukeyou's topic in Apache HTTP Server
Alright then, let's doing the test. Assuming the we have the next structure: / # web root directory /project # the folder of your project # in that exampe let's say you have two .php files and one .htaccess /project/test.php #contains <?php echo "project testing file" ?> /project/debug.php #contains <?php echo "project debugging file" ?> /project/.htaccess The content of the .htaccess file should be: RewriteEngine on RewriteCond %{REQUEST_URI} ^/project/([a-z]+)\.php$ RewriteRule ^(.*)$ /project/%1 [R=301,L] RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^(.*)$ /project/$1.php [L,QSA] Now if someone try to achieve for instance /project/test.php you will see that the URL is going to change from /project/test.php to /project/test, but also you will get a message: b/s you're trying to redirect the same request to the same page. But now let's make another test. Delete only the php files inside the project folder and create a new sub-directory for this test we will named it - /project/web Inside this new web directory create two files test.php and debug.php. And change the rule of .htaccess: RewriteEngine on RewriteCond %{REQUEST_URI} ^/project/([a-z]+)\.php$ RewriteRule ^(.*)$ /project/%1 [R=301,L] RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^(.*)$ /project/web/$1.php [L,QSA] Now that files are going to be reached as URL's - /project/debug.php or /project/debug even they don't exist inside /project folder. If some smart user try to achieve for instance /project/web/debug.php, you could create a new .htaccess file in this folder with a new rule of a forbidden flag (forbidden|F ) telling Apache not to provide a page in response to this request. -
Good for you You can use a "&" symbol only if you want see the content of file with some GUI editor like "gedit" for instance, running the view outside of a terminal window. Example: [jazz@centos-box ~]$ gedit some_file &
-
Try, $stdout_stream = ssh2_exec($connection, "cd samp03;nohup ./samp03svr &");
-
Then this path is wrong - cd samp03 & nohup. Also, if you have to execute a file inside directory executing it from external one you don't have to apply "./" only the path. Try, $stdout_stream = ssh2_exec($connection, "cd ~/samp03/samp03svr &"); Or if you want to see the content of the file: $stdout_stream = ssh2_exec($connection, "vim ~/samp03/samp03svr &");
-
To execute a file in unix you have to give it a proper permissions. Can you give the result of: ls -la /path/to/samp03svr
-
Before to start looking deeply on your script, do you have any ssh client installed on the server?
-
No, especially if you're planning to send a mass of emails to our subscribers. You have to consider using some php mail library as swiftMailer or phpMailer
-
It's time to show us every hidden .htaccess files on this project
-
How To Remove .php - Why So Many Options?
jazzman1 replied to justlukeyou's topic in Apache HTTP Server
@justlukeyou, you can apply multiple rules to the same document, but....it's not allowed to redirect the request to the same page! Solution: Aplly fake urls and redirect them to a different (real) directory on the same project. -
Use only those: <Files "^\.ht"> Require all granted </Files> // or <Files "^\.ht*"> Require all granted </Files> Restart Apache server. When you try to insert some values to the database, did you get some error message? Are you sure that the type of idinput is integer?
-
A here document is a special-purpose code block and allows me easily to quoting/escaping the strings effectively. About < (<) and > (>), there are html character entities, so to display for instance a less than sign we must write: < or < But...when you try to send emails you can use both of them, I think. For example: From: "$name" <$email>
-
Just put down simple echo "Test page" and see if you get any result.
-
That's good something differently happened on the web server that means work Maybe the tilde (~) symbol is treated wrong, try without it.
-
Blank page, no errors, no messages, no echoes ??? Put down error_reporting(-1) on the top of the file and come back again.
-
He-he, that's life php coding So, try that: <?php if (function_exists('mail')) { extract($_POST); $to = "sehgal_jas@yahoo.com"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers.= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers.= <<<EOD From: "$name" <$email> EOD; // send message if (mail($to, $subject, $message, $headers)) { echo "mail send ... OK"; } else { echo "mail send ... ERROR!"; } } else { echo 'mail() has been disabled'; exit; } Make sure all variables are defined in proper way.
-
It's coming from the heredoc - EOD; Make sure that there is no an empty space before that one - EOD; (10 row)
-
how to redirect all URLs to a different URL?
jazzman1 replied to sasori's topic in Apache HTTP Server
Use the same logic - http://forums.phpfreaks.com/topic/277958-htaccess-re-writing-a-url-using-multiple-parts-of-the-original/ -
Take that and give us the result back if there is an error: <?php if (function_exists('mail')) { extract($_POST); $to = "sehgal_jas@yahoo.com"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers.= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers.= <<<EOD From: "$name" <$email> EOD; } else { echo 'mail() has been disabled'; exit; } // send message if (mail($to, $subject, $message, $headers)) { echo "mail send ... OK"; } else { echo "mail send ... ERROR!"; } Make sure that the "$subject" and the "$message" variables are defined!
-
No, it's not, The proper format should be From: user@domain.com will work// or quote a userNameFrom: "user" <user@domain.com>
-
Change: <Files ".ht*"> Require all granted </Files> // to <Files ~ "^\.ht"> Require all granted </Files> Don't forget to restat Apache.
-
I am not sure what exactly you wanna achieve, but when we're talking about php, mysql, apache, etc... it's always good idea to provide us some sample of your code. Anyways......you could pass an url by global get variable like a daemon using a shell_exec() function for that example, make sure that you have installed php-cgi module. Let's say we have two different files, index.php <?php ############ MYSQL DATABASE SCRIPTS ############# $id = $_SESSION['id']; // the id to this particular session //executing the GET['id'] by terminal echo shell_exec("php-cgi -f /var/www/html/test/debug.php id=$id"); debug.php <?php // get user's information selected by array id $blogPosts = array( 1 => array( 'date' => '2011-03-29', 'author' => 'jazzman', 'title' => 'phpfeaks', 'body' => 'some content', ), 2 => array( 'date' => '2011-03-29', 'author' => 'mac_gyver', 'title' => 'phpfeaks', 'body' => 'some beautiful content', ), ); echo '<pre>'.print_r($blogPosts[$_GET['id']], true).'</pre>'; Results:
-
It sounds like the access to web root directory was denied by Apache config. Can you show us the "<DIRECTORY" section describing your web root configuration?